diff --git a/res/music-np-bg-black.png b/res/music-np-bg-black.png new file mode 100644 index 00000000..5c83f2d0 Binary files /dev/null and b/res/music-np-bg-black.png differ diff --git a/res/music-np-bg-white.png b/res/music-np-bg-white.png new file mode 100644 index 00000000..fd1f7005 Binary files /dev/null and b/res/music-np-bg-white.png differ diff --git a/res/music-np.pdn b/res/music-np.pdn new file mode 100644 index 00000000..ffacaef9 Binary files /dev/null and b/res/music-np.pdn differ diff --git a/res/music-np.png b/res/music-np.png new file mode 100644 index 00000000..a1b406cf Binary files /dev/null and b/res/music-np.png differ diff --git a/src/itdelatrisu/opsu/GameImage.java b/src/itdelatrisu/opsu/GameImage.java index 0d2fc0d4..dfe5dcbb 100644 --- a/src/itdelatrisu/opsu/GameImage.java +++ b/src/itdelatrisu/opsu/GameImage.java @@ -347,6 +347,9 @@ public enum GameImage { MUSIC_PAUSE ("music-pause", "png", false, false), MUSIC_NEXT ("music-next", "png", false, false), MUSIC_PREVIOUS ("music-previous", "png", false, false), + MUSIC_NOWPLAYING ("music-np", "png", false, false), + MUSIC_NOWPLAYING_BG_BLACK ("music-np-bg-black", "png", false, false), + MUSIC_NOWPLAYING_BG_WHITE ("music-np-bg-white", "png", false, false), DOWNLOADS ("downloads", "png", false, false) { @Override diff --git a/src/itdelatrisu/opsu/states/MainMenu.java b/src/itdelatrisu/opsu/states/MainMenu.java index 962b632e..993ecc34 100644 --- a/src/itdelatrisu/opsu/states/MainMenu.java +++ b/src/itdelatrisu/opsu/states/MainMenu.java @@ -233,6 +233,11 @@ public class MainMenu extends BaseOpsuState { int width = displayContainer.width; int height = displayContainer.height; + final float textMarginX = width * 0.015f; + final float textTopMarginY = height * 0.01f; + final float textBottomMarginY = height * 0.015f; + final float textLineHeight = Fonts.MEDIUM.getLineHeight() * 0.925f; + // draw background Beatmap beatmap = MusicController.getBeatmap(); if (OPTION_DYNAMIC_BACKGROUND.state && @@ -303,6 +308,24 @@ public class MainMenu extends BaseOpsuState { Image ghostLogo = GameImage.MENU_LOGO.getImage().getScaledCopy(ghostScale); ghostLogo.setAlpha(0.25f); ghostLogo.drawCentered(logo.getX(), logo.getY(), color); + + // now playing + if (OPTION_SHOW_UNICODE.state) { + Fonts.loadGlyphs(Fonts.MEDIUM, beatmap.titleUnicode); + Fonts.loadGlyphs(Fonts.MEDIUM, beatmap.artistUnicode); + } + final String trackText = beatmap.getArtist() + ": " + beatmap.getTitle(); + final float textWidth = Fonts.MEDIUM.getWidth(trackText); + final float npheight = Fonts.MEDIUM.getLineHeight() * 1.15f; + float npx = width - textWidth - textMarginX; + GameImage.MUSIC_NOWPLAYING_BG_BLACK.getImage().draw(npx, 0, width - npx, npheight); + final float npTextX = npx; + final Image np = GameImage.MUSIC_NOWPLAYING.getImage(); + final float npscale = npheight / np.getHeight(); + npx -= np.getWidth() * npscale; + GameImage.MUSIC_NOWPLAYING_BG_WHITE.getImage().draw(npx, npheight, width - npx, 2); + np.draw(npx, 0, npscale); + Fonts.MEDIUM.drawString(npTextX, 0, trackText); // draw music buttons if (MusicController.isPlaying()) @@ -350,31 +373,19 @@ public class MainMenu extends BaseOpsuState { } // draw text - float marginX = width * 0.015f, topMarginY = height * 0.01f, bottomMarginY = height * 0.015f; g.setFont(Fonts.MEDIUM); - float lineHeight = Fonts.MEDIUM.getLineHeight() * 0.925f; final String beatmapText = String.format( "You have %d beatmaps (%d songs) available!", BeatmapSetList.get().getMapCount(), BeatmapSetList.get().getMapSetCount() ); - g.drawString(beatmapText, marginX, topMarginY); - if (MusicController.isTrackLoading()) { - g.drawString("Track loading...", marginX, topMarginY + lineHeight); - } else if (MusicController.trackExists()) { - if (OPTION_SHOW_UNICODE.state) { - Fonts.loadGlyphs(Fonts.MEDIUM, beatmap.titleUnicode); - Fonts.loadGlyphs(Fonts.MEDIUM, beatmap.artistUnicode); - } - g.drawString((MusicController.isPlaying()) ? "Now Playing:" : "Paused:", marginX, topMarginY + lineHeight); - g.drawString(String.format("%s: %s", beatmap.getArtist(), beatmap.getTitle()), marginX + 25, topMarginY + (lineHeight * 2)); - } + g.drawString(beatmapText, textMarginX, textTopMarginY); g.drawString(String.format("opsu! has been running for %s.", Utils.getTimeString((int) (System.currentTimeMillis() - programStartTime) / 1000)), - marginX, height - bottomMarginY - (lineHeight * 2)); + textMarginX, height - textBottomMarginY - (textLineHeight * 2)); g.drawString(String.format("It is currently %s.", new SimpleDateFormat("HH:mm").format(new Date())), - marginX, height - bottomMarginY - lineHeight); + textMarginX, height - textBottomMarginY - textLineHeight); UI.draw(g); }