strip Input handling

This commit is contained in:
yugecin
2017-05-27 00:37:02 +02:00
parent 42bc11ef75
commit a5efe7e649
18 changed files with 280 additions and 1160 deletions

View File

@@ -306,7 +306,7 @@ public class DownloadsMenu extends ComplexOpsuState {
// search
searchTimer = SEARCH_DELAY;
searchResultString = "Loading data from server...";
search = new TextField(displayContainer, Fonts.DEFAULT, baseX, searchY, searchWidth, Fonts.MEDIUM.getLineHeight()) {
search = new TextField(Fonts.DEFAULT, baseX, searchY, searchWidth, Fonts.MEDIUM.getLineHeight()) {
@Override
public boolean isFocusable() {
return false;

View File

@@ -1150,7 +1150,7 @@ public class Game extends ComplexOpsuState {
break;
case Input.KEY_R:
// restart
if (displayContainer.input.isKeyDown(Input.KEY_RCONTROL) || displayContainer.input.isKeyDown(Input.KEY_LCONTROL)) {
if (input.isKeyDown(Input.KEY_RCONTROL) || input.isKeyDown(Input.KEY_LCONTROL)) {
if (trackPosition < beatmap.objects[0].getTime()) {
retries--; // don't count this retry (cancel out later increment)
}
@@ -1161,7 +1161,7 @@ public class Game extends ComplexOpsuState {
break;
case Input.KEY_S:
// save checkpoint
if (displayContainer.input.isKeyDown(Input.KEY_RCONTROL) || displayContainer.input.isKeyDown(Input.KEY_LCONTROL)) {
if (input.isKeyDown(Input.KEY_RCONTROL) || input.isKeyDown(Input.KEY_LCONTROL)) {
if (isLeadIn()) {
break;
}
@@ -1177,7 +1177,7 @@ public class Game extends ComplexOpsuState {
break;
case Input.KEY_L:
// load checkpoint
if (displayContainer.input.isKeyDown(Input.KEY_RCONTROL) || displayContainer.input.isKeyDown(Input.KEY_LCONTROL)) {
if (input.isKeyDown(Input.KEY_RCONTROL) || input.isKeyDown(Input.KEY_LCONTROL)) {
int checkpoint = OPTION_CHECKPOINT.val * 1000;
if (checkpoint == 0 || checkpoint > beatmap.endTime)
break; // invalid checkpoint
@@ -1396,7 +1396,7 @@ public class Game extends ComplexOpsuState {
keys = ReplayFrame.KEY_K2;
}
if (keys != ReplayFrame.KEY_NONE) {
gameKeyReleased(keys, displayContainer.input.getMouseX(), displayContainer.input.getMouseY(), MusicController.getPosition());
gameKeyReleased(keys, input.getMouseX(), input.getMouseY(), MusicController.getPosition());
}
return true;

View File

@@ -109,7 +109,7 @@ public class GamePauseMenu extends BaseOpsuState {
return true;
}
if (key == Input.KEY_R && (displayContainer.input.isKeyDown(Input.KEY_RCONTROL) || displayContainer.input.isKeyDown(Input.KEY_LCONTROL))) {
if (key == Input.KEY_R && (input.isKeyDown(Input.KEY_RCONTROL) || input.isKeyDown(Input.KEY_LCONTROL))) {
gameState.setRestart(Game.Restart.MANUAL);
displayContainer.switchState(gameState);
return true;

View File

@@ -389,7 +389,7 @@ public class SongMenu extends ComplexOpsuState {
// search
int textFieldX = (int) (displayContainer.width * 0.7125f + Fonts.BOLD.getWidth("Search: "));
int textFieldY = (int) (headerY + Fonts.BOLD.getLineHeight() / 2);
searchTextField = new TextField(displayContainer, Fonts.BOLD, textFieldX, textFieldY, (int) (displayContainer.width * 0.99f) - textFieldX, Fonts.BOLD.getLineHeight()) {
searchTextField = new TextField(Fonts.BOLD, textFieldX, textFieldY, (int) (displayContainer.width * 0.99f) - textFieldX, Fonts.BOLD.getLineHeight()) {
@Override
public boolean isFocusable() {
return false;
@@ -1042,8 +1042,6 @@ public class SongMenu extends ComplexOpsuState {
return true;
}
Input input = displayContainer.input;
switch (key) {
case Input.KEY_ESCAPE:
if (reloadThread != null) {
@@ -1204,9 +1202,9 @@ public class SongMenu extends ComplexOpsuState {
// check mouse button (right click scrolls faster on songs)
int multiplier;
if (displayContainer.input.isMouseButtonDown(Input.MOUSE_RIGHT_BUTTON)) {
if (input.isMouseButtonDown(Input.MOUSE_RIGHT_BUTTON)) {
multiplier = 10;
} else if (displayContainer.input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON)) {
} else if (input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON)) {
multiplier = 1;
} else {
return false;
@@ -1226,8 +1224,6 @@ public class SongMenu extends ComplexOpsuState {
return true;
}
Input input = displayContainer.input;
if (isInputBlocked()) {
return true;
}
@@ -1768,7 +1764,7 @@ public class SongMenu extends ComplexOpsuState {
}
// turn on "auto" mod if holding "ctrl" key
if (displayContainer.input.isKeyDown(Input.KEY_RCONTROL) || displayContainer.input.isKeyDown(Input.KEY_LCONTROL)) {
if (input.isKeyDown(Input.KEY_RCONTROL) || input.isKeyDown(Input.KEY_LCONTROL)) {
if (!GameMod.AUTO.isActive())
GameMod.AUTO.toggle(true);
}