fix back button

Make it immune to the "do not hover if options visible" hack.
Make the states render it, not the options menu.
This commit is contained in:
yugecin 2018-07-08 10:58:00 +02:00
parent 70902e42cb
commit ab6aa75f8b
No known key found for this signature in database
GPG Key ID: 2C5AC035A7068E44
7 changed files with 17 additions and 9 deletions

View File

@ -537,7 +537,7 @@ public class DownloadsMenu extends ComplexOpsuState {
}
importThread = null;
}
backButton.hoverUpdate(delta, mouseX, mouseY);
backButton.hoverUpdate();
prevPage.hoverUpdate(delta, mouseX, mouseY);
nextPage.hoverUpdate(delta, mouseX, mouseY);
clearButton.hoverUpdate(delta, mouseX, mouseY);

View File

@ -717,6 +717,9 @@ public class Game extends ComplexOpsuState {
if (OPTION_DANCE_ENABLE_SB.state) {
optionsOverlay.render(g);
if (optionsOverlay.isActive()) {
backButton.draw(g);
}
}
UI.draw(g);
@ -728,6 +731,9 @@ public class Game extends ComplexOpsuState {
if (OPTION_DANCE_ENABLE_SB.state) {
optionsOverlay.preRenderUpdate();
if (optionsOverlay.isActive()) {
backButton.hoverUpdate();
}
}
int delta = renderDelta;

View File

@ -107,7 +107,7 @@ public class GameRanking extends BaseOpsuState {
} else {
MusicController.loopTrackIfEnded(true);
}
backButton.hoverUpdate(delta, mouseX, mouseY);
backButton.hoverUpdate();
}
@Override

View File

@ -481,6 +481,9 @@ public class MainMenu extends BaseOpsuState {
@Override
public void preRenderUpdate() {
optionsOverlay.preRenderUpdate();
if (optionsOverlay.isActive()) {
backButton.hoverUpdate();
}
int delta = renderDelta;

View File

@ -689,10 +689,10 @@ public class SongMenu extends ComplexOpsuState {
UI.drawLoadingProgress(g);
} else {
optionsOverlay.render(g);
backButton.draw(g);
}
optionsOverlay.render(g);
UI.draw(g);
@ -729,7 +729,7 @@ public class SongMenu extends ComplexOpsuState {
MusicController.playThemeSong(config.themeBeatmap);
reloadThread = null;
}
backButton.hoverUpdate(delta, mouseX, mouseY);
backButton.hoverUpdate();
selectModsButton.hoverUpdate(delta, mouseX, mouseY);
selectRandomButton.hoverUpdate(delta, mouseX, mouseY);
selectMapOptionsButton.hoverUpdate(delta, mouseX, mouseY);

View File

@ -172,11 +172,11 @@ public class BackButton {
/**
* Processes a hover action depending on whether or not the cursor
* is hovering over the button.
* @param delta the delta interval
* @param cx the x coordinate
* @param cy the y coordinate
*/
public void hoverUpdate(int delta, int cx, int cy) {
public void hoverUpdate() {
final int delta = renderDelta;
final int cx = mouseX;
final int cy = mouseY;
if (backButton != null) {
backButton.hoverUpdate(delta, cx, cy);
return;

View File

@ -702,7 +702,6 @@ public class OptionsOverlay implements ResolutionChangedListener {
prevMouseY = mouseY;
updateHoverOption(mouseX, mouseY);
updateIndicatorAlpha();
backButton.hoverUpdate(delta, mouseX, mouseY);
if (isAdjustingSlider) {
int sliderValue = ((NumericOption) hoverOption).val;
updateSliderOption();