diff options
| author | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
|---|---|---|
| committer | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
| commit | b691c43c44ff180d10e7d4a9afc83b98551ff586 (patch) | |
| tree | 3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.Client/ScreenSizeCalculator.cpp | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.Client/ScreenSizeCalculator.cpp')
| -rw-r--r-- | Minecraft.Client/ScreenSizeCalculator.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Minecraft.Client/ScreenSizeCalculator.cpp b/Minecraft.Client/ScreenSizeCalculator.cpp new file mode 100644 index 00000000..32e942a7 --- /dev/null +++ b/Minecraft.Client/ScreenSizeCalculator.cpp @@ -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; +}
\ No newline at end of file |
