Merge branch 'master' of https://gitlab.istic.univ-rennes1.fr/fautin/jeu-de-combat
This commit is contained in:
commit
621c2222c0
@ -1,5 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
|
<classpathentry kind="src" output="target/classes" path="src">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src">
|
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
|
8
pom.xml
8
pom.xml
@ -17,14 +17,6 @@
|
|||||||
|
|
||||||
<sourceDirectory>src</sourceDirectory>
|
<sourceDirectory>src</sourceDirectory>
|
||||||
|
|
||||||
<resources>
|
|
||||||
|
|
||||||
<resource>
|
|
||||||
<directory>src/launcher/ui</directory>
|
|
||||||
</resource>
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
|
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
|
@ -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;
|
||||||
@ -28,6 +27,8 @@ public class Engine {
|
|||||||
private final int width;
|
private final int width;
|
||||||
private final int height;
|
private final int height;
|
||||||
|
|
||||||
|
private float viewXPos;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the engine and initial attributes use .init() to start the engine
|
* Create the engine and initial attributes use .init() to start the engine
|
||||||
*/
|
*/
|
||||||
@ -38,6 +39,7 @@ public class Engine {
|
|||||||
this.height = height;
|
this.height = height;
|
||||||
ObjectGl.projection = Matrix4f.orthographic(-1000, 1000, -1000 * aspectRatio, 1000 * aspectRatio, 0.1f, 100.0f);
|
ObjectGl.projection = Matrix4f.orthographic(-1000, 1000, -1000 * aspectRatio, 1000 * aspectRatio, 0.1f, 100.0f);
|
||||||
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.viewXPos = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -62,7 +64,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());
|
||||||
@ -79,6 +81,8 @@ public class Engine {
|
|||||||
glfwShowWindow(getWindow());
|
glfwShowWindow(getWindow());
|
||||||
GL.createCapabilities();
|
GL.createCapabilities();
|
||||||
|
|
||||||
|
correctViewport(this.width, this.height);
|
||||||
|
|
||||||
glfwSetFramebufferSizeCallback(getWindow(), resizeWindow);
|
glfwSetFramebufferSizeCallback(getWindow(), resizeWindow);
|
||||||
|
|
||||||
glEnable(GL_DEPTH_TEST); // Z-Buffer plus z est grand plus l'objet est proche de la camera limite à 100.0f au dela l'objet disparait
|
glEnable(GL_DEPTH_TEST); // Z-Buffer plus z est grand plus l'objet est proche de la camera limite à 100.0f au dela l'objet disparait
|
||||||
@ -102,6 +106,7 @@ public class Engine {
|
|||||||
*/
|
*/
|
||||||
public void render() {
|
public void render() {
|
||||||
|
|
||||||
|
glEnable(GL_SCISSOR_TEST);
|
||||||
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
|
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
@ -117,7 +122,6 @@ public class Engine {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add obj to the render queue
|
* Add obj to the render queue
|
||||||
*
|
|
||||||
* @param obj ObjectGl to render
|
* @param obj ObjectGl to render
|
||||||
*/
|
*/
|
||||||
public void add_objectGl(ObjectGl obj) {
|
public void add_objectGl(ObjectGl obj) {
|
||||||
@ -128,6 +132,28 @@ public class Engine {
|
|||||||
objectsGl.remove(obj);
|
objectsGl.remove(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void translateView(Vector3f vec){
|
||||||
|
ObjectGl.view = ObjectGl.view.multiply(Matrix4f.translate(vec));
|
||||||
|
viewXPos += vec.x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void correctViewport(int width, int height){
|
||||||
|
int heightViewport, widthViewport, x, y;
|
||||||
|
if (width >= height * 4.0f/3.0f){
|
||||||
|
heightViewport = height;
|
||||||
|
widthViewport = (int) (height * 4.0f/3.0f);
|
||||||
|
y = 0;
|
||||||
|
x = (width - widthViewport)/2;
|
||||||
|
} else {
|
||||||
|
widthViewport = width;
|
||||||
|
heightViewport = (int) (width * 3.0f/4.0f);
|
||||||
|
y = (height - heightViewport)/2;
|
||||||
|
x = 0;
|
||||||
|
}
|
||||||
|
glScissor(x, y, widthViewport, heightViewport);
|
||||||
|
glViewport(x, y, widthViewport, heightViewport);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isRunning() {
|
public boolean isRunning() {
|
||||||
return running;
|
return running;
|
||||||
}
|
}
|
||||||
@ -149,13 +175,13 @@ 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) {
|
||||||
glViewport(0, 0, width, height);
|
correctViewport(width, height);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -180,26 +206,29 @@ public class Engine {
|
|||||||
/*
|
/*
|
||||||
Engine Init
|
Engine Init
|
||||||
*/
|
*/
|
||||||
Engine engine = new Engine(1280, 720, 9.0f / 16.0f);
|
Engine engine = new Engine(1280, 720, 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
|
||||||
String path = "textures/zangief_sprite.png";
|
String path = "textures/zangief_sprite.png";
|
||||||
|
|
||||||
String path2 = "textures/awesomeface.png";
|
String path2 = "textures/awesomeface.png";
|
||||||
|
String pathToBG = "textures/background_beach.png";
|
||||||
|
|
||||||
ObjectGl zangief = new ObjectGl(0f, 60f, 80f, 10f, path, null);
|
ObjectGl zangief = new ObjectGl(10.0f, 1f, 1f, 10f, path, null);
|
||||||
zangief.setTextureWrap(58, 0, 62, 84, ObjectGl.STICK_TOP);
|
zangief.setTextureWrap(58, 0, 62, 84, ObjectGl.DEFAULT);
|
||||||
engine.add_objectGl(zangief);
|
engine.add_objectGl(zangief);
|
||||||
zangief.translate(new Vector3f(-5000.0f, 500.0f, 10.0f));
|
zangief.translate(new Vector3f(-1000.0f, 200.0f, 0.0f));
|
||||||
zangief.setColor(new Vector3f(1.0f, 1.0f, 1.0f));
|
|
||||||
zangief.useTime = true;
|
|
||||||
zangief.setShader("shaders/StylishShaders/BasicVert.glsl", "shaders/StylishShaders/FlashFrag.glsl");
|
|
||||||
|
|
||||||
ObjectGl smiley2 = new ObjectGl(0.0f, 500.0f, 500.0f, 1f, path2, null);
|
ObjectGl smiley2 = new ObjectGl(0.0f, 500.0f, 500.0f, 1f, path2, null);
|
||||||
engine.add_objectGl(smiley2);
|
engine.add_objectGl(smiley2);
|
||||||
smiley2.translate(new Vector3f(0.0f, 0.0f, 5.0f));
|
smiley2.translate(new Vector3f(0.0f, 0.0f, 15.0f));
|
||||||
|
|
||||||
|
//Create background
|
||||||
|
ObjectGl background = new ObjectGl(0f,1f,1f,10f, pathToBG, null);
|
||||||
|
background.setTextureWrap(0,0,621, 224, ObjectGl.DEFAULT);
|
||||||
|
background.translate(new Vector3f(-3011.0f, 1400.0f, 1.0f));
|
||||||
|
engine.add_objectGl(background);
|
||||||
|
|
||||||
long timer = System.currentTimeMillis();
|
long timer = System.currentTimeMillis();
|
||||||
long lastFrame;
|
long lastFrame;
|
||||||
@ -208,7 +237,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;
|
||||||
@ -220,9 +249,6 @@ public class Engine {
|
|||||||
List<Integer> listJump = new ArrayList<>();
|
List<Integer> listJump = new ArrayList<>();
|
||||||
listJump.add(InputConst.buttonA);
|
listJump.add(InputConst.buttonA);
|
||||||
jump = new Button("jump", listJump, gamepad1);
|
jump = new Button("jump", listJump, gamepad1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -233,18 +259,17 @@ public class Engine {
|
|||||||
|
|
||||||
if (Joystick1Present) {
|
if (Joystick1Present) {
|
||||||
gamepad1.inputRefresh();
|
gamepad1.inputRefresh();
|
||||||
|
// Check si le personnage a sauté
|
||||||
System.out.println(gamepad1.getAxisDiscreet(GLFW_GAMEPAD_AXIS_LEFT_X));
|
|
||||||
|
|
||||||
// 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);
|
|
||||||
|
Vector3f vecTransView = new Vector3f((-zangief.getXPos() - engine.viewXPos) - 250.0f,0.0f,0.0f);
|
||||||
|
engine.translateView(vecTransView);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
********************
|
********************
|
||||||
|
@ -94,17 +94,20 @@ public class KeyboardInput extends GLFWKeyCallback {
|
|||||||
keyPressed = true;
|
keyPressed = true;
|
||||||
} else if (KeyboardInput.isKeyDown(GLFW.GLFW_KEY_W)) {
|
} else if (KeyboardInput.isKeyDown(GLFW.GLFW_KEY_W)) {
|
||||||
keyPressed = true;
|
keyPressed = true;
|
||||||
|
token.scale(new Vector3f(1.001f,1.001f,1.0f));
|
||||||
}
|
}
|
||||||
if (KeyboardInput.isKeyDown(GLFW.GLFW_KEY_A)) {
|
if (KeyboardInput.isKeyDown(GLFW.GLFW_KEY_A)) {
|
||||||
token.translate(new Vector3f (speed * -5.0f, 0.0f, 0.0f));
|
token.translate(new Vector3f (speed * -1.0f, 0.0f, 0.0f));
|
||||||
token.setTextureWrap(121,0,57,82, ObjectGl.STICK_TOP);
|
token.setTextureWrap(121,0,57,82, ObjectGl.STICK_TOP);
|
||||||
keyPressed = true;
|
keyPressed = true;
|
||||||
}
|
}
|
||||||
else if (KeyboardInput.isKeyDown(GLFW.GLFW_KEY_D)) {
|
else if (KeyboardInput.isKeyDown(GLFW.GLFW_KEY_D)) {
|
||||||
token.translate(new Vector3f (speed * 5.0f, 0.0f, 0.0f));
|
token.translate(new Vector3f (speed * 1.0f, 0.0f, 0.0f));
|
||||||
token.setTextureWrap(178,0,62,82, ObjectGl.STICK_TOP);
|
token.setTextureWrap(178,0,62,82, ObjectGl.STICK_TOP);
|
||||||
keyPressed = true;
|
keyPressed = true;
|
||||||
}
|
}
|
||||||
if (!keyPressed) token.setTextureWrap(58,0,62,82, ObjectGl.STICK_TOP);
|
if (!keyPressed) token.setTextureWrap(58,0,62,82, ObjectGl.STICK_TOP);
|
||||||
|
|
||||||
|
token.flipTextureWrapH();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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){
|
||||||
|
@ -27,7 +27,15 @@ public class ObjectGl {
|
|||||||
public static Matrix4f projection;
|
public static Matrix4f projection;
|
||||||
public static Matrix4f view;
|
public static Matrix4f view;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xPos and yPos will stop to be relevant if you use rotate function
|
||||||
|
*/
|
||||||
|
private float xPos;
|
||||||
|
private float yPos;
|
||||||
private float zPos;
|
private float zPos;
|
||||||
|
private float xAngle;
|
||||||
|
private float yAngle;
|
||||||
|
private float zAngle;
|
||||||
private float width; // To be used in setTextureWrap
|
private float width; // To be used in setTextureWrap
|
||||||
private float height;
|
private float height;
|
||||||
private float scalingFactor;
|
private float scalingFactor;
|
||||||
@ -35,6 +43,7 @@ public class ObjectGl {
|
|||||||
public boolean useTime;
|
public boolean useTime;
|
||||||
|
|
||||||
private Texture texture;
|
private Texture texture;
|
||||||
|
private float[] textureWrap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a rectangle shape, use setTextureWrap to correctly align the texture with the model
|
* Create a rectangle shape, use setTextureWrap to correctly align the texture with the model
|
||||||
@ -61,15 +70,18 @@ public class ObjectGl {
|
|||||||
this.texture = new Texture(tex, 0);
|
this.texture = new Texture(tex, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.xPos = 0.0f;
|
||||||
|
this.yPos = 0.0f;
|
||||||
this.zPos = z;
|
this.zPos = z;
|
||||||
this.height = h;
|
this.height = h;
|
||||||
this.width = w;
|
this.width = w;
|
||||||
|
|
||||||
|
this.textureWrap = Primitive.stdTexWrap;
|
||||||
this.vertexArray = new VertexArray(Primitive.createRectangle(this.zPos, this.width, this.height), Primitive.rectangle_indices, colorBuffer, Primitive.stdTexWrap);
|
this.vertexArray = new VertexArray(Primitive.createRectangle(this.zPos, this.width, this.height), Primitive.rectangle_indices, colorBuffer, Primitive.stdTexWrap);
|
||||||
|
|
||||||
this.scalingFactor = size;
|
this.scalingFactor = 1;
|
||||||
this.transform = Matrix4f.identity();
|
this.transform = Matrix4f.identity();
|
||||||
this.scale(new Vector3f(size, size,1f));
|
this.scale(new Vector3f(size, size,1.0f));
|
||||||
this.stick_state = DEFAULT;
|
this.stick_state = DEFAULT;
|
||||||
this.useTime = false;
|
this.useTime = false;
|
||||||
|
|
||||||
@ -92,6 +104,9 @@ public class ObjectGl {
|
|||||||
public void resetTransform(){
|
public void resetTransform(){
|
||||||
this.transform = Matrix4f.identity();
|
this.transform = Matrix4f.identity();
|
||||||
this.scalingFactor = 1;
|
this.scalingFactor = 1;
|
||||||
|
this.xPos = 0.0f;
|
||||||
|
this.yPos = 0.0f;
|
||||||
|
this.zPos = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -99,9 +114,11 @@ public class ObjectGl {
|
|||||||
* @param vec Vector3f
|
* @param vec Vector3f
|
||||||
*/
|
*/
|
||||||
public void translate(Vector3f vec){
|
public void translate(Vector3f vec){
|
||||||
|
this.xPos += vec.x;
|
||||||
|
this.yPos += vec.y;
|
||||||
|
this.zPos += vec.z;
|
||||||
vec.divXY(this.scalingFactor);
|
vec.divXY(this.scalingFactor);
|
||||||
this.transform = this.transform.multiply(Matrix4f.translate(vec));
|
this.transform = this.transform.multiply(Matrix4f.translate(vec));
|
||||||
this.zPos += vec.z;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -183,6 +200,19 @@ public class ObjectGl {
|
|||||||
this.setTextureWrap(result);
|
this.setTextureWrap(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the textureWrap left to right
|
||||||
|
*/
|
||||||
|
public void flipTextureWrapH(){
|
||||||
|
float[] textureWrapTemp = new float[] {
|
||||||
|
this.textureWrap[2], this.textureWrap[3],
|
||||||
|
this.textureWrap[0], this.textureWrap[1],
|
||||||
|
this.textureWrap[6], this.textureWrap[7],
|
||||||
|
this.textureWrap[4], this.textureWrap[5]
|
||||||
|
};
|
||||||
|
setTextureWrap(textureWrapTemp);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a new shader to be used by this object
|
* Set a new shader to be used by this object
|
||||||
* @param vert path to glsl Vertex Shader
|
* @param vert path to glsl Vertex Shader
|
||||||
@ -207,9 +237,18 @@ public class ObjectGl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setTextureWrap(float[] texture){
|
private void setTextureWrap(float[] texture){
|
||||||
|
this.textureWrap = texture;
|
||||||
this.vertexArray.swapTextureBufferObject(texture);
|
this.vertexArray.swapTextureBufferObject(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getXPos(){
|
||||||
|
return xPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getYPos(){
|
||||||
|
return yPos;
|
||||||
|
}
|
||||||
|
|
||||||
public float getZPos(){
|
public float getZPos(){
|
||||||
return zPos;
|
return zPos;
|
||||||
}
|
}
|
||||||
|
25
src/launcher/FXMLController.java
Normal file
25
src/launcher/FXMLController.java
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package launcher;
|
||||||
|
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
|
||||||
|
public class FXMLController {
|
||||||
|
|
||||||
|
public FXMLController() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void launch() {
|
||||||
|
Launcher.runGame();
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void settings() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void quit() {
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -13,25 +13,54 @@ import javafx.application.Application;
|
|||||||
import javafx.scene.Parent;
|
import javafx.scene.Parent;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import javafx.stage.StageStyle;
|
|
||||||
import javafx.fxml.*;
|
import javafx.fxml.*;
|
||||||
|
|
||||||
|
import engine.Engine;
|
||||||
|
|
||||||
public class Launcher extends Application {
|
public class Launcher extends Application {
|
||||||
|
|
||||||
|
public static Launcher pointer;
|
||||||
|
private static Settings setter;
|
||||||
|
|
||||||
|
public Launcher() {
|
||||||
|
pointer = this;
|
||||||
|
try {
|
||||||
|
setter = new Settings();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Start method is used by Launcher as an implementation of the Application class to create a JavaFX thread to display the GUI window
|
* Start method is used by Launcher as an implementation of the Application class to create a JavaFX thread to display the GUI window
|
||||||
*/
|
*/
|
||||||
public void start(Stage primaryStage) throws Exception {
|
public void start(Stage primaryStage) throws Exception {
|
||||||
|
|
||||||
Parent root = FXMLLoader.load(getClass().getResource("ui/launcher.fxml"));
|
Parent root = FXMLLoader.load(getClass().getResource("launcher.fxml"));
|
||||||
|
|
||||||
Scene main = new Scene(root);
|
Scene main = new Scene(root);
|
||||||
|
|
||||||
primaryStage.initStyle(StageStyle.UNDECORATED);
|
//primaryStage.initStyle(StageStyle.UNDECORATED);
|
||||||
primaryStage.setTitle("Boulevard Combattant");
|
primaryStage.setTitle("Boulevard Combattant");
|
||||||
primaryStage.setScene(main);
|
primaryStage.setScene(main);
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void runGame() {
|
||||||
|
try {
|
||||||
|
setter.setSettings();
|
||||||
|
Engine.main(null);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void openSettings() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
53
src/launcher/launcher.fxml
Normal file
53
src/launcher/launcher.fxml
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.scene.control.Button?>
|
||||||
|
<?import javafx.scene.control.ChoiceBox?>
|
||||||
|
<?import javafx.scene.image.ImageView?>
|
||||||
|
<?import javafx.scene.layout.HBox?>
|
||||||
|
<?import javafx.scene.layout.VBox?>
|
||||||
|
<?import javafx.scene.layout.Pane?>
|
||||||
|
|
||||||
|
<HBox xmlns:fx="http://javafx.com/fxml" stylesheets="@style.css" fx:id="window"
|
||||||
|
prefWidth="640" prefHeight="380"
|
||||||
|
fx:controller="launcher.FXMLController">
|
||||||
|
|
||||||
|
<children>
|
||||||
|
|
||||||
|
<VBox fx:id="sidepanel"
|
||||||
|
prefWidth="120" prefHeight="380">
|
||||||
|
<children>
|
||||||
|
<Pane fx:id="logo"
|
||||||
|
prefWidth="120" prefHeight="120"></Pane>
|
||||||
|
<VBox fx:id="btn"
|
||||||
|
prefWidth="120" prefHeight="260">
|
||||||
|
<children>
|
||||||
|
<Button text="Play" fx:id="btn_launch" onAction="#launch"/>
|
||||||
|
<Button text="Settings" fx:id="btn_settings" onAction="#settings"/>
|
||||||
|
<Button text="Quit" fx:id="btn_quit" onAction="#quit"/>
|
||||||
|
</children>
|
||||||
|
</VBox>
|
||||||
|
</children>
|
||||||
|
</VBox>
|
||||||
|
|
||||||
|
<HBox fx:id="picker">
|
||||||
|
<children>
|
||||||
|
<VBox fx:id="p1" styleClass="pane_p">
|
||||||
|
<children>
|
||||||
|
<ImageView/>
|
||||||
|
<ChoiceBox styleClass="char_box" />
|
||||||
|
<ChoiceBox styleClass="contr_box" />
|
||||||
|
</children>
|
||||||
|
</VBox>
|
||||||
|
<VBox fx:id="p2" styleClass="pane_p">
|
||||||
|
<children>
|
||||||
|
<ImageView/>
|
||||||
|
<ChoiceBox styleClass="char_box" />
|
||||||
|
<ChoiceBox styleClass="contr_box" />
|
||||||
|
</children>
|
||||||
|
</VBox>
|
||||||
|
</children>
|
||||||
|
</HBox>
|
||||||
|
|
||||||
|
</children>
|
||||||
|
|
||||||
|
</HBox>
|
27
src/launcher/style.css
Normal file
27
src/launcher/style.css
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#window {
|
||||||
|
-fx-background-color: #131320;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sidepanel */
|
||||||
|
|
||||||
|
#sidepanel {
|
||||||
|
-fx-background-color: #303050;
|
||||||
|
}
|
||||||
|
|
||||||
|
#logo {
|
||||||
|
-fx-background-image: "logo.png";
|
||||||
|
}
|
||||||
|
|
||||||
|
#btn {
|
||||||
|
-fx-alignment: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#btn > Button {
|
||||||
|
-fx-cursor: hand;
|
||||||
|
-fx-padding: 5;
|
||||||
|
-fx-width: 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
#btn_launch {
|
||||||
|
-fx-text-alignment: center;
|
||||||
|
}
|
@ -1,91 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Copyright (c) 2015, 2019, Gluon and/or its affiliates.
|
|
||||||
All rights reserved. Use is subject to license terms.
|
|
||||||
|
|
||||||
This file is available and licensed under the following license:
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions
|
|
||||||
are met:
|
|
||||||
|
|
||||||
- Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in
|
|
||||||
the documentation and/or other materials provided with the distribution.
|
|
||||||
- Neither the name of Oracle Corporation nor the names of its
|
|
||||||
contributors may be used to endorse or promote products derived
|
|
||||||
from this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<?import javafx.geometry.Rectangle2D?>
|
|
||||||
<?import javafx.scene.control.Button?>
|
|
||||||
<?import javafx.scene.image.Image?>
|
|
||||||
<?import javafx.scene.image.ImageView?>
|
|
||||||
<?import javafx.scene.layout.HBox?>
|
|
||||||
<?import javafx.scene.layout.VBox?>
|
|
||||||
|
|
||||||
<HBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" style="-fx-background-color: #151619;" xmlns="http://javafx.com/javafx/16" xmlns:fx="http://javafx.com/fxml/1">
|
|
||||||
<children>
|
|
||||||
<VBox prefHeight="400.0" prefWidth="157.0">
|
|
||||||
<children>
|
|
||||||
<ImageView accessibleText="Logo" fitHeight="240.0" fitWidth="158.0" pickOnBounds="true" preserveRatio="true">
|
|
||||||
<image>
|
|
||||||
</image>
|
|
||||||
</ImageView>
|
|
||||||
<VBox alignment="BOTTOM_CENTER" prefHeight="263.0" prefWidth="158.0">
|
|
||||||
<children>
|
|
||||||
<VBox alignment="CENTER" prefHeight="200.0" prefWidth="100.0">
|
|
||||||
<children>
|
|
||||||
<Button mnemonicParsing="false" text="Run" />
|
|
||||||
</children>
|
|
||||||
</VBox>
|
|
||||||
<Button mnemonicParsing="false" prefHeight="25.0" prefWidth="176.0" text="Settings" />
|
|
||||||
<Button mnemonicParsing="false" prefHeight="25.0" prefWidth="161.0" style="-fx-background-color: #e80000;" text="X Quit" textFill="WHITE" />
|
|
||||||
</children>
|
|
||||||
</VBox>
|
|
||||||
</children>
|
|
||||||
</VBox>
|
|
||||||
<VBox prefHeight="400.0" prefWidth="455.0">
|
|
||||||
<children>
|
|
||||||
<HBox alignment="CENTER" prefHeight="266.0" prefWidth="475.0">
|
|
||||||
<children>
|
|
||||||
<VBox alignment="BOTTOM_CENTER" prefHeight="249.0" prefWidth="233.0">
|
|
||||||
<children>
|
|
||||||
<ImageView fitHeight="172.0" fitWidth="211.0" pickOnBounds="true" preserveRatio="true">
|
|
||||||
<image>
|
|
||||||
</image>
|
|
||||||
<viewport>
|
|
||||||
<Rectangle2D />
|
|
||||||
</viewport>
|
|
||||||
</ImageView>
|
|
||||||
</children>
|
|
||||||
</VBox>
|
|
||||||
<VBox alignment="BOTTOM_CENTER" prefHeight="249.0" prefWidth="233.0">
|
|
||||||
<children>
|
|
||||||
<ImageView fitHeight="200.0" fitWidth="233.0" pickOnBounds="true" preserveRatio="true">
|
|
||||||
<image>
|
|
||||||
</image>
|
|
||||||
</ImageView>
|
|
||||||
</children>
|
|
||||||
</VBox>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox prefHeight="168.0" prefWidth="432.0" />
|
|
||||||
</children></VBox>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
BIN
textures/background_beach.png
Normal file
BIN
textures/background_beach.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 66 KiB |
Loading…
x
Reference in New Issue
Block a user