Added configurable game key bindings.
- Game keys (default Z/X) can be changed to any letter or digit in the options screen.
Other changes:
- Mouse/keyboard input in the "Game Paused Menu" state is now the same as in the game state (i.e. all game keys available).
- Moved 'isInputKeyPressed()' into "Utils" class ("Game" state didn't even call it).
- Trimmed 'failsound.wav'.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
|
||||
package itdelatrisu.opsu;
|
||||
|
||||
import itdelatrisu.opsu.states.Game;
|
||||
import itdelatrisu.opsu.states.Options;
|
||||
|
||||
import java.awt.Font;
|
||||
@@ -322,12 +321,10 @@ public class Utils {
|
||||
cursorTrail.drawCentered(x, y);
|
||||
|
||||
// increase the cursor size if pressed
|
||||
int state = game.getCurrentStateID();
|
||||
float scale = 1f;
|
||||
if (game.getCurrentStateID() == Opsu.STATE_GAME &&
|
||||
((Game) game.getState(Opsu.STATE_GAME)).isInputKeyPressed())
|
||||
scale = 1.25f;
|
||||
else if (input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON) ||
|
||||
input.isMouseButtonDown(Input.MOUSE_RIGHT_BUTTON))
|
||||
if (((state == Opsu.STATE_GAME || state == Opsu.STATE_GAMEPAUSEMENU) && isGameKeyPressed()) ||
|
||||
(input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON) || input.isMouseButtonDown(Input.MOUSE_RIGHT_BUTTON)))
|
||||
scale = 1.25f;
|
||||
|
||||
// draw the other components
|
||||
@@ -404,6 +401,17 @@ public class Utils {
|
||||
cursor.rotate(delta / 40f);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if a game input key is pressed (mouse/keyboard left/right).
|
||||
* @return true if pressed
|
||||
*/
|
||||
public static boolean isGameKeyPressed() {
|
||||
return (input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON) ||
|
||||
input.isMouseButtonDown(Input.MOUSE_RIGHT_BUTTON) ||
|
||||
input.isKeyDown(Options.getGameKeyLeft()) ||
|
||||
input.isKeyDown(Options.getGameKeyRight()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the FPS at the bottom-right corner of the game container.
|
||||
* If the option is not activated, this will do nothing.
|
||||
|
||||
Reference in New Issue
Block a user