Added fullscreen support to Engine
This commit is contained in:
@ -28,6 +28,7 @@ public class Engine {
|
||||
|
||||
private final int width;
|
||||
private final int height;
|
||||
private final boolean fullscreen;
|
||||
|
||||
private float viewXPos;
|
||||
private float viewYPos;
|
||||
@ -45,7 +46,7 @@ public class Engine {
|
||||
* Initial projection is -1000;1000 in width and -1000*aspectRatio; 1000*aspectRatio
|
||||
* Initial Camera position is (0, 0, -1) //TODO vérifiez
|
||||
*/
|
||||
public Engine(int width, int height, Vector3f aspectRatio) {
|
||||
public Engine(int width, int height, boolean fullscreen, Vector3f aspectRatio) {
|
||||
this.running = false;
|
||||
this.objectsGl = new ArrayList<>();
|
||||
this.uiElements = new ArrayList<>();
|
||||
@ -57,6 +58,7 @@ public class Engine {
|
||||
ObjectGl.view = Matrix4f.translate(new Vector3f(0.0f, 0.0f, 1.0f));
|
||||
this.transformationView = new Vector3f();
|
||||
this.tracking = null;
|
||||
this.fullscreen = fullscreen;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -79,7 +81,11 @@ public class Engine {
|
||||
|
||||
int width = this.width;
|
||||
int height = this.height;
|
||||
this.setWindow(glfwCreateWindow(width, height, "Boulevard Combattant", NULL, NULL));
|
||||
if (fullscreen) {
|
||||
this.setWindow(glfwCreateWindow(width, height, "Boulevard Combattant", glfwGetPrimaryMonitor(), NULL));
|
||||
} else {
|
||||
this.setWindow(glfwCreateWindow(width, height, "Boulevard Combattant", NULL, NULL));
|
||||
}
|
||||
assert getWindow() != NULL;
|
||||
|
||||
// On récupère les informations du moniteur principal
|
||||
|
@ -36,7 +36,7 @@ public class TestEngine {
|
||||
/*
|
||||
Engine Init
|
||||
*/
|
||||
Engine engine = new Engine(1280, 720, new Vector3f(4.0f, 3.0f));
|
||||
Engine engine = new Engine(1280, 720, false, new Vector3f(4.0f, 3.0f));
|
||||
int speed = 10; //vitesse d<>placement Object
|
||||
engine.init();
|
||||
|
||||
|
Reference in New Issue
Block a user