remove options as overlay state
This commit is contained in:
parent
5b129c10dd
commit
d7e59531ea
|
@ -712,6 +712,10 @@ public class Game extends ComplexOpsuState {
|
||||||
} else {
|
} else {
|
||||||
displayContainer.cursor.draw(Utils.isGameKeyPressed());
|
displayContainer.cursor.draw(Utils.isGameKeyPressed());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (OPTION_DANCE_ENABLE_SB.state) {
|
||||||
|
optionsOverlay.render(g);
|
||||||
|
}
|
||||||
|
|
||||||
UI.draw(g);
|
UI.draw(g);
|
||||||
|
|
||||||
|
@ -721,6 +725,10 @@ public class Game extends ComplexOpsuState {
|
||||||
@Override
|
@Override
|
||||||
public void preRenderUpdate() {
|
public void preRenderUpdate() {
|
||||||
super.preRenderUpdate();
|
super.preRenderUpdate();
|
||||||
|
|
||||||
|
if (OPTION_DANCE_ENABLE_SB.state) {
|
||||||
|
optionsOverlay.preRenderUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
int delta = renderDelta;
|
int delta = renderDelta;
|
||||||
|
|
||||||
|
@ -1098,6 +1106,10 @@ public class Game extends ComplexOpsuState {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (OPTION_DANCE_ENABLE_SB.state && optionsOverlay.keyPressed(key, c)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (gameFinished) {
|
if (gameFinished) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1233,7 +1245,8 @@ public class Game extends ComplexOpsuState {
|
||||||
if (super.mouseDragged(oldx, oldy, newx, newy)) {
|
if (super.mouseDragged(oldx, oldy, newx, newy)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return OPTION_DANCE_ENABLE_SB.state &&
|
||||||
|
optionsOverlay.mouseDragged(oldx, oldy, newx, newy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1241,6 +1254,10 @@ public class Game extends ComplexOpsuState {
|
||||||
if (super.mousePressed(button, x, y)) {
|
if (super.mousePressed(button, x, y)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (OPTION_DANCE_ENABLE_SB.state && optionsOverlay.mousePressed(button, x, y)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (gameFinished) {
|
if (gameFinished) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1347,6 +1364,10 @@ public class Game extends ComplexOpsuState {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (OPTION_DANCE_ENABLE_SB.state && optionsOverlay.mouseReleased(button, x, y)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (gameFinished) {
|
if (gameFinished) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1375,6 +1396,10 @@ public class Game extends ComplexOpsuState {
|
||||||
if (super.keyReleased(key, c)) {
|
if (super.keyReleased(key, c)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (OPTION_DANCE_ENABLE_SB.state && optionsOverlay.keyReleased(key, c)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (gameFinished) {
|
if (gameFinished) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1412,6 +1437,10 @@ public class Game extends ComplexOpsuState {
|
||||||
if (super.mouseWheelMoved(newValue)) {
|
if (super.mouseWheelMoved(newValue)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (OPTION_DANCE_ENABLE_SB.state && optionsOverlay.mouseWheelMoved(newValue)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (OPTION_DISABLE_MOUSE_WHEEL.state) {
|
if (OPTION_DISABLE_MOUSE_WHEEL.state) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1425,11 +1454,9 @@ public class Game extends ComplexOpsuState {
|
||||||
public void enter() {
|
public void enter() {
|
||||||
overlays.clear();
|
overlays.clear();
|
||||||
if (OPTION_DANCE_ENABLE_SB.state) {
|
if (OPTION_DANCE_ENABLE_SB.state) {
|
||||||
overlays.add(optionsOverlay);
|
|
||||||
overlays.add(moveStoryboardOverlay);
|
overlays.add(moveStoryboardOverlay);
|
||||||
overlays.add(storyboardOverlay);
|
overlays.add(storyboardOverlay);
|
||||||
storyboardOverlay.onEnter();
|
storyboardOverlay.onEnter();
|
||||||
optionsOverlay.revalidate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
super.enter();
|
super.enter();
|
||||||
|
@ -1691,6 +1718,8 @@ public class Game extends ComplexOpsuState {
|
||||||
if (OPTION_DANCE_ENABLE_SB.state) {
|
if (OPTION_DANCE_ENABLE_SB.state) {
|
||||||
storyboardOverlay.onLeave();
|
storyboardOverlay.onLeave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
optionsOverlay.hide();
|
||||||
|
|
||||||
isInGame = false;
|
isInGame = false;
|
||||||
// container.setMouseGrabbed(false);
|
// container.setMouseGrabbed(false);
|
||||||
|
|
|
@ -469,11 +469,18 @@ public class MainMenu extends BaseOpsuState {
|
||||||
);
|
);
|
||||||
g.drawString(txt, textMarginX, textTopMarginY + textLineHeight * 2);
|
g.drawString(txt, textMarginX, textTopMarginY + textLineHeight * 2);
|
||||||
|
|
||||||
|
optionsOverlay.render(g);
|
||||||
|
if (optionsOverlay.isActive()) {
|
||||||
|
backButton.draw(g);
|
||||||
|
}
|
||||||
|
|
||||||
UI.draw(g);
|
UI.draw(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preRenderUpdate() {
|
public void preRenderUpdate() {
|
||||||
|
optionsOverlay.preRenderUpdate();
|
||||||
|
|
||||||
int delta = renderDelta;
|
int delta = renderDelta;
|
||||||
|
|
||||||
final Iterator<PulseData> pulseDataIter = this.pulseData.iterator();
|
final Iterator<PulseData> pulseDataIter = this.pulseData.iterator();
|
||||||
|
@ -667,6 +674,10 @@ public class MainMenu extends BaseOpsuState {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mousePressed(int button, int x, int y) {
|
public boolean mousePressed(int button, int x, int y) {
|
||||||
|
if (optionsOverlay.mousePressed(button, x, y)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// check mouse button
|
// check mouse button
|
||||||
if (button == Input.MOUSE_MIDDLE_BUTTON)
|
if (button == Input.MOUSE_MIDDLE_BUTTON)
|
||||||
return false;
|
return false;
|
||||||
|
@ -787,6 +798,12 @@ public class MainMenu extends BaseOpsuState {
|
||||||
return true;
|
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)) {
|
if (this.buttonPositions[2].contains(x, y, 0.25f)) {
|
||||||
displayContainer.exitRequested = true;
|
displayContainer.exitRequested = true;
|
||||||
return true;
|
return true;
|
||||||
|
@ -798,7 +815,7 @@ public class MainMenu extends BaseOpsuState {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseWheelMoved(int newValue) {
|
public boolean mouseWheelMoved(int newValue) {
|
||||||
if (super.mouseWheelMoved(newValue)) {
|
if (optionsOverlay.mouseWheelMoved(newValue)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -808,7 +825,7 @@ public class MainMenu extends BaseOpsuState {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean keyPressed(int key, char c) {
|
public boolean keyPressed(int key, char c) {
|
||||||
if (super.keyPressed(key, c)) {
|
if (optionsOverlay.keyPressed(key, c)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -843,9 +860,28 @@ public class MainMenu extends BaseOpsuState {
|
||||||
case KEY_DOWN:
|
case KEY_DOWN:
|
||||||
UI.changeVolume(-1);
|
UI.changeVolume(-1);
|
||||||
return true;
|
return true;
|
||||||
|
case KEY_O:
|
||||||
|
if (input.isControlDown()) {
|
||||||
|
optionsOverlay.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
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.
|
* 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.
|
* Enters the song menu, or the downloads menu if no beatmaps are loaded.
|
||||||
*/
|
*/
|
||||||
private void enterSongMenu() {
|
private void enterSongMenu() {
|
||||||
|
if (optionsOverlay.isActive()) {
|
||||||
|
optionsOverlay.hide();
|
||||||
|
}
|
||||||
OpsuState state = songMenuState;
|
OpsuState state = songMenuState;
|
||||||
if (BeatmapSetList.get().getMapSetCount() == 0) {
|
if (BeatmapSetList.get().getMapSetCount() == 0) {
|
||||||
barNotifs.send("Download some beatmaps to get started!");
|
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.SpriteSheet;
|
||||||
import org.newdawn.slick.gui.TextField;
|
import org.newdawn.slick.gui.TextField;
|
||||||
import yugecin.opsudance.core.state.ComplexOpsuState;
|
import yugecin.opsudance.core.state.ComplexOpsuState;
|
||||||
import yugecin.opsudance.options.OptionGroups;
|
|
||||||
import yugecin.opsudance.ui.OptionsOverlay;
|
|
||||||
|
|
||||||
import static org.lwjgl.input.Keyboard.*;
|
import static org.lwjgl.input.Keyboard.*;
|
||||||
import static yugecin.opsudance.core.InstanceContainer.*;
|
import static yugecin.opsudance.core.InstanceContainer.*;
|
||||||
|
@ -310,12 +308,8 @@ public class SongMenu extends ComplexOpsuState {
|
||||||
/** Sort order dropdown menu. */
|
/** Sort order dropdown menu. */
|
||||||
private DropdownMenu<BeatmapSortOrder> sortMenu;
|
private DropdownMenu<BeatmapSortOrder> sortMenu;
|
||||||
|
|
||||||
private final OptionsOverlay optionsOverlay;
|
|
||||||
|
|
||||||
public SongMenu() {
|
public SongMenu() {
|
||||||
super();
|
super();
|
||||||
optionsOverlay = new OptionsOverlay(OptionGroups.normalOptions);
|
|
||||||
overlays.add(optionsOverlay);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -696,6 +690,8 @@ public class SongMenu extends ComplexOpsuState {
|
||||||
backButton.draw(g);
|
backButton.draw(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
optionsOverlay.render(g);
|
||||||
|
|
||||||
UI.draw(g);
|
UI.draw(g);
|
||||||
|
|
||||||
super.render(g);
|
super.render(g);
|
||||||
|
@ -704,6 +700,8 @@ public class SongMenu extends ComplexOpsuState {
|
||||||
@Override
|
@Override
|
||||||
public void preRenderUpdate() {
|
public void preRenderUpdate() {
|
||||||
super.preRenderUpdate();
|
super.preRenderUpdate();
|
||||||
|
|
||||||
|
optionsOverlay.preRenderUpdate();
|
||||||
|
|
||||||
int delta = renderDelta;
|
int delta = renderDelta;
|
||||||
UI.update(delta);
|
UI.update(delta);
|
||||||
|
@ -860,6 +858,10 @@ public class SongMenu extends ComplexOpsuState {
|
||||||
if (super.mousePressed(button, x, y)) {
|
if (super.mousePressed(button, x, y)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (optionsOverlay.mousePressed(button, x, y)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (button == Input.MOUSE_MIDDLE_BUTTON) {
|
if (button == Input.MOUSE_MIDDLE_BUTTON) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -879,6 +881,10 @@ public class SongMenu extends ComplexOpsuState {
|
||||||
if (super.mouseReleased(button, x, y)) {
|
if (super.mouseReleased(button, x, y)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (optionsOverlay.mouseReleased(button, x, y)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (button == Input.MOUSE_MIDDLE_BUTTON) {
|
if (button == Input.MOUSE_MIDDLE_BUTTON) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1025,6 +1031,10 @@ public class SongMenu extends ComplexOpsuState {
|
||||||
if (super.keyPressed(key, c)) {
|
if (super.keyPressed(key, c)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (optionsOverlay.keyPressed(key, c)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// block input
|
// block input
|
||||||
if ((reloadThread != null && key != KEY_ESCAPE) || beatmapMenuTimer > -1 || isScrollingToFocusNode) {
|
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)) {
|
if (super.mouseDragged(oldx, oldy, newx, newy)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (optionsOverlay.mouseDragged(oldx, oldy, newx, newy)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (isInputBlocked()) {
|
if (isInputBlocked()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1212,6 +1226,10 @@ public class SongMenu extends ComplexOpsuState {
|
||||||
if (super.mouseWheelMoved(newValue)) {
|
if (super.mouseWheelMoved(newValue)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (optionsOverlay.mouseWheelMoved(newValue)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (isInputBlocked()) {
|
if (isInputBlocked()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1229,6 +1247,15 @@ public class SongMenu extends ComplexOpsuState {
|
||||||
changeIndex(shift);
|
changeIndex(shift);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean keyReleased(int key, char c) {
|
||||||
|
if (super.keyReleased(key, c)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return optionsOverlay.keyReleased(key, c);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
|
|
|
@ -31,10 +31,12 @@ import yugecin.opsudance.core.state.specialstates.BarNotificationState;
|
||||||
import yugecin.opsudance.core.state.specialstates.BubNotifState;
|
import yugecin.opsudance.core.state.specialstates.BubNotifState;
|
||||||
import yugecin.opsudance.core.state.specialstates.FpsRenderState;
|
import yugecin.opsudance.core.state.specialstates.FpsRenderState;
|
||||||
import yugecin.opsudance.options.Configuration;
|
import yugecin.opsudance.options.Configuration;
|
||||||
|
import yugecin.opsudance.options.OptionGroups;
|
||||||
import yugecin.opsudance.options.OptionsService;
|
import yugecin.opsudance.options.OptionsService;
|
||||||
import yugecin.opsudance.render.GameObjectRenderer;
|
import yugecin.opsudance.render.GameObjectRenderer;
|
||||||
import yugecin.opsudance.skinning.SkinService;
|
import yugecin.opsudance.skinning.SkinService;
|
||||||
import yugecin.opsudance.ui.BackButton;
|
import yugecin.opsudance.ui.BackButton;
|
||||||
|
import yugecin.opsudance.ui.OptionsOverlay;
|
||||||
import yugecin.opsudance.utils.ManifestWrapper;
|
import yugecin.opsudance.utils.ManifestWrapper;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -65,6 +67,8 @@ public class InstanceContainer {
|
||||||
public static BarNotificationState barNotifs;
|
public static BarNotificationState barNotifs;
|
||||||
public static BubNotifState bubNotifs;
|
public static BubNotifState bubNotifs;
|
||||||
public static FpsRenderState fpsDisplay;
|
public static FpsRenderState fpsDisplay;
|
||||||
|
|
||||||
|
public static OptionsOverlay optionsOverlay;
|
||||||
|
|
||||||
public static Splash splashState;
|
public static Splash splashState;
|
||||||
public static MainMenu mainmenuState;
|
public static MainMenu mainmenuState;
|
||||||
|
@ -115,6 +119,8 @@ public class InstanceContainer {
|
||||||
|
|
||||||
gameObjectRenderer = new GameObjectRenderer();
|
gameObjectRenderer = new GameObjectRenderer();
|
||||||
|
|
||||||
|
optionsOverlay = new OptionsOverlay(OptionGroups.normalOptions);
|
||||||
|
|
||||||
splashState = new Splash();
|
splashState = new Splash();
|
||||||
mainmenuState = new MainMenu();
|
mainmenuState = new MainMenu();
|
||||||
buttonState = new ButtonMenu();
|
buttonState = new ButtonMenu();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* opsu!dance - fork of opsu! with cursordance auto
|
* opsu!dance - fork of opsu! with cursordance auto
|
||||||
* Copyright (C) 2017 yugecin
|
* Copyright (C) 2017-2018 yugecin
|
||||||
*
|
*
|
||||||
* opsu!dance is free software: you can redistribute it and/or modify
|
* opsu!dance is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -33,6 +33,10 @@ public abstract class OverlayOpsuState implements OpsuState {
|
||||||
public void show() {
|
public void show() {
|
||||||
acceptInput = active = true;
|
acceptInput = active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isActive() {
|
||||||
|
return this.active;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void update() {
|
public final void update() {
|
||||||
|
|
|
@ -26,7 +26,7 @@ import itdelatrisu.opsu.ui.animations.AnimationEquation;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
import org.newdawn.slick.*;
|
import org.newdawn.slick.*;
|
||||||
import org.newdawn.slick.gui.TextField;
|
import org.newdawn.slick.gui.TextField;
|
||||||
import yugecin.opsudance.core.state.OverlayOpsuState;
|
import yugecin.opsudance.events.ResolutionChangedListener;
|
||||||
import yugecin.opsudance.options.*;
|
import yugecin.opsudance.options.*;
|
||||||
import yugecin.opsudance.utils.FontUtil;
|
import yugecin.opsudance.utils.FontUtil;
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ import java.util.Random;
|
||||||
import static yugecin.opsudance.core.InstanceContainer.*;
|
import static yugecin.opsudance.core.InstanceContainer.*;
|
||||||
import static yugecin.opsudance.options.Options.*;
|
import static yugecin.opsudance.options.Options.*;
|
||||||
|
|
||||||
public class OptionsOverlay extends OverlayOpsuState {
|
public class OptionsOverlay implements ResolutionChangedListener {
|
||||||
|
|
||||||
private static final float BG_ALPHA = 0.7f;
|
private static final float BG_ALPHA = 0.7f;
|
||||||
private static final float LINEALPHA = 0.8f;
|
private static final float LINEALPHA = 0.8f;
|
||||||
|
@ -58,6 +58,9 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||||
private static final float INDICATOR_ALPHA = 0.8f;
|
private static final float INDICATOR_ALPHA = 0.8f;
|
||||||
private static final Color COL_INDICATOR = new Color(Color.black);
|
private static final Color COL_INDICATOR = new Color(Color.black);
|
||||||
|
|
||||||
|
private boolean active;
|
||||||
|
private boolean acceptInput;
|
||||||
|
private boolean dirty;
|
||||||
|
|
||||||
/** Duration, in ms, of the show (slide-in) animation. */
|
/** Duration, in ms, of the show (slide-in) animation. */
|
||||||
private static final int SHOWANIMATIONTIME = 1000;
|
private static final int SHOWANIMATIONTIME = 1000;
|
||||||
|
@ -160,6 +163,7 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||||
|
|
||||||
public OptionsOverlay(OptionTab[] sections) {
|
public OptionsOverlay(OptionTab[] sections) {
|
||||||
this.sections = sections;
|
this.sections = sections;
|
||||||
|
this.dirty = true;
|
||||||
|
|
||||||
dropdownMenus = new HashMap<>();
|
dropdownMenus = new HashMap<>();
|
||||||
visibleDropdownMenus = new LinkedList<>();
|
visibleDropdownMenus = new LinkedList<>();
|
||||||
|
@ -169,15 +173,28 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||||
|
|
||||||
scrollHandler = new KineticScrolling();
|
scrollHandler = new KineticScrolling();
|
||||||
scrollHandler.setAllowOverScroll(true);
|
scrollHandler.setAllowOverScroll(true);
|
||||||
|
|
||||||
|
displayContainer.addResolutionChangedListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResolutionChanged(int w, int h) {
|
||||||
|
this.dirty = true;
|
||||||
|
if (this.active) {
|
||||||
|
this.revalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isActive() {
|
||||||
|
return this.active;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setListener(Listener listener) {
|
public void setListener(Listener listener) {
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void revalidate() {
|
public void revalidate() {
|
||||||
super.revalidate();
|
this.dirty = false;
|
||||||
|
|
||||||
boolean isWidescreen = displayContainer.isWidescreen();
|
boolean isWidescreen = displayContainer.isWidescreen();
|
||||||
targetWidth = (int) (width * (isWidescreen ? 0.4f : 0.5f));
|
targetWidth = (int) (width * (isWidescreen ? 0.4f : 0.5f));
|
||||||
|
@ -259,8 +276,11 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||||
searchImg = GameImage.SEARCH.getImage().getScaledCopy(searchImgSize, searchImgSize);
|
searchImg = GameImage.SEARCH.getImage().getScaledCopy(searchImgSize, searchImgSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void render(Graphics g) {
|
||||||
public void onRender(Graphics g) {
|
if (!this.active && this.currentWidth == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
g.setClip(navButtonSize, 0, currentWidth - navButtonSize, height);
|
g.setClip(navButtonSize, 0, currentWidth - navButtonSize, height);
|
||||||
|
|
||||||
// bg
|
// bg
|
||||||
|
@ -290,9 +310,6 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||||
|
|
||||||
renderNavigation(g);
|
renderNavigation(g);
|
||||||
|
|
||||||
// UI
|
|
||||||
backButton.draw(g);
|
|
||||||
|
|
||||||
// tooltip
|
// tooltip
|
||||||
renderTooltip(g);
|
renderTooltip(g);
|
||||||
|
|
||||||
|
@ -605,30 +622,35 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||||
g.resetTransform();
|
g.resetTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void hide() {
|
public void hide() {
|
||||||
|
if (!this.active) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
acceptInput = active = false;
|
||||||
searchField.setFocused(false);
|
searchField.setFocused(false);
|
||||||
acceptInput = false;
|
|
||||||
SoundController.playSound(SoundEffect.MENUBACK);
|
|
||||||
hideAnimationTime = animationtime;
|
hideAnimationTime = animationtime;
|
||||||
hideAnimationStartProgress = (float) animationtime / SHOWANIMATIONTIME;
|
hideAnimationStartProgress = (float) animationtime / SHOWANIMATIONTIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void show() {
|
public void show() {
|
||||||
navHoverTime = 0;
|
navHoverTime = 0;
|
||||||
indicatorPos = -optionHeight;
|
indicatorPos = -optionHeight;
|
||||||
indicatorOffsetToNextPos = 0;
|
indicatorOffsetToNextPos = 0;
|
||||||
indicatorMoveAnimationTime = 0;
|
indicatorMoveAnimationTime = 0;
|
||||||
indicatorHideAnimationTime = 0;
|
indicatorHideAnimationTime = 0;
|
||||||
acceptInput = true;
|
acceptInput = active = true;
|
||||||
active = true;
|
|
||||||
animationtime = 0;
|
animationtime = 0;
|
||||||
resetSearch();
|
resetSearch();
|
||||||
|
if (this.dirty) {
|
||||||
|
this.revalidate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void preRenderUpdate() {
|
||||||
public void onPreRenderUpdate() {
|
if (!this.active && this.currentWidth == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int delta = renderDelta;
|
int delta = renderDelta;
|
||||||
|
|
||||||
int prevscrollpos = scrollHandler.getIntPosition();
|
int prevscrollpos = scrollHandler.getIntPosition();
|
||||||
|
@ -767,8 +789,11 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||||
COL_COMBOBOX_HOVER.a = showHideProgress;
|
COL_COMBOBOX_HOVER.a = showHideProgress;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public boolean mousePressed(int button, int x, int y) {
|
||||||
public boolean onMousePressed(int button, int x, int y) {
|
if (!this.active) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (keyEntryLeft || keyEntryRight) {
|
if (keyEntryLeft || keyEntryRight) {
|
||||||
keyEntryLeft = keyEntryRight = false;
|
keyEntryLeft = keyEntryRight = false;
|
||||||
return true;
|
return true;
|
||||||
|
@ -793,8 +818,11 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public boolean mouseReleased(int button, int x, int y) {
|
||||||
public boolean onMouseReleased(int button, int x, int y) {
|
if (!this.active) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
selectedOption = null;
|
selectedOption = null;
|
||||||
if (isAdjustingSlider && listener != null) {
|
if (isAdjustingSlider && listener != null) {
|
||||||
listener.onSaveOption(hoverOption);
|
listener.onSaveOption(hoverOption);
|
||||||
|
@ -867,6 +895,7 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (backButton.contains(x, y)){
|
if (backButton.contains(x, y)){
|
||||||
|
SoundController.playSound(SoundEffect.MENUBACK);
|
||||||
hide();
|
hide();
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.onLeaveOptionsMenu();
|
listener.onLeaveOptionsMenu();
|
||||||
|
@ -875,8 +904,11 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public boolean mouseDragged(int oldx, int oldy, int newx, int newy) {
|
||||||
public boolean onMouseDragged(int oldx, int oldy, int newx, int newy) {
|
if (!this.active) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!isAdjustingSlider) {
|
if (!isAdjustingSlider) {
|
||||||
int diff = newy - oldy;
|
int diff = newy - oldy;
|
||||||
if (diff != 0) {
|
if (diff != 0) {
|
||||||
|
@ -886,16 +918,22 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public boolean mouseWheelMoved(int delta) {
|
||||||
public boolean onMouseWheelMoved(int delta) {
|
if (!this.active) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!isAdjustingSlider) {
|
if (!isAdjustingSlider) {
|
||||||
scrollHandler.scrollOffset(-delta);
|
scrollHandler.scrollOffset(-delta);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public boolean keyPressed(int key, char c) {
|
||||||
public boolean onKeyPressed(int key, char c) {
|
if (!this.active) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (keyEntryRight) {
|
if (keyEntryRight) {
|
||||||
if (Utils.isValidGameKey(key)) {
|
if (Utils.isValidGameKey(key)) {
|
||||||
OPTION_KEY_RIGHT.intval = key;
|
OPTION_KEY_RIGHT.intval = key;
|
||||||
|
@ -922,6 +960,7 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||||
updateHoverOption(prevMouseX, prevMouseY);
|
updateHoverOption(prevMouseX, prevMouseY);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
SoundController.playSound(SoundEffect.MENUBACK);
|
||||||
hide();
|
hide();
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.onLeaveOptionsMenu();
|
listener.onLeaveOptionsMenu();
|
||||||
|
@ -953,8 +992,7 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public boolean keyReleased(int key, char c) {
|
||||||
public boolean onKeyReleased(int key, char c) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user