Files
GabsPuNs-Project_Zenith_Main/Minecraft.Client/ScreenSizeCalculator.cpp
GabsPuNs bc6c09146a New File System and Cleanup some code Part 3
* Remove stdafx.h and some <unordered_set> includes
* Update Minecraft Server Defines and remove more unused folders/files
* Unbloat stdafx.h from Minecraft.World
2026-05-24 22:21:41 -04:00

37 lines
735 B
C++

#include "ScreenSizeCalculator.h"
#include "Options.h"
ScreenSizeCalculator::ScreenSizeCalculator(Options *options, int width, int height, int forceScale/*=-1*/)
{
w = width;
h = height;
if( forceScale == -1 )
{
scale = 1;
int maxScale = options->guiScale;
if (maxScale == 0) maxScale = 1000;
while (scale < maxScale && w / (scale + 1) >= 320 && h / (scale + 1) >= 240)
{
scale++;
}
}
else
{
scale = forceScale;
}
rawWidth = w / static_cast<double>(scale);
rawHeight = h / static_cast<double>(scale);
w = static_cast<int>(ceil(rawWidth));
h = static_cast<int>(ceil(rawHeight));
}
int ScreenSizeCalculator::getWidth()
{
return w;
}
int ScreenSizeCalculator::getHeight()
{
return h;
}