mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 08:35:37 -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
|
Just a simple button, that auto deal with the great habit from android to just SPAAAM input events
|
||||||
*/
|
*/
|
||||||
public int[] keycodes;
|
public int[] keycodes;
|
||||||
|
public boolean isToggleable = false;
|
||||||
private boolean isDown = false;
|
private boolean isDown = false;
|
||||||
|
private boolean toggled = false;
|
||||||
|
|
||||||
public void update(KeyEvent event){
|
public void update(KeyEvent event){
|
||||||
boolean isKeyDown = (event.getAction() == KeyEvent.ACTION_DOWN);
|
boolean isKeyDown = (event.getAction() == KeyEvent.ACTION_DOWN);
|
||||||
@ -18,6 +20,14 @@ public class GamepadButton {
|
|||||||
public void update(boolean isKeyDown){
|
public void update(boolean isKeyDown){
|
||||||
if(isKeyDown != isDown){
|
if(isKeyDown != isDown){
|
||||||
isDown = isKeyDown;
|
isDown = isKeyDown;
|
||||||
|
if(isToggleable){
|
||||||
|
if(isKeyDown){
|
||||||
|
toggled = !toggled;
|
||||||
|
Gamepad.sendInput(keycodes, toggled);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Gamepad.sendInput(keycodes, isDown);
|
Gamepad.sendInput(keycodes, isDown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user