fix overlay event dispatch ordering in game

This commit is contained in:
yugecin 2018-07-08 10:45:45 +02:00
parent d7e59531ea
commit 4a69f1d9b3
No known key found for this signature in database
GPG Key ID: 2C5AC035A7068E44

View File

@ -713,13 +713,13 @@ public class Game extends ComplexOpsuState {
displayContainer.cursor.draw(Utils.isGameKeyPressed()); displayContainer.cursor.draw(Utils.isGameKeyPressed());
} }
super.render(g);
if (OPTION_DANCE_ENABLE_SB.state) { if (OPTION_DANCE_ENABLE_SB.state) {
optionsOverlay.render(g); optionsOverlay.render(g);
} }
UI.draw(g); UI.draw(g);
super.render(g);
} }
@Override @Override
@ -1102,11 +1102,11 @@ public class Game extends ComplexOpsuState {
@Override @Override
public boolean keyPressed(int key, char c) { public boolean keyPressed(int key, char c) {
if (super.keyPressed(key, c)) { if (OPTION_DANCE_ENABLE_SB.state && optionsOverlay.keyPressed(key, c)) {
return true; return true;
} }
if (OPTION_DANCE_ENABLE_SB.state && optionsOverlay.keyPressed(key, c)) { if (super.keyPressed(key, c)) {
return true; return true;
} }
@ -1242,20 +1242,22 @@ public class Game extends ComplexOpsuState {
@Override @Override
public boolean mouseDragged(int oldx, int oldy, int newx, int newy) { public boolean mouseDragged(int oldx, int oldy, int newx, int newy) {
if (super.mouseDragged(oldx, oldy, newx, newy)) { if (OPTION_DANCE_ENABLE_SB.state &&
optionsOverlay.mouseDragged(oldx, oldy, newx, newy))
{
return true; return true;
} }
return OPTION_DANCE_ENABLE_SB.state &&
optionsOverlay.mouseDragged(oldx, oldy, newx, newy); return super.mouseDragged(oldx, oldy, newx, newy);
} }
@Override @Override
public boolean mousePressed(int button, int x, int y) { public boolean mousePressed(int button, int x, int y) {
if (super.mousePressed(button, x, y)) { if (OPTION_DANCE_ENABLE_SB.state && optionsOverlay.mousePressed(button, x, y)) {
return true; return true;
} }
if (OPTION_DANCE_ENABLE_SB.state && optionsOverlay.mousePressed(button, x, y)) { if (super.mousePressed(button, x, y)) {
return true; return true;
} }
@ -1360,11 +1362,11 @@ public class Game extends ComplexOpsuState {
@Override @Override
public boolean mouseReleased(int button, int x, int y) { public boolean mouseReleased(int button, int x, int y) {
if (super.mouseReleased(button, x, y)) { if (OPTION_DANCE_ENABLE_SB.state && optionsOverlay.mouseReleased(button, x, y)) {
return true; return true;
} }
if (OPTION_DANCE_ENABLE_SB.state && optionsOverlay.mouseReleased(button, x, y)) { if (super.mouseReleased(button, x, y)) {
return true; return true;
} }
@ -1393,14 +1395,14 @@ public class Game extends ComplexOpsuState {
@Override @Override
public boolean keyReleased(int key, char c) { public boolean keyReleased(int key, char c) {
if (super.keyReleased(key, c)) {
return true;
}
if (OPTION_DANCE_ENABLE_SB.state && optionsOverlay.keyReleased(key, c)) { if (OPTION_DANCE_ENABLE_SB.state && optionsOverlay.keyReleased(key, c)) {
return true; return true;
} }
if (super.keyReleased(key, c)) {
return true;
}
if (gameFinished) { if (gameFinished) {
return true; return true;
} }
@ -1434,11 +1436,11 @@ public class Game extends ComplexOpsuState {
@Override @Override
public boolean mouseWheelMoved(int newValue) { public boolean mouseWheelMoved(int newValue) {
if (super.mouseWheelMoved(newValue)) { if (OPTION_DANCE_ENABLE_SB.state && optionsOverlay.mouseWheelMoved(newValue)) {
return true; return true;
} }
if (OPTION_DANCE_ENABLE_SB.state && optionsOverlay.mouseWheelMoved(newValue)) { if (super.mouseWheelMoved(newValue)) {
return true; return true;
} }