mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-16 08:05:34 -04:00
Any gameButton can be toogled if needed now
This commit is contained in:
parent
28725743fa
commit
b86de4db95
@ -8,7 +8,9 @@ public class GamepadButton {
|
||||
Just a simple button, that auto deal with the great habit from android to just SPAAAM input events
|
||||
*/
|
||||
public int[] keycodes;
|
||||
public boolean isToggleable = false;
|
||||
private boolean isDown = false;
|
||||
private boolean toggled = false;
|
||||
|
||||
public void update(KeyEvent event){
|
||||
boolean isKeyDown = (event.getAction() == KeyEvent.ACTION_DOWN);
|
||||
@ -18,6 +20,14 @@ public class GamepadButton {
|
||||
public void update(boolean isKeyDown){
|
||||
if(isKeyDown != isDown){
|
||||
isDown = isKeyDown;
|
||||
if(isToggleable){
|
||||
if(isKeyDown){
|
||||
toggled = !toggled;
|
||||
Gamepad.sendInput(keycodes, toggled);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Gamepad.sendInput(keycodes, isDown);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user