Petite correction invoke in GLFWFramebufferSizeCallback
This commit is contained in:
parent
80ab5fb99b
commit
b5319de940
@ -5,7 +5,6 @@ import engine.math.*;
|
|||||||
import engine.object.*;
|
import engine.object.*;
|
||||||
import engine.sound.*;
|
import engine.sound.*;
|
||||||
|
|
||||||
|
|
||||||
import org.lwjgl.glfw.GLFWFramebufferSizeCallback;
|
import org.lwjgl.glfw.GLFWFramebufferSizeCallback;
|
||||||
import org.lwjgl.glfw.GLFWVidMode;
|
import org.lwjgl.glfw.GLFWVidMode;
|
||||||
import org.lwjgl.opengl.GL;
|
import org.lwjgl.opengl.GL;
|
||||||
@ -64,7 +63,7 @@ public class Engine {
|
|||||||
assert getWindow() != NULL;
|
assert getWindow() != NULL;
|
||||||
|
|
||||||
boolean present = glfwJoystickPresent(GLFW_JOYSTICK_1);
|
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
|
// On récupère les informations du moniteur principal
|
||||||
GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor());
|
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
|
* pour quelle corresponde à la taille de la fenêtre
|
||||||
*/
|
*/
|
||||||
private static final GLFWFramebufferSizeCallback resizeWindow = new GLFWFramebufferSizeCallback() {
|
private static final GLFWFramebufferSizeCallback resizeWindow = new GLFWFramebufferSizeCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void invoke(long window, int width, int height) {
|
public void invoke(long window, int width, int height) {
|
||||||
int heightViewport, widthViewport, x, y;
|
int heightViewport, widthViewport, x, y;
|
||||||
if (width >= height){
|
if (width >= height * 4.0f/3.0f){
|
||||||
heightViewport = height;
|
heightViewport = height;
|
||||||
widthViewport = (int) (height * 4.0f/3.0f);
|
widthViewport = (int) (height * 4.0f/3.0f);
|
||||||
y = 0;
|
y = 0;
|
||||||
@ -173,6 +172,7 @@ public class Engine {
|
|||||||
}
|
}
|
||||||
glScissor(x, y, widthViewport, heightViewport);
|
glScissor(x, y, widthViewport, heightViewport);
|
||||||
glViewport(x, y, widthViewport, heightViewport);
|
glViewport(x, y, widthViewport, heightViewport);
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ public class Engine {
|
|||||||
Engine Init
|
Engine Init
|
||||||
*/
|
*/
|
||||||
Engine engine = new Engine(800, 600, 3.0f / 4.0f);
|
Engine engine = new Engine(800, 600, 3.0f / 4.0f);
|
||||||
int speed = 10; //vitesse déplacement Object
|
int speed = 10; //vitesse d<EFBFBD>placement Object
|
||||||
engine.init();
|
engine.init();
|
||||||
|
|
||||||
// Add objects to render
|
// Add objects to render
|
||||||
@ -225,7 +225,7 @@ public class Engine {
|
|||||||
boolean Joystick1Present = glfwJoystickPresent(GLFW_JOYSTICK_1);
|
boolean Joystick1Present = glfwJoystickPresent(GLFW_JOYSTICK_1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Création des manettes / action
|
* Cr<EFBFBD>ation des manettes / action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
GamepadInput gamepad1 = null;
|
GamepadInput gamepad1 = null;
|
||||||
@ -251,17 +251,17 @@ public class Engine {
|
|||||||
if (Joystick1Present) {
|
if (Joystick1Present) {
|
||||||
gamepad1.inputRefresh();
|
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()){
|
if (jump.isButtonPressed()){
|
||||||
// Le personnage saute
|
// Le personnage saute
|
||||||
System.out.println(" JE SAUTE ");
|
System.out.println(" JE SAUTE ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Input.keyboardInput(zangief, speed);
|
KeyboardInput.keyboardInput(zangief, speed);
|
||||||
// input(smiley2, speed);
|
// input(smiley2, speed); //Code pas à jour
|
||||||
|
|
||||||
/*
|
/*
|
||||||
********************
|
********************
|
||||||
|
@ -13,6 +13,7 @@ public class Vector3f {
|
|||||||
public Vector3f(float x, float y){
|
public Vector3f(float x, float y){
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
|
this.z = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector3f(float x, float y, float z){
|
public Vector3f(float x, float y, float z){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user