public Camera(int width, int height, int windowWidth, int windowHeight)
{
Width = width;
Height = height;
_windowWidth = windowWidth;
_windowHeight = windowHeight;
MaxZoom = 1.0f;
while (true)
{
MaxZoom -= 0.05f;
if (width * MaxZoom < windowWidth && height * MaxZoom < windowHeight)
{
//Get a maxZoom that have the items fill the screen
float temp = windowWidth / (float)width;
MaxZoom = windowHeight / (float)height;
if (temp < MaxZoom)
{
MaxZoom = temp;
}
break;
}
if (MaxZoom <= 0)
{
MaxZoom = 0.05f;
break;
}
}
ZoomDistance = 1.0f;
}