Minor graphical updates and code cleaning.
- Padded game score display, and always display 2 digits in front of the decimal (e.g. 00.00% instead of 0.00%). - Keep map progress circle at a fixed location instead of basing it off the score length. - Moved some track resets (pause + restart at preview) to trigger upon loading the song menu. Fixes weird behaviors when leaving the game state. - Cleaned up trailing whitespace and added missing overrides. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
@@ -18,8 +18,6 @@
|
||||
|
||||
package itdelatrisu.opsu.states;
|
||||
|
||||
import java.util.Stack;
|
||||
|
||||
import itdelatrisu.opsu.GameImage;
|
||||
import itdelatrisu.opsu.GameMod;
|
||||
import itdelatrisu.opsu.MenuButton;
|
||||
@@ -35,6 +33,8 @@ import itdelatrisu.opsu.audio.MusicController;
|
||||
import itdelatrisu.opsu.audio.SoundController;
|
||||
import itdelatrisu.opsu.audio.SoundEffect;
|
||||
|
||||
import java.util.Stack;
|
||||
|
||||
import org.lwjgl.opengl.Display;
|
||||
import org.newdawn.slick.Animation;
|
||||
import org.newdawn.slick.Color;
|
||||
@@ -182,6 +182,11 @@ public class SongMenu extends BasicGameState {
|
||||
*/
|
||||
private boolean resetGame = false;
|
||||
|
||||
/**
|
||||
* Whether or not to reset music track upon entering the state.
|
||||
*/
|
||||
private boolean resetTrack = false;
|
||||
|
||||
// game-related variables
|
||||
private GameContainer container;
|
||||
private StateBasedGame game;
|
||||
@@ -435,7 +440,7 @@ public class SongMenu extends BasicGameState {
|
||||
|
||||
@Override
|
||||
public void mousePressed(int button, int x, int y) {
|
||||
// check mouse button
|
||||
// check mouse button
|
||||
if (button != Input.MOUSE_LEFT_BUTTON)
|
||||
return;
|
||||
|
||||
@@ -657,6 +662,13 @@ public class SongMenu extends BasicGameState {
|
||||
GameImage.destroySkinImages(); // destroy skin images, if any
|
||||
resetGame = false;
|
||||
}
|
||||
|
||||
// reset music track
|
||||
if (resetTrack) {
|
||||
MusicController.pause();
|
||||
MusicController.playAt(MusicController.getOsuFile().previewTime, true);
|
||||
resetTrack = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -679,7 +691,7 @@ public class SongMenu extends BasicGameState {
|
||||
while (n != 0) {
|
||||
if (startNode == null)
|
||||
break;
|
||||
|
||||
|
||||
int height = container.getHeight();
|
||||
if (n < 0 && startNode.prev != null) {
|
||||
startNode = startNode.prev;
|
||||
@@ -777,6 +789,11 @@ public class SongMenu extends BasicGameState {
|
||||
*/
|
||||
public void resetGameDataOnLoad() { resetGame = true; }
|
||||
|
||||
/**
|
||||
* Triggers a reset of the music track upon entering this state.
|
||||
*/
|
||||
public void resetTrackOnLoad() { resetTrack = true; }
|
||||
|
||||
/**
|
||||
* Starts the game.
|
||||
* @param osu the OsuFile to send to the game
|
||||
|
||||
Reference in New Issue
Block a user