Calculating Windows Size
This commit is contained in:
@@ -249,13 +249,15 @@ public class Control {
|
|||||||
|
|
||||||
private void calcSize(){
|
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);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -1,13 +1,14 @@
|
|||||||
package main;
|
package main;
|
||||||
|
|
||||||
import game.Control;
|
|
||||||
|
|
||||||
|
import game.Control;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Control control = new Control();
|
Control control = new Control();
|
||||||
control.start();
|
control.start();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user