Cursor refactoring.

Moved cursor-related code out of UI and into a new non-static "Cursor" class.

Also, the cursor is no longer reset after gameplay if it wasn't skinned.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2015-05-29 04:48:03 -04:00
parent 00a08f1327
commit 0c42f1ed01
8 changed files with 337 additions and 254 deletions

View File

@@ -544,7 +544,6 @@ public class Game extends BasicGameState {
UI.draw(g, autoMouseX, autoMouseY, Utils.isGameKeyPressed());
else
UI.draw(g);
}
@Override
@@ -1105,7 +1104,7 @@ public class Game extends BasicGameState {
// unhide cursor for "auto" mod and replays
if (GameMod.AUTO.isActive() || isReplay)
UI.showCursor();
UI.getCursor().show();
// load replay frames
if (isReplay) {
@@ -1163,7 +1162,7 @@ public class Game extends BasicGameState {
// re-hide cursor
if (GameMod.AUTO.isActive() || isReplay)
UI.hideCursor();
UI.getCursor().hide();
// replays
if (isReplay)

View File

@@ -133,7 +133,8 @@ public class GamePauseMenu extends BasicGameState {
SoundController.playSound(SoundEffect.MENUBACK);
((SongMenu) game.getState(Opsu.STATE_SONGMENU)).resetGameDataOnLoad();
MusicController.playAt(MusicController.getBeatmap().previewTime, true);
UI.resetCursor();
if (UI.getCursor().isSkinned())
UI.getCursor().reset();
game.enterState(Opsu.STATE_SONGMENU, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
} else {
SoundController.playSound(SoundEffect.MENUBACK);
@@ -186,7 +187,8 @@ public class GamePauseMenu extends BasicGameState {
MusicController.playAt(MusicController.getBeatmap().previewTime, true);
else
MusicController.resume();
UI.resetCursor();
if (UI.getCursor().isSkinned())
UI.getCursor().reset();
game.enterState(Opsu.STATE_SONGMENU, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
}
}

View File

@@ -244,7 +244,8 @@ public class GameRanking extends BasicGameState {
songMenu.resetGameDataOnLoad();
songMenu.resetTrackOnLoad();
}
UI.resetCursor();
if (UI.getCursor().isSkinned())
UI.getCursor().reset();
game.enterState(Opsu.STATE_SONGMENU, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
}