Gamebutton is more flexible now

This commit is contained in:
SerpentSpirale 2021-05-20 15:43:15 +02:00
parent ddb2307a3d
commit 3c1bb45f57

View File

@ -11,12 +11,15 @@ public class GamepadButton {
private boolean isDown = false; private boolean isDown = false;
public void update(KeyEvent event){ public void update(KeyEvent event){
boolean down = (event.getAction() == KeyEvent.ACTION_DOWN); boolean isKeyDown = (event.getAction() == KeyEvent.ACTION_DOWN);
if(down != isDown){ update(isKeyDown);
isDown = down;
Gamepad.sendInput(keycodes, isDown);
} }
public void update(boolean isKeyDown){
if(isKeyDown != isDown){
isDown = isKeyDown;
Gamepad.sendInput(keycodes, isDown);
}
} }
public void resetButtonState(){ public void resetButtonState(){