process common hotkeys in base state
This commit is contained in:
parent
81b71d5703
commit
06a5deb3a1
|
@ -395,8 +395,7 @@ public class Options {
|
|||
@Override
|
||||
public void clickListItem(int index) {
|
||||
targetFPSindex = index;
|
||||
Container.instance.setTargetFrameRate(targetFPS[index]);
|
||||
Container.instance.setVSync(targetFPS[index] == 60);
|
||||
displayContainer.setFPS(targetFPS[index]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -985,6 +984,7 @@ public class Options {
|
|||
PIPPI_SLIDER_FOLLOW_EXPAND ("Followcircle expand", "PippiFollowExpand", "Increase radius in followcircles", false),
|
||||
PIPPI_PREVENT_WOBBLY_STREAMS ("Prevent wobbly streams", "PippiPreventWobblyStreams", "Force linear mover while doing streams to prevent wobbly pippi", true);
|
||||
|
||||
public static DisplayContainer displayContainer;
|
||||
|
||||
/** Option name. */
|
||||
private final String name;
|
||||
|
@ -1283,9 +1283,9 @@ public class Options {
|
|||
* bar notification about the action.
|
||||
*/
|
||||
public static void setNextFPS(DisplayContainer displayContainer) {
|
||||
GameOption.displayContainer = displayContainer; // TODO dirty shit
|
||||
GameOption.TARGET_FPS.clickListItem((targetFPSindex + 1) % targetFPS.length);
|
||||
UI.sendBarNotification(String.format("Frame limiter: %s", GameOption.TARGET_FPS.getValueString()));
|
||||
displayContainer.setFPS(GameOption.TARGET_FPS.val);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -667,21 +667,15 @@ public class ButtonMenu extends BaseOpsuState {
|
|||
|
||||
@Override
|
||||
public boolean keyPressed(int key, char c) {
|
||||
switch (key) {
|
||||
case Input.KEY_ESCAPE:
|
||||
menuState.leave();
|
||||
return true;
|
||||
case Input.KEY_F7:
|
||||
// TODO
|
||||
//Options.setNextFPS(displayContainer);
|
||||
return true;
|
||||
case Input.KEY_F10:
|
||||
Options.toggleMouseDisabled();
|
||||
return true;
|
||||
case Input.KEY_F12:
|
||||
Utils.takeScreenShot();
|
||||
if (super.keyPressed(key, c)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (key == Input.KEY_ESCAPE) {
|
||||
menuState.leave();
|
||||
return true;
|
||||
}
|
||||
|
||||
menuState.keyPressed(key, c);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -893,7 +893,7 @@ public class DownloadsMenu extends ComplexOpsuState {
|
|||
}
|
||||
|
||||
// block input during beatmap importing
|
||||
if (importThread != null && !(key == Input.KEY_ESCAPE || key == Input.KEY_F12)) {
|
||||
if (importThread != null && key != Input.KEY_ESCAPE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -928,16 +928,6 @@ public class DownloadsMenu extends ComplexOpsuState {
|
|||
searchQuery.interrupt();
|
||||
resetSearchTimer();
|
||||
return true;
|
||||
case Input.KEY_F7:
|
||||
// TODO d
|
||||
//Options.setNextFPS(container);
|
||||
return true;
|
||||
case Input.KEY_F10:
|
||||
Options.toggleMouseDisabled();
|
||||
return true;
|
||||
case Input.KEY_F12:
|
||||
Utils.takeScreenShot();
|
||||
return true;
|
||||
}
|
||||
// wait for user to finish typing
|
||||
if (Character.isLetterOrDigit(c) || key == Input.KEY_BACK) {
|
||||
|
|
|
@ -634,6 +634,10 @@ public class MainMenu extends BaseOpsuState {
|
|||
|
||||
@Override
|
||||
public boolean keyPressed(int key, char c) {
|
||||
if (super.keyPressed(key, c)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (key) {
|
||||
case Input.KEY_ESCAPE:
|
||||
case Input.KEY_Q:
|
||||
|
@ -670,15 +674,6 @@ public class MainMenu extends BaseOpsuState {
|
|||
case Input.KEY_DOWN:
|
||||
UI.changeVolume(-1);
|
||||
return true;
|
||||
case Input.KEY_F7:
|
||||
Options.setNextFPS(displayContainer);
|
||||
return true;
|
||||
case Input.KEY_F10:
|
||||
Options.toggleMouseDisabled();
|
||||
return true;
|
||||
case Input.KEY_F12:
|
||||
Utils.takeScreenShot();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1064,8 +1064,12 @@ public class SongMenu extends BaseOpsuState {
|
|||
|
||||
@Override
|
||||
public boolean keyPressed(int key, char c) {
|
||||
if (super.keyPressed(key, c)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// block input
|
||||
if ((reloadThread != null && !(key == Input.KEY_ESCAPE || key == Input.KEY_F12)) || beatmapMenuTimer > -1 || isScrollingToFocusNode) {
|
||||
if ((reloadThread != null && key != Input.KEY_ESCAPE) || beatmapMenuTimer > -1 || isScrollingToFocusNode) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1145,16 +1149,6 @@ public class SongMenu extends BaseOpsuState {
|
|||
displayContainer.switchState(ButtonMenu.class);
|
||||
}
|
||||
return true;
|
||||
case Input.KEY_F7:
|
||||
// TODO d
|
||||
//Options.setNextFPS(container);
|
||||
return true;
|
||||
case Input.KEY_F10:
|
||||
Options.toggleMouseDisabled();
|
||||
return true;
|
||||
case Input.KEY_F12:
|
||||
Utils.takeScreenShot();
|
||||
return true;
|
||||
case Input.KEY_ENTER:
|
||||
if (focusNode == null)
|
||||
break;
|
||||
|
|
|
@ -17,7 +17,10 @@
|
|||
*/
|
||||
package yugecin.opsudance.core.state;
|
||||
|
||||
import itdelatrisu.opsu.Options;
|
||||
import itdelatrisu.opsu.Utils;
|
||||
import org.newdawn.slick.Graphics;
|
||||
import org.newdawn.slick.Input;
|
||||
import yugecin.opsudance.core.DisplayContainer;
|
||||
import yugecin.opsudance.core.events.EventListener;
|
||||
import yugecin.opsudance.events.ResolutionChangedEvent;
|
||||
|
@ -89,6 +92,18 @@ public abstract class BaseOpsuState implements OpsuState, EventListener<Resoluti
|
|||
|
||||
@Override
|
||||
public boolean keyReleased(int key, char c) {
|
||||
if (key == Input.KEY_F7) {
|
||||
Options.setNextFPS(displayContainer);
|
||||
return true;
|
||||
}
|
||||
if (key == Input.KEY_F10) {
|
||||
Options.toggleMouseDisabled();
|
||||
return true;
|
||||
}
|
||||
if (key == Input.KEY_F12) {
|
||||
Utils.takeScreenShot();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,6 +95,9 @@ public class ComplexOpsuState extends BaseOpsuState {
|
|||
|
||||
@Override
|
||||
public boolean keyReleased(int key, char c) {
|
||||
if (super.keyReleased(key, c)) {
|
||||
return true;
|
||||
}
|
||||
if (focusedComponent != null) {
|
||||
if (key == Input.KEY_ESCAPE) {
|
||||
focusedComponent.setFocused(false);
|
||||
|
|
Loading…
Reference in New Issue
Block a user