make the footer logo a button, start game when clicking & expand on hover
This commit is contained in:
parent
624296deea
commit
e648a553ea
|
@ -259,6 +259,12 @@ public class SongMenu extends BasicGameState {
|
||||||
/** Header and footer end and start y coordinates, respectively. */
|
/** Header and footer end and start y coordinates, respectively. */
|
||||||
private float headerY, footerY;
|
private float headerY, footerY;
|
||||||
|
|
||||||
|
/** Footer pulsing logo button. */
|
||||||
|
private MenuButton footerLogoButton;
|
||||||
|
|
||||||
|
/** Whether the cursor hovers over the footer logo. */
|
||||||
|
private boolean bottomLogoHovered;
|
||||||
|
|
||||||
/** Time, in milliseconds, for fading the search bar. */
|
/** Time, in milliseconds, for fading the search bar. */
|
||||||
private int searchTransitionTimer = SEARCH_TRANSITION_TIME;
|
private int searchTransitionTimer = SEARCH_TRANSITION_TIME;
|
||||||
|
|
||||||
|
@ -335,6 +341,14 @@ public class SongMenu extends BasicGameState {
|
||||||
Fonts.SMALL.getLineHeight();
|
Fonts.SMALL.getLineHeight();
|
||||||
footerY = height - GameImage.SELECTION_MODS.getImage().getHeight();
|
footerY = height - GameImage.SELECTION_MODS.getImage().getHeight();
|
||||||
|
|
||||||
|
// logo coordinates
|
||||||
|
float footerHeight = height - footerY;
|
||||||
|
Image logo = GameImage.MENU_LOGO.getImage();
|
||||||
|
logo = logo.getScaledCopy(footerHeight * 3.25f / logo.getWidth());
|
||||||
|
footerLogoButton = new MenuButton(logo, width - footerHeight * 0.8f, height - footerHeight * 0.65f);
|
||||||
|
footerLogoButton.setHoverAnimationDuration(1);
|
||||||
|
footerLogoButton.setHoverExpand(1.4f);
|
||||||
|
|
||||||
// initialize sorts
|
// initialize sorts
|
||||||
for (BeatmapSortOrder sort : BeatmapSortOrder.values())
|
for (BeatmapSortOrder sort : BeatmapSortOrder.values())
|
||||||
sort.init(width, headerY - SongMenu.DIVIDER_LINE_WIDTH / 2);
|
sort.init(width, headerY - SongMenu.DIVIDER_LINE_WIDTH / 2);
|
||||||
|
@ -499,25 +513,25 @@ public class SongMenu extends BasicGameState {
|
||||||
g.resetLineWidth();
|
g.resetLineWidth();
|
||||||
|
|
||||||
// opsu logo in bottom bar
|
// opsu logo in bottom bar
|
||||||
float footerHeight = height - footerY;
|
|
||||||
Image logo = GameImage.MENU_LOGO.getImage();
|
|
||||||
float logoSize = footerHeight * 3.25f;
|
|
||||||
logo = logo.getScaledCopy(logoSize / logo.getWidth());
|
|
||||||
Float position = MusicController.getBeatProgress();
|
Float position = MusicController.getBeatProgress();
|
||||||
if (position == null) {
|
if (position == null) {
|
||||||
position = System.currentTimeMillis() % 1000 / 1000f;
|
position = System.currentTimeMillis() % 1000 / 1000f;
|
||||||
}
|
}
|
||||||
float x = width - footerHeight * 0.8f;
|
if (bottomLogoHovered) {
|
||||||
float y = height - footerHeight * 0.65f;
|
footerLogoButton.draw();
|
||||||
Image ghostLogo = logo.getScaledCopy((float) (1 - (0 - position) * 0.15));
|
} else {
|
||||||
logo = logo.getScaledCopy((float) (1 - (position) * 0.15));
|
float expand = position * 0.15f;
|
||||||
logoSize = logo.getWidth();
|
footerLogoButton.draw(Color.white, 1f - expand);
|
||||||
logo.draw(x - logoSize / 2, y - logoSize / 2);
|
Image ghostLogo = GameImage.MENU_LOGO.getImage();
|
||||||
logoSize = ghostLogo.getWidth();
|
ghostLogo = ghostLogo.getScaledCopy((height - footerY) * 3.25f / ghostLogo.getWidth());
|
||||||
|
ghostLogo = ghostLogo.getScaledCopy(1f + expand);
|
||||||
|
float scaleposmodx = ghostLogo.getWidth() / 2;
|
||||||
|
float scaleposmody = ghostLogo.getHeight() / 2;
|
||||||
float a = Colors.GHOST_LOGO.a;
|
float a = Colors.GHOST_LOGO.a;
|
||||||
Colors.GHOST_LOGO.a *= (1f - position);
|
Colors.GHOST_LOGO.a *= (1f - position);
|
||||||
ghostLogo.draw(x - logoSize / 2, y - logoSize / 2, Colors.GHOST_LOGO);
|
ghostLogo.draw(footerLogoButton.getX() - scaleposmodx, footerLogoButton.getY() - scaleposmody, Colors.GHOST_LOGO);
|
||||||
Colors.GHOST_LOGO.a = a;
|
Colors.GHOST_LOGO.a = a;
|
||||||
|
}
|
||||||
|
|
||||||
// header
|
// header
|
||||||
if (focusNode != null) {
|
if (focusNode != null) {
|
||||||
|
@ -774,7 +788,18 @@ public class SongMenu extends BasicGameState {
|
||||||
}
|
}
|
||||||
updateDrawnSongPosition();
|
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);
|
BeatmapSetNode node = getNodeAtPosition(mouseX, mouseY);
|
||||||
if (node != null) {
|
if (node != null) {
|
||||||
if (node == hoverIndex)
|
if (node == hoverIndex)
|
||||||
|
@ -817,6 +842,11 @@ public class SongMenu extends BasicGameState {
|
||||||
if (isScrollingToFocusNode)
|
if (isScrollingToFocusNode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (bottomLogoHovered) {
|
||||||
|
startGame();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
songScrolling.pressed();
|
songScrolling.pressed();
|
||||||
startScorePos.pressed();
|
startScorePos.pressed();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user