package engine.input; import engine.Engine; import java.util.List; import static org.lwjgl.glfw.GLFW.glfwGetKey; public class Button { public String name; private final List buttonsGamepad; private final List buttonsKeyboard; private final GamepadInput controller; public Button(String name, List buttonsGamepad, List buttonsKeyboard, GamepadInput controller){ this.name = name; this.buttonsGamepad = buttonsGamepad; this.buttonsKeyboard = buttonsKeyboard; this.controller = controller; } public boolean isButtonPressed(){ for (int i : buttonsGamepad){ if (controller.checkPressed(i)) return true; } for (int i : buttonsKeyboard){ if (glfwGetKey(Engine.getWindow(), i) == 1) return true; } return false; } }