Files
MinecraftConsoles/Minecraft.Client/ScreenSizeCalculator.cpp
Loki Rautio 087b7e7abf Revert "Project modernization (#630)"
This code was not tested and breaks in Release builds, reverting to restore
functionality of the nightly. All in-game menus do not work and generating
a world crashes.

This reverts commit a9be52c41a.
2026-03-07 21:12:22 -06:00

38 lines
707 B
C++

#include "stdafx.h"
#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 / (double) scale;
rawHeight = h / (double) scale;
w = (int) ceil(rawWidth);
h = (int) ceil(rawHeight);
}
int ScreenSizeCalculator::getWidth()
{
return w;
}
int ScreenSizeCalculator::getHeight()
{
return h;
}