mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 00:29:50 -04:00
Add GamepadButton.java
This commit is contained in:
parent
91c04a15c3
commit
1d63e30e6c
@ -0,0 +1,26 @@
|
|||||||
|
package net.kdt.pojavlaunch.customcontrols.gamepad;
|
||||||
|
|
||||||
|
import android.view.KeyEvent;
|
||||||
|
|
||||||
|
public class GamepadButton {
|
||||||
|
|
||||||
|
/*
|
||||||
|
Just a simple button, that auto deal with the great habit from android to just SPAAAM input events
|
||||||
|
*/
|
||||||
|
public int[] keycodes;
|
||||||
|
private boolean isDown = false;
|
||||||
|
|
||||||
|
public void update(KeyEvent event){
|
||||||
|
boolean down = (event.getAction() == KeyEvent.ACTION_DOWN);
|
||||||
|
if(down != isDown){
|
||||||
|
isDown = down;
|
||||||
|
Gamepad.sendInput(keycodes, isDown);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetButtonState(){
|
||||||
|
isDown = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user