Button peut maintenant prendre les inputs du clavier même s'il n'y a pas de manette branchée !
This commit is contained in:
parent
33375d4680
commit
9ea45e793a
@ -230,6 +230,7 @@ public class Engine {
|
||||
obj1,
|
||||
obj2,
|
||||
this);
|
||||
this.cameraTrackingBetweenTwoObjectGl();
|
||||
}
|
||||
|
||||
public void cameraTrackingBetweenTwoObjectGl(){
|
||||
|
@ -98,6 +98,8 @@ public class TestEngine {
|
||||
if (Joystick1Present){
|
||||
gamepad1 = new GamepadInput(GLFW_JOYSTICK_1);
|
||||
gamepad1.inputRefresh();
|
||||
}
|
||||
|
||||
List<Integer> listZoomPlus = new ArrayList<>();
|
||||
listZoomPlus.add(InputConst.buttonA);
|
||||
List<Integer> listZoomMinusKeyboard = new ArrayList<>();
|
||||
@ -108,8 +110,6 @@ public class TestEngine {
|
||||
listZoomPlusKeyboard.add(GLFW_KEY_F);
|
||||
zoom = new Button("zoom", listZoomPlus, listZoomPlusKeyboard, gamepad1);
|
||||
dezoom = new Button("dezoom", listZoomMinus, listZoomMinusKeyboard, gamepad1);
|
||||
}
|
||||
|
||||
engine.translateView(new Vector3f(0.0f, -125.0f, 0.0f));
|
||||
|
||||
while (engine.getRunning()) {
|
||||
@ -118,6 +118,7 @@ public class TestEngine {
|
||||
|
||||
if (Joystick1Present) {
|
||||
gamepad1.inputRefresh();
|
||||
}
|
||||
// Check si le personnage a sauté
|
||||
if (zoom.isButtonPressed()){
|
||||
// Le personnage saute
|
||||
@ -125,7 +126,6 @@ public class TestEngine {
|
||||
}if(dezoom.isButtonPressed()){
|
||||
engine.getCamera().zoom(0.999f);
|
||||
}
|
||||
}
|
||||
|
||||
// engine.cameraTrackingObjectGl(zangief, -250.0f);
|
||||
engine.cameraTrackingBetweenTwoObjectGl();
|
||||
|
@ -21,9 +21,12 @@ public class Button {
|
||||
}
|
||||
|
||||
public boolean isButtonPressed(){
|
||||
if (controller != null){
|
||||
for (int i : buttonsGamepad){
|
||||
if (controller.checkPressed(i)) return true;
|
||||
} for (int i : buttonsKeyboard){
|
||||
}
|
||||
}
|
||||
for (int i : buttonsKeyboard){
|
||||
if (glfwGetKey(Engine.getWindow(), i) == 1) return true;
|
||||
}
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user