Merge pull request #214 from yugecin/pusing-logo
Pulse main menu logo to the beat, add pulsing logo in song menu
This commit is contained in:
@@ -256,7 +256,18 @@ public class MainMenu extends BasicGameState {
|
||||
playButton.draw();
|
||||
exitButton.draw();
|
||||
}
|
||||
logo.draw();
|
||||
|
||||
// logo
|
||||
Float position = MusicController.getBeatProgress();
|
||||
if (position == null) {
|
||||
position = System.currentTimeMillis() % 1000 / 1000f;
|
||||
}
|
||||
float scale = 1f + position * 0.05f;
|
||||
logo.draw(Color.white, scale);
|
||||
Image ghostLogo = GameImage.MENU_LOGO.getImage().getScaledCopy(logo.getCurrentScale() / scale * 1.05f);
|
||||
float scaleposmodx = ghostLogo.getWidth() / 2;
|
||||
float scaleposmody = ghostLogo.getHeight() / 2;
|
||||
ghostLogo.draw(logo.getX() - scaleposmodx, logo.getY() - scaleposmody, Colors.GHOST_LOGO);
|
||||
|
||||
// draw music buttons
|
||||
if (MusicController.isPlaying())
|
||||
|
||||
@@ -259,6 +259,15 @@ public class SongMenu extends BasicGameState {
|
||||
/** Header and footer end and start y coordinates, respectively. */
|
||||
private float headerY, footerY;
|
||||
|
||||
/** Footer pulsing logo button. */
|
||||
private MenuButton footerLogoButton;
|
||||
|
||||
/** Size of the footer pulsing logo. */
|
||||
private float footerLogoSize;
|
||||
|
||||
/** Whether the cursor hovers over the footer logo. */
|
||||
private boolean bottomLogoHovered;
|
||||
|
||||
/** Time, in milliseconds, for fading the search bar. */
|
||||
private int searchTransitionTimer = SEARCH_TRANSITION_TIME;
|
||||
|
||||
@@ -335,6 +344,15 @@ public class SongMenu extends BasicGameState {
|
||||
Fonts.SMALL.getLineHeight();
|
||||
footerY = height - GameImage.SELECTION_MODS.getImage().getHeight();
|
||||
|
||||
// logo coordinates
|
||||
float footerHeight = height - footerY;
|
||||
footerLogoSize = footerHeight * 3.25f;
|
||||
Image logo = GameImage.MENU_LOGO.getImage();
|
||||
logo = logo.getScaledCopy(footerLogoSize / logo.getWidth());
|
||||
footerLogoButton = new MenuButton(logo, width - footerHeight * 0.8f, height - footerHeight * 0.65f);
|
||||
footerLogoButton.setHoverAnimationDuration(1);
|
||||
footerLogoButton.setHoverExpand(1.2f);
|
||||
|
||||
// initialize sorts
|
||||
for (BeatmapSortOrder sort : BeatmapSortOrder.values())
|
||||
sort.init(width, headerY - SongMenu.DIVIDER_LINE_WIDTH / 2);
|
||||
@@ -498,6 +516,26 @@ public class SongMenu extends BasicGameState {
|
||||
g.drawLine(0, footerY, width, footerY);
|
||||
g.resetLineWidth();
|
||||
|
||||
// opsu logo in bottom bar
|
||||
Float position = MusicController.getBeatProgress();
|
||||
if (position == null) {
|
||||
position = System.currentTimeMillis() % 1000 / 1000f;
|
||||
}
|
||||
if (bottomLogoHovered) {
|
||||
footerLogoButton.draw();
|
||||
} else {
|
||||
float expand = position * 0.15f;
|
||||
footerLogoButton.draw(Color.white, 1f - expand);
|
||||
Image ghostLogo = GameImage.MENU_LOGO.getImage();
|
||||
ghostLogo = ghostLogo.getScaledCopy((1f + expand) * footerLogoSize / ghostLogo.getWidth());
|
||||
float scaleposmodx = ghostLogo.getWidth() / 2;
|
||||
float scaleposmody = ghostLogo.getHeight() / 2;
|
||||
float a = Colors.GHOST_LOGO.a;
|
||||
Colors.GHOST_LOGO.a *= (1f - position);
|
||||
ghostLogo.draw(footerLogoButton.getX() - scaleposmodx, footerLogoButton.getY() - scaleposmody, Colors.GHOST_LOGO);
|
||||
Colors.GHOST_LOGO.a = a;
|
||||
}
|
||||
|
||||
// header
|
||||
if (focusNode != null) {
|
||||
// music/loader icon
|
||||
@@ -753,7 +791,18 @@ public class SongMenu extends BasicGameState {
|
||||
}
|
||||
updateDrawnSongPosition();
|
||||
|
||||
// mouse hover
|
||||
// mouse hover (logo)
|
||||
if (footerLogoButton.contains(mouseX, mouseY, 0.25f)) {
|
||||
footerLogoButton.hoverUpdate(delta, true);
|
||||
bottomLogoHovered = true;
|
||||
// reset beatmap node hover
|
||||
hoverIndex = null;
|
||||
return;
|
||||
}
|
||||
footerLogoButton.hoverUpdate(delta, false);
|
||||
bottomLogoHovered = false;
|
||||
|
||||
// mouse hover (beatmap nodes)
|
||||
BeatmapSetNode node = getNodeAtPosition(mouseX, mouseY);
|
||||
if (node != null) {
|
||||
if (node == hoverIndex)
|
||||
@@ -796,6 +845,11 @@ public class SongMenu extends BasicGameState {
|
||||
if (isScrollingToFocusNode)
|
||||
return;
|
||||
|
||||
if (bottomLogoHovered) {
|
||||
startGame();
|
||||
return;
|
||||
}
|
||||
|
||||
songScrolling.pressed();
|
||||
startScorePos.pressed();
|
||||
}
|
||||
@@ -1390,6 +1444,10 @@ public class SongMenu extends BasicGameState {
|
||||
|
||||
focusNode = BeatmapSetList.get().getNode(node, beatmapIndex);
|
||||
Beatmap beatmap = focusNode.getSelectedBeatmap();
|
||||
if (beatmap.timingPoints == null) {
|
||||
// parse the timingpoints so we can pulse the main menu logo and bottom right logo in songmenu
|
||||
BeatmapParser.parseOnlyTimingPoints(beatmap);
|
||||
}
|
||||
MusicController.play(beatmap, false, preview);
|
||||
|
||||
// load scores
|
||||
|
||||
Reference in New Issue
Block a user