Added fullscreen support to Engine
This commit is contained in:
parent
a9ef37eeaf
commit
058ee337ca
@ -28,6 +28,7 @@ public class Engine {
|
|||||||
|
|
||||||
private final int width;
|
private final int width;
|
||||||
private final int height;
|
private final int height;
|
||||||
|
private final boolean fullscreen;
|
||||||
|
|
||||||
private float viewXPos;
|
private float viewXPos;
|
||||||
private float viewYPos;
|
private float viewYPos;
|
||||||
@ -45,7 +46,7 @@ public class Engine {
|
|||||||
* Initial projection is -1000;1000 in width and -1000*aspectRatio; 1000*aspectRatio
|
* Initial projection is -1000;1000 in width and -1000*aspectRatio; 1000*aspectRatio
|
||||||
* Initial Camera position is (0, 0, -1) //TODO vérifiez
|
* 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.running = false;
|
||||||
this.objectsGl = new ArrayList<>();
|
this.objectsGl = new ArrayList<>();
|
||||||
this.uiElements = 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));
|
ObjectGl.view = Matrix4f.translate(new Vector3f(0.0f, 0.0f, 1.0f));
|
||||||
this.transformationView = new Vector3f();
|
this.transformationView = new Vector3f();
|
||||||
this.tracking = null;
|
this.tracking = null;
|
||||||
|
this.fullscreen = fullscreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -79,7 +81,11 @@ public class Engine {
|
|||||||
|
|
||||||
int width = this.width;
|
int width = this.width;
|
||||||
int height = this.height;
|
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;
|
assert getWindow() != NULL;
|
||||||
|
|
||||||
// On récupère les informations du moniteur principal
|
// On récupère les informations du moniteur principal
|
||||||
|
@ -36,7 +36,7 @@ public class TestEngine {
|
|||||||
/*
|
/*
|
||||||
Engine Init
|
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<EFBFBD>placement Object
|
int speed = 10; //vitesse d<EFBFBD>placement Object
|
||||||
engine.init();
|
engine.init();
|
||||||
|
|
||||||
|
@ -748,7 +748,7 @@ public class BlueBaseFrames {
|
|||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Engine engine = new Engine(640, 480, new Vector3f(4.0f, 3.0f));
|
Engine engine = new Engine(640, 480, false, new Vector3f(4.0f, 3.0f));
|
||||||
engine.init();
|
engine.init();
|
||||||
|
|
||||||
Vector3f BLUE = new Vector3f(0f,0f,1f); //passive_hit
|
Vector3f BLUE = new Vector3f(0f,0f,1f); //passive_hit
|
||||||
|
@ -94,8 +94,13 @@ public class match {
|
|||||||
private static Engine engine;
|
private static Engine engine;
|
||||||
private static Frame f;
|
private static Frame f;
|
||||||
private static int acCode = 0;
|
private static int acCode = 0;
|
||||||
private static int height, width;
|
private static boolean roundP1=false;
|
||||||
private static boolean roundP1=false ;
|
|
||||||
|
// Settings
|
||||||
|
private static int height, width, rounds;
|
||||||
|
private static String character1, character2, stage;
|
||||||
|
private static boolean fullscreen;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts a new round, by placing the timer back at base value, characters back at full hp and such.
|
* Starts a new round, by placing the timer back at base value, characters back at full hp and such.
|
||||||
@ -154,6 +159,11 @@ public class match {
|
|||||||
|
|
||||||
height = Integer.parseInt((String) settings.get("height"));
|
height = Integer.parseInt((String) settings.get("height"));
|
||||||
width = Integer.parseInt((String) settings.get("width"));
|
width = Integer.parseInt((String) settings.get("width"));
|
||||||
|
fullscreen = Boolean.parseBoolean((String) settings.get("fullscreen"));
|
||||||
|
rounds = Integer.parseInt((String) settings.get("rounds"));
|
||||||
|
character1 = (String) settings.get("character1");
|
||||||
|
character2 = (String) settings.get("character2");
|
||||||
|
stage = (String) settings.get("stage");
|
||||||
} catch (ParseException | IOException e) {
|
} catch (ParseException | IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -161,7 +171,7 @@ public class match {
|
|||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
parse();
|
parse();
|
||||||
engine = new Engine(width, height, new Vector3f(4.0f, 3.0f));
|
engine = new Engine(width, height, fullscreen, new Vector3f(4.0f, 3.0f));
|
||||||
engine.init();
|
engine.init();
|
||||||
|
|
||||||
boolean Joystick1Present = glfwJoystickPresent(GLFW_JOYSTICK_1);
|
boolean Joystick1Present = glfwJoystickPresent(GLFW_JOYSTICK_1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user