diff --git a/src/engine/Engine.java b/src/engine/Engine.java index c6c3ceb..f6bc7d6 100644 --- a/src/engine/Engine.java +++ b/src/engine/Engine.java @@ -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 diff --git a/src/engine/TestEngine.java b/src/engine/TestEngine.java index 61b98cc..1a41792 100644 --- a/src/engine/TestEngine.java +++ b/src/engine/TestEngine.java @@ -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(); diff --git a/src/gameplay/Characters/Blue/BlueBaseFrames.java b/src/gameplay/Characters/Blue/BlueBaseFrames.java index a7c4986..f97d2fa 100644 --- a/src/gameplay/Characters/Blue/BlueBaseFrames.java +++ b/src/gameplay/Characters/Blue/BlueBaseFrames.java @@ -1009,7 +1009,7 @@ public class BlueBaseFrames { } 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(); Vector3f BLUE = new Vector3f(0f,0f,1f); //passive_hit diff --git a/src/gameplay/match/match.java b/src/gameplay/match/match.java index 5213723..da0d8f8 100644 --- a/src/gameplay/match/match.java +++ b/src/gameplay/match/match.java @@ -94,8 +94,13 @@ public class match { private static Engine engine; private static Frame f; 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. @@ -154,6 +159,11 @@ public class match { height = Integer.parseInt((String) settings.get("height")); 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) { e.printStackTrace(); } @@ -161,24 +171,53 @@ public class match { public static void main(String[] args) throws Exception { 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(); boolean Joystick1Present = glfwJoystickPresent(GLFW_JOYSTICK_1); boolean Joystick2Present = glfwJoystickPresent(GLFW_JOYSTICK_2); - String path = "textures/Sprite_sans_grille_9comp.png"; - String pathToBG = "textures/arena1.png"; + String pathToBG = ""; + switch (stage) { + case "arena1": + pathToBG = "textures/arena1.png"; + break; + default: + pathToBG = "textures/arena1.png"; + } ObjectGl background = new ObjectGl(0f,1f,1f,2.5f, pathToBG, null); background.setTextureWrap(0, 0, 1914f, 701f); background.translate(new Vector3f(-1350f, 1000f, 0f)); engine.add_objectGl(background); - p1 = CharacterBlue.generateCharBlue(); - p2 = CharacterBlue.generateCharBlue(); - objP1 = new Sprite(14f, 5f, path, null); - objP2 = new Sprite(15f, 5f, path, new Vector3f(1.0f,0.0f,1.0f)); + String pathp1 = ""; + String pathp2 = ""; + + switch (character1) { + case "blue": + p1 = CharacterBlue.generateCharBlue(); + pathp1 = "textures/Sprite_sans_grille_9comp.png"; + break; + default: + p1 = CharacterBlue.generateCharBlue(); + pathp1 = "textures/Sprite_sans_grille_9comp.png"; + break; + } + + switch (character2) { + case "blue": + p2 = CharacterBlue.generateCharBlue(); + pathp2 = "textures/Sprite_sans_grille_9comp.png"; + break; + default: + p2 = CharacterBlue.generateCharBlue(); + pathp2 = "textures/Sprite_sans_grille_9comp.png"; + break; + } + + objP1 = new Sprite(14f, 5f, pathp1, null); + objP2 = new Sprite(15f, 5f, pathp2, new Vector3f(1.0f,0.0f,1.0f)); engine.add_objectGl(objP1); engine.add_objectGl(objP2);