un peu de ménage
This commit is contained in:
parent
d11a1fa293
commit
5c54cacae7
@ -1,7 +1,6 @@
|
|||||||
package engine;
|
package engine;
|
||||||
|
|
||||||
import engine.gui.UIDummy;
|
import engine.gui.UIDummy;
|
||||||
import engine.gui.UIElement;
|
|
||||||
import engine.gui.UIElementText;
|
import engine.gui.UIElementText;
|
||||||
import engine.input.*;
|
import engine.input.*;
|
||||||
import engine.math.*;
|
import engine.math.*;
|
||||||
@ -31,20 +30,22 @@ public class Engine {
|
|||||||
private final int width;
|
private final int width;
|
||||||
private final int height;
|
private final int height;
|
||||||
|
|
||||||
private float viewXPos;
|
public float viewXPos;
|
||||||
|
public float viewYPos;
|
||||||
|
public float viewZPos;
|
||||||
public Vector3f transformationView;
|
public Vector3f transformationView;
|
||||||
private final Camera camera;
|
public final Camera camera;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the engine and initial attributes use .init() to start the engine
|
* Create the engine and initial attributes use .init() to start the engine
|
||||||
*/
|
*/
|
||||||
public Engine(int width, int height, float aspectRatio) {
|
public Engine(int width, int height, Vector3f aspectRatio) {
|
||||||
this.running = false;
|
this.running = false;
|
||||||
this.objectsGl = new ArrayList<>();
|
this.objectsGl = new ArrayList<>();
|
||||||
this.uiElements = new ArrayList<>();
|
this.uiElements = new ArrayList<>();
|
||||||
this.width = width;
|
this.width = width;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
this.camera = new Camera(1000, new Vector3f(4.0f, 3.0f), this);
|
this.camera = new Camera(1000, aspectRatio, this);
|
||||||
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;
|
this.viewXPos = 0.0f;
|
||||||
this.transformationView = new Vector3f();
|
this.transformationView = new Vector3f();
|
||||||
@ -159,9 +160,15 @@ public class Engine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void cameraTrackingObjectGl(ObjectGl obj, float xOffset){
|
||||||
|
Vector3f zangiefTracking = new Vector3f((- obj.getXPos() - this.viewXPos) + xOffset,0.0f ,0.0f);
|
||||||
|
this.translateView(zangiefTracking);
|
||||||
|
}
|
||||||
|
|
||||||
public void translateView(Vector3f vec){
|
public void translateView(Vector3f vec){
|
||||||
ObjectGl.view = ObjectGl.view.multiply(Matrix4f.translate(vec));
|
ObjectGl.view = ObjectGl.view.multiply(Matrix4f.translate(vec));
|
||||||
viewXPos += vec.x;
|
viewXPos += vec.x;
|
||||||
|
this.transformationView = this.transformationView.addXYZ(vec);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void correctViewport(int width, int height){
|
public static void correctViewport(int width, int height){
|
||||||
@ -216,139 +223,4 @@ public class Engine {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
|
||||||
/*
|
|
||||||
OpenAl TEST
|
|
||||||
*/
|
|
||||||
SoundManager soundManager = new SoundManager();
|
|
||||||
soundManager.init();
|
|
||||||
|
|
||||||
SoundListener soundListener = new SoundListener();
|
|
||||||
|
|
||||||
soundManager.setListener(soundListener);
|
|
||||||
|
|
||||||
SoundBuffer jumpSoundBuffer = new SoundBuffer("sound/jump.ogg");
|
|
||||||
SoundSource soundSource = new SoundSource(false, false);
|
|
||||||
soundSource.setBuffer(jumpSoundBuffer.getBufferId());
|
|
||||||
|
|
||||||
soundManager.addSoundSource("jump", soundSource);
|
|
||||||
// soundManager.playSoundSource("jump");q
|
|
||||||
|
|
||||||
/*
|
|
||||||
Engine Init
|
|
||||||
*/
|
|
||||||
Engine engine = new Engine(1280, 720, 3.0f / 4.0f);
|
|
||||||
int speed = 10; //vitesse d<EFBFBD>placement Object
|
|
||||||
engine.init();
|
|
||||||
|
|
||||||
// Add objects to render
|
|
||||||
String path = "textures/zangief_sprite.png";
|
|
||||||
String path2 = "textures/awesomeface.png";
|
|
||||||
String pathToBG = "textures/background_beach.png";
|
|
||||||
String pathToText = "textures/dejavu10x10_gs_tc.png";
|
|
||||||
|
|
||||||
ObjectGl zangief = new Sprite(10.0f, 10f, path, null);
|
|
||||||
zangief.setTextureWrap(58, 0, 62, 84, ObjectGl.DEFAULT);
|
|
||||||
engine.add_objectGl(zangief);
|
|
||||||
zangief.translate(new Vector3f(-1000.0f, 200.0f, 0.0f));
|
|
||||||
zangief.setColor(new Vector3f(1.0f, 1.0f, 1.0f));
|
|
||||||
zangief.setShader("shaders/StylishShaders/BasicVert.glsl", "shaders/StylishShaders/FlashFrag.glsl");
|
|
||||||
zangief.useTime = true;
|
|
||||||
|
|
||||||
//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);
|
|
||||||
|
|
||||||
// ObjectGl smiley = new Sprite(15.0f, 500.0f, path2, null);
|
|
||||||
//
|
|
||||||
// UIElement uiElement = new UIElement(smiley, 0.0f, 1.0f, engine);
|
|
||||||
// engine.add_uiElement(uiElement);
|
|
||||||
|
|
||||||
UIElementText uiTextTest = new UIElementText("Boulevard Combattant", 10.0f, 0.0f,1.0f, 25.0f, engine);
|
|
||||||
engine.add_uiElement(uiTextTest);
|
|
||||||
|
|
||||||
// Text texTest = new Text("ABCDEFGHIJKLMNOPQRSTUVWYZ",20.0f, 10, engine);
|
|
||||||
// texTest.show();
|
|
||||||
// texTest.translate(new Vector3f(-1000.0f, (float) (-1000.0f * (3.0 / 4.0f) + 100.0f)));
|
|
||||||
|
|
||||||
long timer = System.currentTimeMillis();
|
|
||||||
long lastFrame;
|
|
||||||
int frame = 0;
|
|
||||||
boolean nextFrame = false;
|
|
||||||
boolean Joystick1Present = glfwJoystickPresent(GLFW_JOYSTICK_1);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Cr<EFBFBD>ation des manettes / action
|
|
||||||
*/
|
|
||||||
|
|
||||||
GamepadInput gamepad1 = null;
|
|
||||||
Button zoom = null;
|
|
||||||
Button dezoom = null;
|
|
||||||
|
|
||||||
if (Joystick1Present){
|
|
||||||
gamepad1 = new GamepadInput(GLFW_JOYSTICK_1);
|
|
||||||
gamepad1.inputRefresh();
|
|
||||||
List<Integer> listZoomPlus = new ArrayList<>();
|
|
||||||
listZoomPlus.add(InputConst.buttonA);
|
|
||||||
List<Integer> listZoomMinus = new ArrayList<>();
|
|
||||||
listZoomMinus.add(InputConst.buttonB);
|
|
||||||
zoom = new Button("zoom", listZoomPlus, new ArrayList<>(), gamepad1);
|
|
||||||
dezoom = new Button("dezoom", listZoomMinus, new ArrayList<>(), gamepad1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while (engine.isRunning()) {
|
|
||||||
lastFrame = System.currentTimeMillis();
|
|
||||||
// Game logic should fit here
|
|
||||||
|
|
||||||
if (Joystick1Present) {
|
|
||||||
gamepad1.inputRefresh();
|
|
||||||
// Check si le personnage a sauté
|
|
||||||
if (zoom.isButtonPressed()){
|
|
||||||
// Le personnage saute
|
|
||||||
engine.camera.zoom(1.001f);
|
|
||||||
}if(dezoom.isButtonPressed()){
|
|
||||||
engine.camera.zoom(0.999f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
KeyboardInput.keyboardInput(zangief, speed);
|
|
||||||
|
|
||||||
Vector3f zangiefTracking = new Vector3f((- zangief.getXPos() - engine.viewXPos) - 250.0f,0.0f,0.0f);
|
|
||||||
// LE MOUVEMENT DE LA CAMERA POUR CETTE FRAME
|
|
||||||
engine.translateView(zangiefTracking);
|
|
||||||
// LA SOMME TOTAL DES MOUVEMENTS DE CAMERA DEPUIS L'ORIGINE
|
|
||||||
engine.transformationView = engine.transformationView.addXYZ(zangiefTracking);
|
|
||||||
|
|
||||||
/*
|
|
||||||
********************
|
|
||||||
* essential part v *
|
|
||||||
********************
|
|
||||||
*/
|
|
||||||
engine.update();
|
|
||||||
engine.render();
|
|
||||||
|
|
||||||
frame++;
|
|
||||||
|
|
||||||
if (System.currentTimeMillis() - timer > 1000) {
|
|
||||||
timer += 1000;
|
|
||||||
System.out.println("FPS: " + frame);
|
|
||||||
uiTextTest.setText("FPS: " + frame);
|
|
||||||
frame = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// while (!nextFrame) {
|
|
||||||
// nextFrame = System.currentTimeMillis() - lastFrame >= 16.66f;
|
|
||||||
// }
|
|
||||||
|
|
||||||
nextFrame = false;
|
|
||||||
if (engine.shouldClose()) engine.setRunning(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
soundManager.cleanup();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
155
src/engine/TestEngine.java
Normal file
155
src/engine/TestEngine.java
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
package engine;
|
||||||
|
|
||||||
|
import engine.gui.UIElementText;
|
||||||
|
import engine.input.Button;
|
||||||
|
import engine.input.GamepadInput;
|
||||||
|
import engine.input.InputConst;
|
||||||
|
import engine.input.KeyboardInput;
|
||||||
|
import engine.math.Vector3f;
|
||||||
|
import engine.object.ObjectGl;
|
||||||
|
import engine.object.Sprite;
|
||||||
|
import engine.sound.SoundBuffer;
|
||||||
|
import engine.sound.SoundListener;
|
||||||
|
import engine.sound.SoundManager;
|
||||||
|
import engine.sound.SoundSource;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.lwjgl.glfw.GLFW.GLFW_JOYSTICK_1;
|
||||||
|
import static org.lwjgl.glfw.GLFW.glfwJoystickPresent;
|
||||||
|
|
||||||
|
public class TestEngine {
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
/*
|
||||||
|
OpenAl TEST
|
||||||
|
*/
|
||||||
|
SoundManager soundManager = new SoundManager();
|
||||||
|
soundManager.init();
|
||||||
|
|
||||||
|
SoundListener soundListener = new SoundListener();
|
||||||
|
|
||||||
|
soundManager.setListener(soundListener);
|
||||||
|
|
||||||
|
SoundBuffer jumpSoundBuffer = new SoundBuffer("sound/jump.ogg");
|
||||||
|
SoundSource soundSource = new SoundSource(false, false);
|
||||||
|
soundSource.setBuffer(jumpSoundBuffer.getBufferId());
|
||||||
|
|
||||||
|
soundManager.addSoundSource("jump", soundSource);
|
||||||
|
// soundManager.playSoundSource("jump");
|
||||||
|
|
||||||
|
/*
|
||||||
|
Engine Init
|
||||||
|
*/
|
||||||
|
Engine engine = new Engine(1280, 720, new Vector3f(4.0f, 3.0f));
|
||||||
|
int speed = 10; //vitesse d<EFBFBD>placement Object
|
||||||
|
engine.init();
|
||||||
|
|
||||||
|
// Add objects to render
|
||||||
|
String path = "textures/zangief_sprite.png";
|
||||||
|
String path2 = "textures/awesomeface.png";
|
||||||
|
String pathToBG = "textures/background_beach.png";
|
||||||
|
String pathToText = "textures/dejavu10x10_gs_tc.png";
|
||||||
|
|
||||||
|
ObjectGl zangief = new Sprite(10.0f, 10f, path, null);
|
||||||
|
zangief.setTextureWrap(58, 0, 62, 84, ObjectGl.DEFAULT);
|
||||||
|
engine.add_objectGl(zangief);
|
||||||
|
zangief.translate(new Vector3f(-1000.0f, 200.0f, 0.0f));
|
||||||
|
zangief.setColor(new Vector3f(1.0f, 1.0f, 1.0f));
|
||||||
|
zangief.setShader("shaders/StylishShaders/BasicVert.glsl", "shaders/StylishShaders/FlashFrag.glsl");
|
||||||
|
zangief.useTime = true;
|
||||||
|
|
||||||
|
//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);
|
||||||
|
|
||||||
|
// ObjectGl smiley = new Sprite(15.0f, 500.0f, path2, null);
|
||||||
|
// UIElement uiElement = new UIElement(smiley, 0.0f, 1.0f, engine);
|
||||||
|
// engine.add_uiElement(uiElement);
|
||||||
|
|
||||||
|
UIElementText uiTextTest = new UIElementText("Boulevard Combattant", 5.0f, 0.0f,1.0f, 25.0f, engine);
|
||||||
|
engine.add_uiElement(uiTextTest);
|
||||||
|
|
||||||
|
// Text texTest = new Text("ABCDEFGHIJKLMNOPQRSTUVWYZ",20.0f, 10, engine);
|
||||||
|
// texTest.show();
|
||||||
|
// texTest.translate(new Vector3f(-1000.0f, (float) (-1000.0f * (3.0 / 4.0f) + 100.0f)));
|
||||||
|
|
||||||
|
long timer = System.currentTimeMillis();
|
||||||
|
long lastFrame;
|
||||||
|
int frame = 0;
|
||||||
|
boolean nextFrame = false;
|
||||||
|
boolean Joystick1Present = glfwJoystickPresent(GLFW_JOYSTICK_1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Cr<EFBFBD>ation des manettes / action
|
||||||
|
*/
|
||||||
|
|
||||||
|
GamepadInput gamepad1 = null;
|
||||||
|
Button zoom = null;
|
||||||
|
Button dezoom = null;
|
||||||
|
|
||||||
|
if (Joystick1Present){
|
||||||
|
gamepad1 = new GamepadInput(GLFW_JOYSTICK_1);
|
||||||
|
gamepad1.inputRefresh();
|
||||||
|
List<Integer> listZoomPlus = new ArrayList<>();
|
||||||
|
listZoomPlus.add(InputConst.buttonA);
|
||||||
|
List<Integer> listZoomMinus = new ArrayList<>();
|
||||||
|
listZoomMinus.add(InputConst.buttonB);
|
||||||
|
zoom = new Button("zoom", listZoomPlus, new ArrayList<>(), gamepad1);
|
||||||
|
dezoom = new Button("dezoom", listZoomMinus, new ArrayList<>(), gamepad1);
|
||||||
|
}
|
||||||
|
|
||||||
|
engine.translateView(new Vector3f(0.0f, -125.0f, 0.0f));
|
||||||
|
|
||||||
|
while (engine.isRunning()) {
|
||||||
|
lastFrame = System.currentTimeMillis();
|
||||||
|
// Game logic should fit here
|
||||||
|
|
||||||
|
if (Joystick1Present) {
|
||||||
|
gamepad1.inputRefresh();
|
||||||
|
// Check si le personnage a sauté
|
||||||
|
if (zoom.isButtonPressed()){
|
||||||
|
// Le personnage saute
|
||||||
|
engine.camera.zoom(1.001f);
|
||||||
|
}if(dezoom.isButtonPressed()){
|
||||||
|
engine.camera.zoom(0.999f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
engine.cameraTrackingObjectGl(zangief, -250.0f);
|
||||||
|
|
||||||
|
KeyboardInput.keyboardInput(zangief, speed);
|
||||||
|
|
||||||
|
/*
|
||||||
|
********************
|
||||||
|
* essential part v *
|
||||||
|
********************
|
||||||
|
*/
|
||||||
|
engine.update();
|
||||||
|
engine.render();
|
||||||
|
|
||||||
|
frame++;
|
||||||
|
|
||||||
|
if (System.currentTimeMillis() - timer > 1000) {
|
||||||
|
timer += 1000;
|
||||||
|
System.out.println("FPS: " + frame);
|
||||||
|
uiTextTest.setText("FPS: " + frame);
|
||||||
|
frame = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// while (!nextFrame) {
|
||||||
|
// nextFrame = System.currentTimeMillis() - lastFrame >= 16.66f;
|
||||||
|
// }
|
||||||
|
|
||||||
|
nextFrame = false;
|
||||||
|
if (engine.shouldClose()) engine.setRunning(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
soundManager.cleanup();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -47,6 +47,6 @@ public class UIElement extends UIDummy{
|
|||||||
float y = dimension * ar * 2 * this.yPos - dimension * ar;
|
float y = dimension * ar * 2 * this.yPos - dimension * ar;
|
||||||
obj.translate(new Vector3f(x, y, this.zPos));
|
obj.translate(new Vector3f(x, y, this.zPos));
|
||||||
// Camera position
|
// Camera position
|
||||||
obj.translate(new Vector3f(- engine.transformationView.x, engine.transformationView.y));
|
obj.translate(new Vector3f(- engine.transformationView.x, -engine.transformationView.y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ public class UIElementText extends UIDummy{
|
|||||||
obj.translate(new Vector3f(x, y, this.zPos));
|
obj.translate(new Vector3f(x, y, this.zPos));
|
||||||
obj.translate(new Vector3f(10.0f * i * this.scalingFactor)); // 10.0f est dependant de la taille de la police à changer si besoin rendre dynamique si plusieurs police
|
obj.translate(new Vector3f(10.0f * i * this.scalingFactor)); // 10.0f est dependant de la taille de la police à changer si besoin rendre dynamique si plusieurs police
|
||||||
// Camera position
|
// Camera position
|
||||||
obj.translate(new Vector3f(- engine.transformationView.x, engine.transformationView.y));
|
obj.translate(new Vector3f(- engine.transformationView.x, - engine.transformationView.y));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,63 +30,6 @@ public class KeyboardInput extends GLFWKeyCallback {
|
|||||||
return glfwGetKey(Engine.getWindow(), keyCode) == 1;
|
return glfwGetKey(Engine.getWindow(), keyCode) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void gamepadInput(ObjectGl token, int speed) {
|
|
||||||
ByteBuffer gamepadButton = glfwGetJoystickButtons(GLFW_JOYSTICK_1);
|
|
||||||
FloatBuffer gamepadAxes = glfwGetJoystickAxes(GLFW_JOYSTICK_1);
|
|
||||||
|
|
||||||
assert gamepadAxes != null;
|
|
||||||
assert gamepadButton != null;
|
|
||||||
|
|
||||||
String name = GLFW.glfwGetJoystickName(GLFW_JOYSTICK_1);
|
|
||||||
System.out.println("GamePad Name :" + name);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (gamepadButton.get(0) ==1 ) { // appuie sur croix(PlayStation) A (Xbox)
|
|
||||||
token.translate(new Vector3f( 0.0f, speed * 5.0f, 0.0f));
|
|
||||||
}
|
|
||||||
if ( (gamepadAxes.get(2) < -0.1 || gamepadAxes.get(2) > 0.1) ) { // de droite à gauche //joystick gauche
|
|
||||||
token.translate(new Vector3f (5 * speed * gamepadAxes.get(2), 0.0f, 0.0f));
|
|
||||||
if ( gamepadAxes.get(2) < -0.1 ){
|
|
||||||
token.setTextureWrap(121,0,57,80, ObjectGl.DEFAULT);
|
|
||||||
}else if (gamepadAxes.get(2) > 0.1) {
|
|
||||||
token.setTextureWrap(178,0,62,82, ObjectGl.DEFAULT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( (gamepadAxes.get(3) < -0.1 || gamepadAxes.get(3) > 0.1) ) { // de haut en bas //joystick gauche
|
|
||||||
token.translate(new Vector3f (0.0f, -5 * speed * gamepadAxes.get(3), 0.0f));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Buttons
|
|
||||||
0 : Croix / A
|
|
||||||
1: rond /B
|
|
||||||
2: carré / X
|
|
||||||
3: triangle / Y
|
|
||||||
4: L1 / LB
|
|
||||||
5: R1 / RB
|
|
||||||
6:select
|
|
||||||
7:start
|
|
||||||
8:L3
|
|
||||||
9:R3
|
|
||||||
10: haut
|
|
||||||
11: droite
|
|
||||||
12: bas
|
|
||||||
13: gauche
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Axes
|
|
||||||
0 : left X axe ( right : 1 left -1)
|
|
||||||
1: left Y axe ( down : 1 , Up -1)
|
|
||||||
2: right X axe ( right : 1 left -1)
|
|
||||||
3: right Y axe ( down : 1 , Up -1)
|
|
||||||
4:L2 / LT : 1 active, -1 unactive
|
|
||||||
5: R2 /RT : 1 active, -1 unactive
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void keyboardInput(ObjectGl token, int speed) {
|
public static void keyboardInput(ObjectGl token, int speed) {
|
||||||
boolean keyPressed = false;
|
boolean keyPressed = false;
|
||||||
if (KeyboardInput.isKeyDown(GLFW.GLFW_KEY_S)) {
|
if (KeyboardInput.isKeyDown(GLFW.GLFW_KEY_S)) {
|
||||||
@ -94,7 +37,6 @@ 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 * -1.0f, 0.0f, 0.0f));
|
token.translate(new Vector3f (speed * -1.0f, 0.0f, 0.0f));
|
||||||
@ -107,7 +49,5 @@ public class KeyboardInput extends GLFWKeyCallback {
|
|||||||
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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
package launcher;
|
package launcher;
|
||||||
|
|
||||||
|
import engine.TestEngine;
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.scene.Parent;
|
import javafx.scene.Parent;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
@ -52,7 +53,7 @@ public class Launcher extends Application {
|
|||||||
public static void runGame() {
|
public static void runGame() {
|
||||||
try {
|
try {
|
||||||
setter.setSettings();
|
setter.setSettings();
|
||||||
Engine.main(null);
|
TestEngine.main(null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user