add chaning volume hotkey (alt+scrolling) as global hotkey

This commit is contained in:
yugecin 2017-02-03 16:43:47 +01:00
parent 11acbaaf3a
commit 1faee53830
7 changed files with 13 additions and 18 deletions

View File

@ -79,13 +79,6 @@ public class ButtonMenu extends BaseOpsuState {
public void leave() { public void leave() {
Button.CANCEL.click(); Button.CANCEL.click();
} }
@Override
public void mouseWheelMoved(int newValue) {
if (displayContainer.input.isKeyDown(Input.KEY_LALT) || displayContainer.input.isKeyDown(Input.KEY_RALT)) {
super.mouseWheelMoved(newValue);
}
}
}, },
/** The initial beatmap management screen (for a "favorite" beatmap). */ /** The initial beatmap management screen (for a "favorite" beatmap). */
BEATMAP_FAVORITE (new Button[] { Button.CLEAR_SCORES, Button.FAVORITE_REMOVE, Button.DELETE, Button.CANCEL }) { BEATMAP_FAVORITE (new Button[] { Button.CLEAR_SCORES, Button.FAVORITE_REMOVE, Button.DELETE, Button.CANCEL }) {

View File

@ -847,9 +847,7 @@ public class DownloadsMenu extends ComplexOpsuState {
@Override @Override
public boolean mouseWheelMoved(int newValue) { public boolean mouseWheelMoved(int newValue) {
// change volume if (super.mouseWheelMoved(newValue)) {
if (displayContainer.input.isKeyDown(Input.KEY_LALT) || displayContainer.input.isKeyDown(Input.KEY_RALT)) {
UI.changeVolume((newValue < 0) ? -1 : 1);
return true; return true;
} }

View File

@ -121,9 +121,6 @@ public class GameRanking extends BaseOpsuState {
@Override @Override
public boolean mouseWheelMoved(int newValue) { public boolean mouseWheelMoved(int newValue) {
if (displayContainer.input.isKeyDown(Input.KEY_LALT) || displayContainer.input.isKeyDown(Input.KEY_RALT)) {
UI.changeVolume((newValue < 0) ? -1 : 1);
}
return true; return true;
} }

View File

@ -639,6 +639,10 @@ public class MainMenu extends BaseOpsuState {
@Override @Override
public boolean mouseWheelMoved(int newValue) { public boolean mouseWheelMoved(int newValue) {
if (super.mouseWheelMoved(newValue)) {
return true;
}
UI.changeVolume((newValue < 0) ? -1 : 1); UI.changeVolume((newValue < 0) ? -1 : 1);
return true; return true;
} }

View File

@ -1238,11 +1238,6 @@ public class SongMenu extends ComplexOpsuState {
Input input = displayContainer.input; Input input = displayContainer.input;
if (input.isKeyDown(Input.KEY_LALT) || input.isKeyDown(Input.KEY_RALT)) {
UI.changeVolume((newValue < 0) ? -1 : 1);
return true;
}
if (isInputBlocked()) { if (isInputBlocked()) {
return true; return true;
} }

View File

@ -20,6 +20,7 @@ package yugecin.opsudance.core.state;
import itdelatrisu.opsu.Options; import itdelatrisu.opsu.Options;
import itdelatrisu.opsu.Utils; import itdelatrisu.opsu.Utils;
import itdelatrisu.opsu.states.Game; import itdelatrisu.opsu.states.Game;
import itdelatrisu.opsu.ui.UI;
import org.newdawn.slick.Graphics; import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input; import org.newdawn.slick.Input;
import yugecin.opsudance.core.DisplayContainer; import yugecin.opsudance.core.DisplayContainer;
@ -114,6 +115,10 @@ public abstract class BaseOpsuState implements OpsuState, EventListener<Resoluti
@Override @Override
public boolean mouseWheelMoved(int delta) { public boolean mouseWheelMoved(int delta) {
if (displayContainer.input.isKeyDown(Input.KEY_LALT) || displayContainer.input.isKeyDown(Input.KEY_RALT)) {
UI.changeVolume((delta < 0) ? -1 : 1);
return true;
}
return false; return false;
} }

View File

@ -63,6 +63,9 @@ public abstract class ComplexOpsuState extends BaseOpsuState {
@Override @Override
public boolean mouseWheelMoved(int delta) { public boolean mouseWheelMoved(int delta) {
if (super.mouseWheelMoved(delta)) {
return true;
}
for (OverlayOpsuState overlay : overlays) { for (OverlayOpsuState overlay : overlays) {
if (overlay.mouseWheelMoved(delta)) { if (overlay.mouseWheelMoved(delta)) {
return true; return true;