more easier access to common variables

This commit is contained in:
yugecin
2018-07-08 00:47:35 +02:00
parent 4338513180
commit 0fc2008f2a
19 changed files with 76 additions and 107 deletions

View File

@@ -69,9 +69,6 @@ public class DisplayContainer implements ErrorDumpable, SkinChangedListener {
private Graphics graphics;
public int mouseX;
public int mouseY;
private int targetUpdatesPerSecond;
public int targetUpdateInterval;
private int targetRendersPerSecond;
@@ -79,7 +76,6 @@ public class DisplayContainer implements ErrorDumpable, SkinChangedListener {
public int targetBackgroundRenderInterval;
private boolean rendering;
public int renderDelta;
public int delta;
public boolean exitRequested;
@@ -230,7 +226,7 @@ public class DisplayContainer implements ErrorDumpable, SkinChangedListener {
bubNotifs.render(graphics);
barNotifs.render(graphics);
cursor.updateAngle(renderDelta);
cursor.updateAngle();
if (drawCursor) {
cursor.draw(Mouse.isButtonDown(Input.MOUSE_LEFT_BUTTON) ||
Mouse.isButtonDown(Input.MOUSE_RIGHT_BUTTON));

View File

@@ -76,6 +76,8 @@ public class InstanceContainer {
public static GamePauseMenu pauseState;
public static int width, width2, height, height2;
public static int mouseX, mouseY;
public static int renderDelta;
public static void kickstart() {
updater = new Updater();

View File

@@ -130,7 +130,7 @@ public abstract class ComplexOpsuState extends BaseOpsuState {
public void preRenderUpdate() {
super.preRenderUpdate();
for (Component component : components) {
component.updateHover(displayContainer.mouseX, displayContainer.mouseY);
component.updateHover(mouseX, mouseY);
component.preRenderUpdate();
}
for (OverlayOpsuState overlay : overlays) {

View File

@@ -57,7 +57,7 @@ public class BarNotificationState implements ResolutionChangedListener {
if (timeShown >= TOTAL_TIME) {
return;
}
timeShown += displayContainer.renderDelta;
timeShown += renderDelta;
processAnimations();
g.setColor(bgcol);
g.fillRect(0, height2 - barHalfHeight, width, barHalfHeight * 2);

View File

@@ -53,7 +53,7 @@ public class BubNotifState implements MouseListener, ResolutionChangedListener {
if (!iter.hasNext()) {
return;
}
addAnimationTime += displayContainer.renderDelta;
addAnimationTime += renderDelta;
if (addAnimationTime > IN_TIME) {
finishAddAnimation();
}
@@ -63,7 +63,7 @@ public class BubNotifState implements MouseListener, ResolutionChangedListener {
if (animateUp && addAnimationTime < IN_TIME) {
next.y = next.baseY - (int) (addAnimationHeight * AnimationEquation.OUT_QUINT.calc((float) addAnimationTime / IN_TIME));
}
if (next.render(g, displayContainer.mouseX, displayContainer.mouseY, displayContainer.renderDelta)) {
if (next.render(g, mouseX, mouseY, renderDelta)) {
iter.remove();
}
animateUp = true;

View File

@@ -49,7 +49,7 @@ public class FpsRenderState implements ResolutionChangedListener {
}
public void render(Graphics g) {
fpsMeter.update(displayContainer.renderDelta);
fpsMeter.update(renderDelta);
if (!OPTION_SHOW_FPS.state) {
return;
}