move width/height from container to options class
This commit is contained in:
@@ -41,8 +41,6 @@ public class Container extends AppGameContainer {
|
||||
protected SlickException e = null;
|
||||
|
||||
public static Container instance;
|
||||
public static int width;
|
||||
public static int height;
|
||||
|
||||
/**
|
||||
* Create a new container wrapping a game
|
||||
|
||||
@@ -797,6 +797,9 @@ public class Options {
|
||||
/** Current screen resolution. */
|
||||
private static Resolution resolution = Resolution.RES_1024_768;
|
||||
|
||||
public static int width;
|
||||
public static int height;
|
||||
|
||||
/** The available skin directories. */
|
||||
private static String[] skinDirs;
|
||||
|
||||
@@ -915,6 +918,9 @@ public class Options {
|
||||
ErrorHandler.error("Failed to set display mode.", e, true);
|
||||
}
|
||||
|
||||
width = resolution.width;
|
||||
height = resolution.height;
|
||||
|
||||
// set borderless window if dimensions match screen size
|
||||
boolean borderless = (screenWidth == resolution.getWidth() && screenHeight == resolution.getHeight());
|
||||
System.setProperty("org.lwjgl.opengl.Window.undecorated", Boolean.toString(borderless));
|
||||
|
||||
@@ -569,10 +569,10 @@ public class Utils {
|
||||
}
|
||||
|
||||
public static int getQuadrant(double x, double y) {
|
||||
if (x < Container.width / 2d) {
|
||||
return y < Container.height / 2d ? 2 : 3;
|
||||
if (x < Options.width / 2d) {
|
||||
return y < Options.height / 2d ? 2 : 3;
|
||||
}
|
||||
return y < Container.height / 2d ? 1 : 4;
|
||||
return y < Options.height / 2d ? 1 : 4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user