DT/HF/Playback changes.

Can watch HalfTime on half speed.
Reset pitch on leaving the game state.
Load songInfo when entering select song menu.
Playback button fades in on hover instead of expands.
Reverted spinner changes. It should be fixed separately.
This commit is contained in:
Pavel Kolchev
2015-04-03 15:01:18 +03:00
parent d8425197a7
commit f810965921
8 changed files with 51 additions and 40 deletions

View File

@@ -2,6 +2,7 @@ package itdelatrisu.opsu.replay;
import itdelatrisu.opsu.GameImage;
import itdelatrisu.opsu.GameMod;
import itdelatrisu.opsu.MenuButton;
import org.newdawn.slick.Image;
public enum PlaybackSpeed {
@@ -12,6 +13,9 @@ public enum PlaybackSpeed {
/** The file name of the button image. */
private GameImage gameImage;
/** The button of the playback. */
private MenuButton button;
/** The speed modifier of the playback. */
private float modifier;
@@ -20,12 +24,20 @@ public enum PlaybackSpeed {
this.modifier = modifier;
}
public static void init(int width, int height) {
// create buttons
for (PlaybackSpeed playback : PlaybackSpeed.values()) {
Image img = playback.gameImage.getImage();
playback.button = new MenuButton(img, width * 0.98f - (img.getWidth() / 2f), height * 0.25f);
playback.button.setHoverFade();
}
}
private static int index = 1;
public static PlaybackSpeed next() {
PlaybackSpeed next = values()[index++ % values().length];
if((GameMod.DOUBLE_TIME.isActive() && next == PlaybackSpeed.DOUBLE) ||
(GameMod.HALF_TIME.isActive() && next == PlaybackSpeed.HALF))
if((GameMod.DOUBLE_TIME.isActive() && next == PlaybackSpeed.DOUBLE))
next = next();
return next;
@@ -36,10 +48,10 @@ public enum PlaybackSpeed {
}
/**
* Returns the image.
* @return the associated image
* Returns the button.
* @return the associated button
*/
public Image getImage() { return gameImage.getImage(); }
public MenuButton getButton() { return button; }
/**
* Returns the speed modifier.