mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-20 06:43:51 +00:00
Initial commit
This commit is contained in:
parent
def8cb4153
commit
b691c43c44
19437 changed files with 4363922 additions and 0 deletions
38
Minecraft.Client/ScreenSizeCalculator.cpp
Normal file
38
Minecraft.Client/ScreenSizeCalculator.cpp
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue