From 8c172dc15f58b2c630c0289f55ca3d3446862c47 Mon Sep 17 00:00:00 2001 From: yugecin Date: Sat, 10 Dec 2016 20:36:34 +0100 Subject: [PATCH] draw the logo in the bottom right corner of the songmenu --- src/itdelatrisu/opsu/states/MainMenu.java | 4 +--- src/itdelatrisu/opsu/states/SongMenu.java | 22 ++++++++++++++++++++++ src/itdelatrisu/opsu/ui/Colors.java | 4 +++- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/itdelatrisu/opsu/states/MainMenu.java b/src/itdelatrisu/opsu/states/MainMenu.java index c5a79f87..97243fd2 100644 --- a/src/itdelatrisu/opsu/states/MainMenu.java +++ b/src/itdelatrisu/opsu/states/MainMenu.java @@ -126,8 +126,6 @@ public class MainMenu extends BasicGameState { private Input input; private final int state; - private final Color logoGhostColor = new Color(1.0f, 1.0f, 1.0f, 0.15f); - public MainMenu(int state) { this.state = state; } @@ -286,7 +284,7 @@ public class MainMenu extends BasicGameState { Image logoCopy = GameImage.MENU_LOGO.getImage().getScaledCopy(logo.getCurrentScale() / (float) scale * 1.05f); scaleposmodx = logoCopy.getWidth() / 2; scaleposmody = logoCopy.getHeight() / 2; - logoCopy.draw(logo.getX() - scaleposmodx, logo.getY() - scaleposmody, logoGhostColor); + logoCopy.draw(logo.getX() - scaleposmodx, logo.getY() - scaleposmody, Colors.GHOST_LOGO); } else { logo.draw(); } diff --git a/src/itdelatrisu/opsu/states/SongMenu.java b/src/itdelatrisu/opsu/states/SongMenu.java index 805e3f78..af941f27 100644 --- a/src/itdelatrisu/opsu/states/SongMenu.java +++ b/src/itdelatrisu/opsu/states/SongMenu.java @@ -259,6 +259,9 @@ public class SongMenu extends BasicGameState { /** Header and footer end and start y coordinates, respectively. */ private float headerY, footerY; + /** Height of the footer */ + private float footerHeight; + /** Time, in milliseconds, for fading the search bar. */ private int searchTransitionTimer = SEARCH_TRANSITION_TIME; @@ -334,6 +337,7 @@ public class SongMenu extends BasicGameState { Fonts.BOLD.getLineHeight() + Fonts.DEFAULT.getLineHeight() + Fonts.SMALL.getLineHeight(); footerY = height - GameImage.SELECTION_MODS.getImage().getHeight(); + footerHeight = height - footerY; // initialize sorts for (BeatmapSortOrder sort : BeatmapSortOrder.values()) @@ -506,6 +510,24 @@ public class SongMenu extends BasicGameState { g.drawLine(0, footerY, width, footerY); g.resetLineWidth(); + // opsu logo in bottom bar + Image logo = GameImage.MENU_LOGO.getImage(); + float logoSize = footerHeight * 2f; + logo = logo.getScaledCopy(logoSize / logo.getWidth()); + Double position = MusicController.getBeatProgress(); + float x = width - footerHeight * 0.60f; + float y = height - footerHeight * 0.40f; + if (position != null) { + Image ghostLogo = logo.getScaledCopy((float) (1 - (0 - position) * 0.075)); + logo = logo.getScaledCopy((float) (1 - (position) * 0.075)); + logoSize = logo.getWidth(); + logo.draw(x - logoSize / 2, y - logoSize / 2); + logoSize = ghostLogo.getWidth(); + ghostLogo.draw(x - logoSize / 2, y - logoSize / 2, Colors.GHOST_LOGO); + } else { + logo.draw(x - logoSize / 2, y - logoSize / 2); + } + // header if (focusNode != null) { // music/loader icon diff --git a/src/itdelatrisu/opsu/ui/Colors.java b/src/itdelatrisu/opsu/ui/Colors.java index 7f00603a..599f58c2 100644 --- a/src/itdelatrisu/opsu/ui/Colors.java +++ b/src/itdelatrisu/opsu/ui/Colors.java @@ -45,7 +45,9 @@ public class Colors { BLUE_SCOREBOARD = new Color(133, 208, 212), BLACK_BG_NORMAL = new Color(0, 0, 0, 0.25f), BLACK_BG_HOVER = new Color(0, 0, 0, 0.5f), - BLACK_BG_FOCUS = new Color(0, 0, 0, 0.75f); + BLACK_BG_FOCUS = new Color(0, 0, 0, 0.75f), + GHOST_LOGO = new Color(1.0f, 1.0f, 1.0f, 0.15f); + // This class should not be instantiated. private Colors() {}