mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
add KeyBinding ispressed condition
This commit is contained in:
@@ -380,23 +380,18 @@ public class UIScene extends Scene {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!textboxOpen){
|
if(!textboxOpen){
|
||||||
if (stage.getKeyboardFocus() instanceof TextField) {
|
if (KeyBinding.Down.isPressed(keycode, !(stage.getKeyboardFocus() instanceof TextField))
|
||||||
if (Input.Keys.S != keycode && KeyBinding.Down.isPressed(keycode))
|
|| KeyBinding.Down.isPressed(keycode,Input.Keys.S != keycode))
|
||||||
selectNextDown();
|
selectNextDown();
|
||||||
if (Input.Keys.W != keycode && KeyBinding.Up.isPressed(keycode))
|
if (KeyBinding.Up.isPressed(keycode, !(stage.getKeyboardFocus() instanceof TextField))
|
||||||
selectNextUp();
|
|| KeyBinding.Up.isPressed(keycode,Input.Keys.W != keycode))
|
||||||
} else {
|
selectNextUp();
|
||||||
if (KeyBinding.Down.isPressed(keycode))
|
if (KeyBinding.Right.isPressed(keycode, !(stage.getKeyboardFocus() instanceof Selector)
|
||||||
selectNextDown();
|
&& !(stage.getKeyboardFocus() instanceof TextField) && !(stage.getKeyboardFocus() instanceof Slider)))
|
||||||
if (KeyBinding.Up.isPressed(keycode))
|
selectNextRight();
|
||||||
selectNextUp();
|
if (KeyBinding.Left.isPressed(keycode, !(stage.getKeyboardFocus() instanceof Selector)
|
||||||
}
|
&& !(stage.getKeyboardFocus() instanceof TextField) && !(stage.getKeyboardFocus() instanceof Slider)))
|
||||||
if (!(stage.getKeyboardFocus() instanceof Selector) && !(stage.getKeyboardFocus() instanceof TextField) && !(stage.getKeyboardFocus() instanceof Slider)) {
|
selectNextLeft();
|
||||||
if (KeyBinding.Right.isPressed(keycode))
|
|
||||||
selectNextRight();
|
|
||||||
if (KeyBinding.Left.isPressed(keycode))
|
|
||||||
selectNextLeft();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!dialogShowing()) {
|
if (!dialogShowing()) {
|
||||||
Button pressedButton = ui.buttonPressed(keycode);
|
Button pressedButton = ui.buttonPressed(keycode);
|
||||||
|
|||||||
@@ -34,9 +34,15 @@ public enum KeyBinding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPressed(int key) {
|
public boolean isPressed(int key) {
|
||||||
for (int i = 0; i < bindings.length; i++) {
|
return isPressed(key, null);
|
||||||
if (key == bindings[i]) {
|
}
|
||||||
return true;
|
|
||||||
|
public boolean isPressed(int key, Boolean requiredCondition) {
|
||||||
|
if (requiredCondition == null || requiredCondition) {
|
||||||
|
for (int i = 0; i < bindings.length; i++) {
|
||||||
|
if (key == bindings[i]) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user