From a39ac19bb01db7cab13b5b5f02c75738026f35f3 Mon Sep 17 00:00:00 2001 From: yugecin Date: Tue, 27 Sep 2016 20:52:52 +0200 Subject: [PATCH] move width/height from container to options class --- src/itdelatrisu/opsu/Container.java | 2 -- src/itdelatrisu/opsu/Options.java | 6 ++++++ src/itdelatrisu/opsu/Utils.java | 6 +++--- src/yugecin/opsudance/movers/CircleMover.java | 4 ++-- src/yugecin/opsudance/spinners/RektSpinner.java | 12 ++++++------ 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/itdelatrisu/opsu/Container.java b/src/itdelatrisu/opsu/Container.java index 88b567b6..0be55d73 100644 --- a/src/itdelatrisu/opsu/Container.java +++ b/src/itdelatrisu/opsu/Container.java @@ -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 diff --git a/src/itdelatrisu/opsu/Options.java b/src/itdelatrisu/opsu/Options.java index 78a15d2a..757abcba 100644 --- a/src/itdelatrisu/opsu/Options.java +++ b/src/itdelatrisu/opsu/Options.java @@ -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)); diff --git a/src/itdelatrisu/opsu/Utils.java b/src/itdelatrisu/opsu/Utils.java index ee72c8ca..9ff34ffe 100644 --- a/src/itdelatrisu/opsu/Utils.java +++ b/src/itdelatrisu/opsu/Utils.java @@ -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; } } diff --git a/src/yugecin/opsudance/movers/CircleMover.java b/src/yugecin/opsudance/movers/CircleMover.java index fc94c505..fd5c25dc 100644 --- a/src/yugecin/opsudance/movers/CircleMover.java +++ b/src/yugecin/opsudance/movers/CircleMover.java @@ -17,7 +17,7 @@ */ package yugecin.opsudance.movers; -import itdelatrisu.opsu.Container; +import itdelatrisu.opsu.Options; import itdelatrisu.opsu.Utils; import itdelatrisu.opsu.objects.GameObject; @@ -63,7 +63,7 @@ public class CircleMover extends Mover { double a = ang + SOME_CONSTANT * t; pos[0] = (startX + (endX - startX) * t) - middlexoffset - Math.cos(a) * radius; pos[1] = (startY + (endY - startY) * t) - middleyoffset - Math.sin(a) * radius; - if (pos[0] < 0 || Container.width < pos[0] || pos[1] < 0 || Container.height < pos[1]) { + if (pos[0] < 0 || Options.width < pos[0] || pos[1] < 0 || Options.height < pos[1]) { pass = false; break; } diff --git a/src/yugecin/opsudance/spinners/RektSpinner.java b/src/yugecin/opsudance/spinners/RektSpinner.java index 474baa6f..41193d7b 100644 --- a/src/yugecin/opsudance/spinners/RektSpinner.java +++ b/src/yugecin/opsudance/spinners/RektSpinner.java @@ -17,7 +17,7 @@ */ package yugecin.opsudance.spinners; -import itdelatrisu.opsu.Container; +import itdelatrisu.opsu.Options; public class RektSpinner extends Spinner { @@ -25,11 +25,11 @@ public class RektSpinner extends Spinner { public void init() { init(new double[][] { { 10, 10 }, - { Container.width / 2d, 10 }, - { Container.width - 10, 10 }, - { Container.width - 10, Container.height - 10 }, - { Container.width / 2d, Container.height - 10 }, - { 10, Container.height - 10 } + { Options.width / 2d, 10 }, + { Options.width - 10, 10 }, + { Options.width - 10, Options.height - 10 }, + { Options.width / 2d, Options.height - 10 }, + { 10, Options.height - 10 } }); }