don't set elements underneath options overlay as hovered

This commit is contained in:
yugecin 2018-07-08 10:53:08 +02:00
parent 4a69f1d9b3
commit 70902e42cb
No known key found for this signature in database
GPG Key ID: 2C5AC035A7068E44
3 changed files with 23 additions and 0 deletions

View File

@ -52,6 +52,7 @@ import org.newdawn.slick.opengl.renderer.SGL;
import org.newdawn.slick.util.Log;
import yugecin.opsudance.core.Constants;
import yugecin.opsudance.core.Entrypoint;
import yugecin.opsudance.core.InstanceContainer;
import yugecin.opsudance.core.state.BaseOpsuState;
import yugecin.opsudance.core.state.OpsuState;
import yugecin.opsudance.ui.ImagePosition;
@ -483,6 +484,14 @@ public class MainMenu extends BaseOpsuState {
int delta = renderDelta;
int mouseX = InstanceContainer.mouseX;
int mouseY = InstanceContainer.mouseY;
if (optionsOverlay.containsMouse()) {
// dirty hack to not show elements underneath options overlay as hovered
mouseX = -mouseX;
mouseY = -mouseY;
}
final Iterator<PulseData> pulseDataIter = this.pulseData.iterator();
while (pulseDataIter.hasNext()) {
final PulseData pd = pulseDataIter.next();

View File

@ -63,6 +63,8 @@ import org.newdawn.slick.Image;
import org.newdawn.slick.Input;
import org.newdawn.slick.SpriteSheet;
import org.newdawn.slick.gui.TextField;
import yugecin.opsudance.core.InstanceContainer;
import yugecin.opsudance.core.state.ComplexOpsuState;
import static org.lwjgl.input.Keyboard.*;
@ -703,6 +705,14 @@ public class SongMenu extends ComplexOpsuState {
optionsOverlay.preRenderUpdate();
int mouseX = InstanceContainer.mouseX;
int mouseY = InstanceContainer.mouseY;
if (optionsOverlay.containsMouse()) {
// dirty hack to not show elements underneath options overlay as hovered
mouseX = -mouseX;
mouseY = -mouseY;
}
int delta = renderDelta;
UI.update(delta);
if (reloadThread == null)

View File

@ -188,6 +188,10 @@ public class OptionsOverlay implements ResolutionChangedListener {
public boolean isActive() {
return this.active;
}
public boolean containsMouse() {
return this.active && mouseX <= this.currentWidth;
}
public void setListener(Listener listener) {
this.listener = listener;