remove delegating stuff from Input

This commit is contained in:
yugecin
2017-05-27 02:10:32 +02:00
parent 08f5bfc27f
commit 9b5dc4c121
18 changed files with 129 additions and 266 deletions

View File

@@ -31,6 +31,7 @@ import itdelatrisu.opsu.ui.Cursor;
import itdelatrisu.opsu.ui.Fonts;
import itdelatrisu.opsu.ui.UI;
import org.lwjgl.Sys;
import org.lwjgl.input.Mouse;
import org.lwjgl.openal.AL;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
@@ -262,7 +263,8 @@ public class DisplayContainer implements ErrorDumpable, ResolutionChangedListene
cursor.updateAngle(renderDelta);
if (drawCursor) {
cursor.draw(input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON) || input.isMouseButtonDown(Input.MOUSE_RIGHT_BUTTON));
cursor.draw(Mouse.isButtonDown(Input.MOUSE_LEFT_BUTTON) ||
Mouse.isButtonDown(Input.MOUSE_RIGHT_BUTTON));
}
UI.drawTooltip(graphics);

View File

@@ -23,6 +23,7 @@ import org.newdawn.slick.Input;
import org.newdawn.slick.InputListener;
import yugecin.opsudance.events.BarNotifListener;
import static org.lwjgl.input.Keyboard.*;
import static yugecin.opsudance.core.InstanceContainer.*;
import static yugecin.opsudance.options.Options.*;
@@ -35,22 +36,22 @@ public class GlobalInputListener implements InputListener {
@Override
public boolean keyReleased(int key, char c) {
if (key == Input.KEY_F7) {
if (key == KEY_F7) {
OPTION_TARGET_FPS.clickListItem((targetFPSIndex + 1) % targetFPS.length);
BarNotifListener.EVENT.make().onBarNotif(String.format("Frame limiter: %s",
OPTION_TARGET_FPS.getValueString()));
return true;
}
if (key == Input.KEY_F10) {
if (key == KEY_F10) {
OPTION_DISABLE_MOUSE_BUTTONS.toggle();
return true;
}
if (key == Input.KEY_F12) {
if (key == KEY_F12) {
config.takeScreenShot();
return true;
}
if (key == Input.KEY_S && input.isKeyDown(Input.KEY_LMENU) && input.isKeyDown(Input.KEY_LSHIFT) &&
input.isKeyDown(Input.KEY_LCONTROL) && !displayContainer.isInState(Game.class)) {
if (key == KEY_S && isKeyDown(KEY_LMENU) && isKeyDown(KEY_LSHIFT) &&
input.isControlDown() && !displayContainer.isInState(Game.class)) {
skinservice.reloadSkin();
}
return false;
@@ -58,7 +59,7 @@ public class GlobalInputListener implements InputListener {
@Override
public boolean mouseWheelMoved(int delta) {
if (input.isKeyDown(Input.KEY_LALT) || input.isKeyDown(Input.KEY_RALT)) {
if (isKeyDown(Input.KEY_LALT) || isKeyDown(Input.KEY_RALT)) {
UI.changeVolume((delta < 0) ? -1 : 1);
return true;
}

View File

@@ -17,8 +17,8 @@
*/
package yugecin.opsudance.core.state;
import org.lwjgl.input.Keyboard;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input;
import yugecin.opsudance.core.components.Component;
import java.util.LinkedList;
@@ -165,7 +165,7 @@ public abstract class ComplexOpsuState extends BaseOpsuState {
}
}
if (focusedComponent != null) {
if (key == Input.KEY_ESCAPE) {
if (key == Keyboard.KEY_ESCAPE) {
focusedComponent.setFocused(false);
focusedComponent = null;
return true;
@@ -184,7 +184,7 @@ public abstract class ComplexOpsuState extends BaseOpsuState {
}
}
if (focusedComponent != null) {
if (key == Input.KEY_ESCAPE) {
if (key == Keyboard.KEY_ESCAPE) {
focusedComponent.setFocused(false);
focusedComponent = null;
return true;

View File

@@ -393,7 +393,7 @@ public class Options {
};
public static final ToggleOption OPTION_DISABLE_SOUNDS = new ToggleOption("Disable All Sound Effects", "DisableSound", "May resolve Linux sound driver issues. Requires a restart.", (System.getProperty("os.name").toLowerCase().contains("linux")));
public static final GenericOption OPTION_KEY_LEFT = new GenericOption("Left Game Key", "keyOsuLeft", "Select this option to input a key.", Input.KEY_Z, null, false) {
public static final GenericOption OPTION_KEY_LEFT = new GenericOption("Left Game Key", "keyOsuLeft", "Select this option to input a key.", Keyboard.KEY_Z, null, false) {
@Override
public String getValueString () {
return Keyboard.getKeyName(intval);
@@ -408,12 +408,12 @@ public class Options {
public void read(String s){
intval = Keyboard.getKeyIndex(s);
if (intval == Keyboard.KEY_NONE) {
intval = Input.KEY_Y;
intval = Keyboard.KEY_Y;
}
}
};
public static final GenericOption OPTION_KEY_RIGHT = new GenericOption("Right Game Key", "keyOsuRight", "Select this option to input a key.", Input.KEY_X, null, false) {
public static final GenericOption OPTION_KEY_RIGHT = new GenericOption("Right Game Key", "keyOsuRight", "Select this option to input a key.", Keyboard.KEY_X, null, false) {
@Override
public String getValueString () {
return Keyboard.getKeyName(intval);
@@ -428,7 +428,7 @@ public class Options {
public void read(String s){
intval = Keyboard.getKeyIndex(s);
if (intval == Keyboard.KEY_NONE) {
intval = Input.KEY_X;
intval = Keyboard.KEY_X;
}
}
};

View File

@@ -23,6 +23,7 @@ import itdelatrisu.opsu.audio.SoundController;
import itdelatrisu.opsu.audio.SoundEffect;
import itdelatrisu.opsu.ui.*;
import itdelatrisu.opsu.ui.animations.AnimationEquation;
import org.lwjgl.input.Keyboard;
import org.newdawn.slick.*;
import org.newdawn.slick.gui.TextField;
import yugecin.opsudance.core.DisplayContainer;
@@ -738,7 +739,7 @@ public class OptionsOverlay extends OverlayOpsuState {
return true;
}
if (key == Input.KEY_ESCAPE) {
if (key == Keyboard.KEY_ESCAPE) {
if (openDropdownMenu != null) {
openDropdownMenu.keyPressed(key, c);
return true;

View File

@@ -25,7 +25,6 @@ import yugecin.opsudance.options.OptionGroups;
import itdelatrisu.opsu.ui.Fonts;
import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input;
import yugecin.opsudance.ObjectColorOverrides;
import yugecin.opsudance.core.DisplayContainer;
import yugecin.opsudance.core.state.OverlayOpsuState;
@@ -34,6 +33,7 @@ import yugecin.opsudance.sbv2.MoveStoryboard;
import java.util.*;
import static org.lwjgl.input.Keyboard.*;
import static yugecin.opsudance.options.Options.*;
@SuppressWarnings("unchecked")
@@ -108,7 +108,7 @@ public class StoryboardOverlay extends OverlayOpsuState implements OptionsOverla
@Override
public boolean onKeyPressed(int key, char c) {
if (key == Input.KEY_C) {
if (key == KEY_C) {
if (speed > 0) {
speed -= 1;
}
@@ -117,24 +117,24 @@ public class StoryboardOverlay extends OverlayOpsuState implements OptionsOverla
} else {
MusicController.setPitch(speed / 10f);
}
} else if (key == Input.KEY_V && speed < 21) {
} else if (key == KEY_V && speed < 21) {
if (speed == 0) {
MusicController.resume();
}
speed += 1;
MusicController.setPitch(speed / 10f);
} else if (key == Input.KEY_H) {
} else if (key == KEY_H) {
hide = !hide;
} else if (key == Input.KEY_N) {
} else if (key == KEY_N) {
optionsOverlay.show();
if (speed != 0) {
MusicController.pause();
}
} else if (key == Input.KEY_J && index > 0) {
} else if (key == KEY_J && index > 0) {
index--;
goBackOneSBIndex();
setMusicPosition();
} else if (key == Input.KEY_K && index < gameObjects.length - 1) {
} else if (key == KEY_K && index < gameObjects.length - 1) {
index++;
updateIndex(index);
setMusicPosition();