Les manettes devraient maintenant être detectées dans main -> match.java
This commit is contained in:
parent
913adb8d92
commit
e2586cbcd2
@ -82,9 +82,6 @@ public class Engine {
|
|||||||
this.setWindow(glfwCreateWindow(width, height, "Boulevard Combattant", NULL, NULL));
|
this.setWindow(glfwCreateWindow(width, height, "Boulevard Combattant", NULL, NULL));
|
||||||
assert getWindow() != NULL;
|
assert getWindow() != NULL;
|
||||||
|
|
||||||
boolean present = glfwJoystickPresent(GLFW_JOYSTICK_1);
|
|
||||||
System.out.println("Manette détectée: " + present);
|
|
||||||
|
|
||||||
// On récupère les informations du moniteur principal
|
// On récupère les informations du moniteur principal
|
||||||
GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor());
|
GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor());
|
||||||
assert vidmode != null;
|
assert vidmode != null;
|
||||||
|
@ -95,73 +95,13 @@ public class match {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
/*
|
|
||||||
Engine engine = new Engine(800, 600, 3.0f / 4.0f);
|
|
||||||
engine.init();
|
|
||||||
|
|
||||||
String path = "textures/zangief_sprite.png";
|
|
||||||
|
|
||||||
ObjectGl zangief = new ObjectGl(0f, 60f, 80f, 10f, path, null);
|
|
||||||
zangief.setTextureWrap(58, 0, 62, 84, ObjectGl.STICK_TOP);
|
|
||||||
engine.add_objectGl(zangief);
|
|
||||||
|
|
||||||
long timer = System.currentTimeMillis();
|
|
||||||
long lastFrame;
|
|
||||||
int frame = 0;
|
|
||||||
boolean nextFrame = false;
|
|
||||||
boolean Joystick1Present = glfwJoystickPresent(GLFW_JOYSTICK_1);
|
|
||||||
|
|
||||||
GamepadInput gamepad1 = null;
|
|
||||||
ButtonIG jump = null;
|
|
||||||
|
|
||||||
if (Joystick1Present) {
|
|
||||||
gamepad1 = new GamepadInput(GLFW_JOYSTICK_1);
|
|
||||||
gamepad1.inputRefresh();
|
|
||||||
List<Integer> listJump = new ArrayList<>();
|
|
||||||
listJump.add(InputConst.buttonA);
|
|
||||||
jump = new ButtonIG("jump", listJump, gamepad1);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (engine.isRunning()) {
|
|
||||||
lastFrame = System.currentTimeMillis();
|
|
||||||
// Game logic should fit here
|
|
||||||
|
|
||||||
if (Joystick1Present) {
|
|
||||||
gamepad1.inputRefresh();
|
|
||||||
|
|
||||||
System.out.println(gamepad1.getAxisDiscreet(GLFW_GAMEPAD_AXIS_LEFT_X));
|
|
||||||
|
|
||||||
// Check si le personnage a sauté
|
|
||||||
if (jump.isButtonPressed()) {
|
|
||||||
// Le personnage saute
|
|
||||||
System.out.println(" JE SAUTE ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
engine.update();
|
|
||||||
engine.render();
|
|
||||||
|
|
||||||
frame++;
|
|
||||||
|
|
||||||
if (System.currentTimeMillis() - timer > 1000) {
|
|
||||||
timer += 1000;
|
|
||||||
System.out.println("FPS: " + frame);
|
|
||||||
frame = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (!nextFrame) {
|
|
||||||
nextFrame = System.currentTimeMillis() - lastFrame >= 16.66f;
|
|
||||||
}
|
|
||||||
|
|
||||||
nextFrame = false;
|
|
||||||
if (engine.shouldClose()) engine.setRunning(false);
|
|
||||||
} */
|
|
||||||
boolean Joystick1Present = glfwJoystickPresent(GLFW_JOYSTICK_1);
|
|
||||||
boolean Joystick2Present = glfwJoystickPresent(GLFW_JOYSTICK_2);
|
|
||||||
|
|
||||||
engine = new Engine(640, 480, new Vector3f(4.0f, 3.0f));
|
engine = new Engine(640, 480, new Vector3f(4.0f, 3.0f));
|
||||||
engine.init();
|
engine.init();
|
||||||
|
|
||||||
|
boolean Joystick1Present = glfwJoystickPresent(GLFW_JOYSTICK_1);
|
||||||
|
boolean Joystick2Present = glfwJoystickPresent(GLFW_JOYSTICK_2);
|
||||||
|
System.out.println(Joystick1Present);
|
||||||
|
|
||||||
String path = "textures/Sprite.png";
|
String path = "textures/Sprite.png";
|
||||||
String pathToBG = "textures/background_beach.png";
|
String pathToBG = "textures/background_beach.png";
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user