remove options as overlay state
This commit is contained in:
@@ -712,6 +712,10 @@ public class Game extends ComplexOpsuState {
|
||||
} else {
|
||||
displayContainer.cursor.draw(Utils.isGameKeyPressed());
|
||||
}
|
||||
|
||||
if (OPTION_DANCE_ENABLE_SB.state) {
|
||||
optionsOverlay.render(g);
|
||||
}
|
||||
|
||||
UI.draw(g);
|
||||
|
||||
@@ -721,6 +725,10 @@ public class Game extends ComplexOpsuState {
|
||||
@Override
|
||||
public void preRenderUpdate() {
|
||||
super.preRenderUpdate();
|
||||
|
||||
if (OPTION_DANCE_ENABLE_SB.state) {
|
||||
optionsOverlay.preRenderUpdate();
|
||||
}
|
||||
|
||||
int delta = renderDelta;
|
||||
|
||||
@@ -1098,6 +1106,10 @@ public class Game extends ComplexOpsuState {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (OPTION_DANCE_ENABLE_SB.state && optionsOverlay.keyPressed(key, c)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (gameFinished) {
|
||||
return true;
|
||||
}
|
||||
@@ -1233,7 +1245,8 @@ public class Game extends ComplexOpsuState {
|
||||
if (super.mouseDragged(oldx, oldy, newx, newy)) {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
return OPTION_DANCE_ENABLE_SB.state &&
|
||||
optionsOverlay.mouseDragged(oldx, oldy, newx, newy);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1241,6 +1254,10 @@ public class Game extends ComplexOpsuState {
|
||||
if (super.mousePressed(button, x, y)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (OPTION_DANCE_ENABLE_SB.state && optionsOverlay.mousePressed(button, x, y)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (gameFinished) {
|
||||
return true;
|
||||
@@ -1347,6 +1364,10 @@ public class Game extends ComplexOpsuState {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (OPTION_DANCE_ENABLE_SB.state && optionsOverlay.mouseReleased(button, x, y)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (gameFinished) {
|
||||
return true;
|
||||
}
|
||||
@@ -1375,6 +1396,10 @@ public class Game extends ComplexOpsuState {
|
||||
if (super.keyReleased(key, c)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (OPTION_DANCE_ENABLE_SB.state && optionsOverlay.keyReleased(key, c)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (gameFinished) {
|
||||
return true;
|
||||
@@ -1412,6 +1437,10 @@ public class Game extends ComplexOpsuState {
|
||||
if (super.mouseWheelMoved(newValue)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (OPTION_DANCE_ENABLE_SB.state && optionsOverlay.mouseWheelMoved(newValue)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (OPTION_DISABLE_MOUSE_WHEEL.state) {
|
||||
return true;
|
||||
@@ -1425,11 +1454,9 @@ public class Game extends ComplexOpsuState {
|
||||
public void enter() {
|
||||
overlays.clear();
|
||||
if (OPTION_DANCE_ENABLE_SB.state) {
|
||||
overlays.add(optionsOverlay);
|
||||
overlays.add(moveStoryboardOverlay);
|
||||
overlays.add(storyboardOverlay);
|
||||
storyboardOverlay.onEnter();
|
||||
optionsOverlay.revalidate();
|
||||
}
|
||||
|
||||
super.enter();
|
||||
@@ -1691,6 +1718,8 @@ public class Game extends ComplexOpsuState {
|
||||
if (OPTION_DANCE_ENABLE_SB.state) {
|
||||
storyboardOverlay.onLeave();
|
||||
}
|
||||
|
||||
optionsOverlay.hide();
|
||||
|
||||
isInGame = false;
|
||||
// container.setMouseGrabbed(false);
|
||||
|
||||
@@ -469,11 +469,18 @@ public class MainMenu extends BaseOpsuState {
|
||||
);
|
||||
g.drawString(txt, textMarginX, textTopMarginY + textLineHeight * 2);
|
||||
|
||||
optionsOverlay.render(g);
|
||||
if (optionsOverlay.isActive()) {
|
||||
backButton.draw(g);
|
||||
}
|
||||
|
||||
UI.draw(g);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRenderUpdate() {
|
||||
optionsOverlay.preRenderUpdate();
|
||||
|
||||
int delta = renderDelta;
|
||||
|
||||
final Iterator<PulseData> pulseDataIter = this.pulseData.iterator();
|
||||
@@ -667,6 +674,10 @@ public class MainMenu extends BaseOpsuState {
|
||||
|
||||
@Override
|
||||
public boolean mousePressed(int button, int x, int y) {
|
||||
if (optionsOverlay.mousePressed(button, x, y)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// check mouse button
|
||||
if (button == Input.MOUSE_MIDDLE_BUTTON)
|
||||
return false;
|
||||
@@ -787,6 +798,12 @@ public class MainMenu extends BaseOpsuState {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.buttonPositions[1].contains(x, y, 0.25f)) {
|
||||
SoundController.playSound(SoundEffect.MENUHIT);
|
||||
optionsOverlay.show();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.buttonPositions[2].contains(x, y, 0.25f)) {
|
||||
displayContainer.exitRequested = true;
|
||||
return true;
|
||||
@@ -798,7 +815,7 @@ public class MainMenu extends BaseOpsuState {
|
||||
|
||||
@Override
|
||||
public boolean mouseWheelMoved(int newValue) {
|
||||
if (super.mouseWheelMoved(newValue)) {
|
||||
if (optionsOverlay.mouseWheelMoved(newValue)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -808,7 +825,7 @@ public class MainMenu extends BaseOpsuState {
|
||||
|
||||
@Override
|
||||
public boolean keyPressed(int key, char c) {
|
||||
if (super.keyPressed(key, c)) {
|
||||
if (optionsOverlay.keyPressed(key, c)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -843,9 +860,28 @@ public class MainMenu extends BaseOpsuState {
|
||||
case KEY_DOWN:
|
||||
UI.changeVolume(-1);
|
||||
return true;
|
||||
case KEY_O:
|
||||
if (input.isControlDown()) {
|
||||
optionsOverlay.show();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyReleased(int key, char c) {
|
||||
return optionsOverlay.keyReleased(key, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseReleased(int button, int x, int y) {
|
||||
return optionsOverlay.mouseReleased(button, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseDragged(int oldx, int oldy, int newx, int newy) {
|
||||
return optionsOverlay.mouseDragged(oldx, oldy, newx, newy);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the coordinates are within the music position bar bounds.
|
||||
@@ -886,6 +922,9 @@ public class MainMenu extends BaseOpsuState {
|
||||
* Enters the song menu, or the downloads menu if no beatmaps are loaded.
|
||||
*/
|
||||
private void enterSongMenu() {
|
||||
if (optionsOverlay.isActive()) {
|
||||
optionsOverlay.hide();
|
||||
}
|
||||
OpsuState state = songMenuState;
|
||||
if (BeatmapSetList.get().getMapSetCount() == 0) {
|
||||
barNotifs.send("Download some beatmaps to get started!");
|
||||
|
||||
@@ -64,8 +64,6 @@ import org.newdawn.slick.Input;
|
||||
import org.newdawn.slick.SpriteSheet;
|
||||
import org.newdawn.slick.gui.TextField;
|
||||
import yugecin.opsudance.core.state.ComplexOpsuState;
|
||||
import yugecin.opsudance.options.OptionGroups;
|
||||
import yugecin.opsudance.ui.OptionsOverlay;
|
||||
|
||||
import static org.lwjgl.input.Keyboard.*;
|
||||
import static yugecin.opsudance.core.InstanceContainer.*;
|
||||
@@ -310,12 +308,8 @@ public class SongMenu extends ComplexOpsuState {
|
||||
/** Sort order dropdown menu. */
|
||||
private DropdownMenu<BeatmapSortOrder> sortMenu;
|
||||
|
||||
private final OptionsOverlay optionsOverlay;
|
||||
|
||||
public SongMenu() {
|
||||
super();
|
||||
optionsOverlay = new OptionsOverlay(OptionGroups.normalOptions);
|
||||
overlays.add(optionsOverlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -696,6 +690,8 @@ public class SongMenu extends ComplexOpsuState {
|
||||
backButton.draw(g);
|
||||
}
|
||||
|
||||
optionsOverlay.render(g);
|
||||
|
||||
UI.draw(g);
|
||||
|
||||
super.render(g);
|
||||
@@ -704,6 +700,8 @@ public class SongMenu extends ComplexOpsuState {
|
||||
@Override
|
||||
public void preRenderUpdate() {
|
||||
super.preRenderUpdate();
|
||||
|
||||
optionsOverlay.preRenderUpdate();
|
||||
|
||||
int delta = renderDelta;
|
||||
UI.update(delta);
|
||||
@@ -860,6 +858,10 @@ public class SongMenu extends ComplexOpsuState {
|
||||
if (super.mousePressed(button, x, y)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (optionsOverlay.mousePressed(button, x, y)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (button == Input.MOUSE_MIDDLE_BUTTON) {
|
||||
return false;
|
||||
@@ -879,6 +881,10 @@ public class SongMenu extends ComplexOpsuState {
|
||||
if (super.mouseReleased(button, x, y)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (optionsOverlay.mouseReleased(button, x, y)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (button == Input.MOUSE_MIDDLE_BUTTON) {
|
||||
return false;
|
||||
@@ -1025,6 +1031,10 @@ public class SongMenu extends ComplexOpsuState {
|
||||
if (super.keyPressed(key, c)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (optionsOverlay.keyPressed(key, c)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// block input
|
||||
if ((reloadThread != null && key != KEY_ESCAPE) || beatmapMenuTimer > -1 || isScrollingToFocusNode) {
|
||||
@@ -1179,6 +1189,10 @@ public class SongMenu extends ComplexOpsuState {
|
||||
if (super.mouseDragged(oldx, oldy, newx, newy)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (optionsOverlay.mouseDragged(oldx, oldy, newx, newy)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isInputBlocked()) {
|
||||
return true;
|
||||
@@ -1212,6 +1226,10 @@ public class SongMenu extends ComplexOpsuState {
|
||||
if (super.mouseWheelMoved(newValue)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (optionsOverlay.mouseWheelMoved(newValue)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isInputBlocked()) {
|
||||
return true;
|
||||
@@ -1229,6 +1247,15 @@ public class SongMenu extends ComplexOpsuState {
|
||||
changeIndex(shift);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyReleased(int key, char c) {
|
||||
if (super.keyReleased(key, c)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return optionsOverlay.keyReleased(key, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
Reference in New Issue
Block a user