From b5319de9406cbf33a722adb4cf41b29a24b74a92 Mon Sep 17 00:00:00 2001 From: Antoine Date: Wed, 2 Jun 2021 17:30:43 +0200 Subject: [PATCH] Petite correction invoke in GLFWFramebufferSizeCallback --- src/engine/Engine.java | 20 ++++++++++---------- src/engine/math/Vector3f.java | 1 + 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/engine/Engine.java b/src/engine/Engine.java index 865c3fa..9f78bb7 100644 --- a/src/engine/Engine.java +++ b/src/engine/Engine.java @@ -5,7 +5,6 @@ import engine.math.*; import engine.object.*; import engine.sound.*; - import org.lwjgl.glfw.GLFWFramebufferSizeCallback; import org.lwjgl.glfw.GLFWVidMode; import org.lwjgl.opengl.GL; @@ -64,7 +63,7 @@ public class Engine { assert getWindow() != NULL; boolean present = glfwJoystickPresent(GLFW_JOYSTICK_1); - System.out.println("Manette détectée : " + present); + System.out.println("Manette détectée : " + present); // On récupère les informations du moniteur principal GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor()); @@ -153,14 +152,14 @@ public class Engine { } /** - * Est appelé àa chaque modification de la taille de la fenêtre, et modifie la taille de la zone de rendu + * Est appelé à chaque modification de la taille de la fenêtre, et modifie la taille de la zone de rendu * pour quelle corresponde à la taille de la fenêtre */ private static final GLFWFramebufferSizeCallback resizeWindow = new GLFWFramebufferSizeCallback() { @Override public void invoke(long window, int width, int height) { int heightViewport, widthViewport, x, y; - if (width >= height){ + if (width >= height * 4.0f/3.0f){ heightViewport = height; widthViewport = (int) (height * 4.0f/3.0f); y = 0; @@ -173,6 +172,7 @@ public class Engine { } glScissor(x, y, widthViewport, heightViewport); glViewport(x, y, widthViewport, heightViewport); + } }; @@ -198,7 +198,7 @@ public class Engine { Engine Init */ Engine engine = new Engine(800, 600, 3.0f / 4.0f); - int speed = 10; //vitesse déplacement Object + int speed = 10; //vitesse d�placement Object engine.init(); // Add objects to render @@ -225,7 +225,7 @@ public class Engine { boolean Joystick1Present = glfwJoystickPresent(GLFW_JOYSTICK_1); /* - * Création des manettes / action + * Cr�ation des manettes / action */ GamepadInput gamepad1 = null; @@ -251,17 +251,17 @@ public class Engine { if (Joystick1Present) { gamepad1.inputRefresh(); - System.out.println(gamepad1.getAxisDiscreet(GLFW_GAMEPAD_AXIS_LEFT_X)); +// System.out.println(gamepad1.getAxisDiscreet(GLFW_GAMEPAD_AXIS_LEFT_X)); - // Check si le personnage a sauté + // Check si le personnage a sauté if (jump.isButtonPressed()){ // Le personnage saute System.out.println(" JE SAUTE "); } } -// Input.keyboardInput(zangief, speed); -// input(smiley2, speed); + KeyboardInput.keyboardInput(zangief, speed); +// input(smiley2, speed); //Code pas à jour /* ******************** diff --git a/src/engine/math/Vector3f.java b/src/engine/math/Vector3f.java index 4f81fee..37cf4de 100644 --- a/src/engine/math/Vector3f.java +++ b/src/engine/math/Vector3f.java @@ -13,6 +13,7 @@ public class Vector3f { public Vector3f(float x, float y){ this.x = x; this.y = y; + this.z = 0.0f; } public Vector3f(float x, float y, float z){