This commit is contained in:
keizaal 2021-06-23 17:07:41 +02:00
commit 30b227d883
4 changed files with 58 additions and 13 deletions

View File

@ -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

View File

@ -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<EFBFBD>placement Object
engine.init();

View File

@ -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

View File

@ -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);