From 1fe45f7bb473678d93a2a0714afd8f71992b65c6 Mon Sep 17 00:00:00 2001 From: Jeffrey Han Date: Fri, 11 Sep 2015 11:43:19 -0400 Subject: [PATCH] Merged DISABLE_CURSOR option from fluddokt/opsu. --- src/itdelatrisu/opsu/Options.java | 7 +++++++ src/itdelatrisu/opsu/states/OptionsMenu.java | 3 ++- src/itdelatrisu/opsu/ui/Cursor.java | 3 +++ src/itdelatrisu/opsu/ui/DropdownMenu.java | 2 +- src/itdelatrisu/opsu/ui/UI.java | 4 ++-- 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/itdelatrisu/opsu/Options.java b/src/itdelatrisu/opsu/Options.java index 434bc9a6..18d701bd 100644 --- a/src/itdelatrisu/opsu/Options.java +++ b/src/itdelatrisu/opsu/Options.java @@ -413,6 +413,7 @@ public class Options { }, DISABLE_MOUSE_WHEEL ("Disable mouse wheel in play mode", "MouseDisableWheel", "During play, you can use the mouse wheel to adjust the volume and pause the game.\nThis will disable that functionality.", false), DISABLE_MOUSE_BUTTONS ("Disable mouse buttons in play mode", "MouseDisableButtons", "This option will disable all mouse buttons.\nSpecifically for people who use their keyboard to click.", false), + DISABLE_CURSOR ("Disable Cursor", "DisableCursor", "Hide the cursor sprite.", false), BACKGROUND_DIM ("Background Dim", "DimLevel", "Percentage to dim the background image during gameplay.", 50, 0, 100), FORCE_DEFAULT_PLAYFIELD ("Force Default Playfield", "ForceDefaultPlayfield", "Override the song background with the default playfield background.", false), IGNORE_BEATMAP_SKINS ("Ignore All Beatmap Skins", "IgnoreBeatmapSkins", "Never use skin element overrides provided by beatmaps.", false), @@ -1059,6 +1060,12 @@ public class Options { "Mouse buttons are disabled." : "Mouse buttons are enabled."); } + /** + * Returns whether or not the cursor sprite should be hidden. + * @return true if disabled + */ + public static boolean isCursorDisabled() { return GameOption.DISABLE_CURSOR.getBooleanValue(); } + /** * Returns the left game key. * @return the left key code diff --git a/src/itdelatrisu/opsu/states/OptionsMenu.java b/src/itdelatrisu/opsu/states/OptionsMenu.java index 3792d8b4..6cdee288 100644 --- a/src/itdelatrisu/opsu/states/OptionsMenu.java +++ b/src/itdelatrisu/opsu/states/OptionsMenu.java @@ -88,7 +88,8 @@ public class OptionsMenu extends BasicGameState { GameOption.DISABLE_MOUSE_WHEEL, GameOption.DISABLE_MOUSE_BUTTONS, GameOption.CURSOR_SIZE, - GameOption.NEW_CURSOR + GameOption.NEW_CURSOR, + GameOption.DISABLE_CURSOR }), CUSTOM ("Custom", new GameOption[] { GameOption.FIXED_CS, diff --git a/src/itdelatrisu/opsu/ui/Cursor.java b/src/itdelatrisu/opsu/ui/Cursor.java index f5d47ca7..d0382aae 100644 --- a/src/itdelatrisu/opsu/ui/Cursor.java +++ b/src/itdelatrisu/opsu/ui/Cursor.java @@ -115,6 +115,9 @@ public class Cursor { * @param mousePressed whether or not the mouse button is pressed */ public void draw(int mouseX, int mouseY, boolean mousePressed) { + if (Options.isCursorDisabled()) + return; + // determine correct cursor image Image cursor = null, cursorMiddle = null, cursorTrail = null; boolean beatmapSkinned = GameImage.CURSOR.hasBeatmapSkinImage(); diff --git a/src/itdelatrisu/opsu/ui/DropdownMenu.java b/src/itdelatrisu/opsu/ui/DropdownMenu.java index 4cfb8854..059751a0 100644 --- a/src/itdelatrisu/opsu/ui/DropdownMenu.java +++ b/src/itdelatrisu/opsu/ui/DropdownMenu.java @@ -375,7 +375,7 @@ public class DropdownMenu extends AbstractComponent { /** * Selects the item at the given index. * @param index the list item index - * @throws IllegalArgumentException if index < -1 or index is greater than or equal to size + * @throws IllegalArgumentException if {@code index} is negative or greater than or equal to size */ public void setSelectedIndex(int index) { if (index < 0 || index >= items.length) diff --git a/src/itdelatrisu/opsu/ui/UI.java b/src/itdelatrisu/opsu/ui/UI.java index dfe8116d..f2a7f63c 100644 --- a/src/itdelatrisu/opsu/ui/UI.java +++ b/src/itdelatrisu/opsu/ui/UI.java @@ -119,7 +119,7 @@ public class UI { } /** - * Draws the global UI components: cursor, FPS, volume bar, bar notifications. + * Draws the global UI components: cursor, FPS, volume bar, tooltips, bar notifications. * @param g the graphics context */ public static void draw(Graphics g) { @@ -131,7 +131,7 @@ public class UI { } /** - * Draws the global UI components: cursor, FPS, volume bar, bar notifications. + * Draws the global UI components: cursor, FPS, volume bar, tooltips, bar notifications. * @param g the graphics context * @param mouseX the mouse x coordinate * @param mouseY the mouse y coordinate