Calculating Windows Size

This commit is contained in:
Noah
2021-10-04 12:30:24 +02:00
parent 9cb505d4da
commit 03bab94c0f
2 changed files with 10 additions and 7 deletions
+8 -6
View File
@@ -249,13 +249,15 @@ public class Control {
private void calcSize(){
float c = 800;
float ratio = (float) (xSize) / (float) (ySize);
if (xSize > ySize){
width = 800;
height = (int) (width / ratio);
} else {
height = 800;
width = (int) (height * ratio);
}
width = Math.round(xSize * (c / xSize));
height = Math.round(ySize * (c / ySize));
System.out.println(xSize + " " + width);
System.out.println(ySize + " " + height);
}