added input package
test for control binding
This commit is contained in:
parent
4f8a32d5a4
commit
09562c4216
@ -1,9 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="module" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
package engine;
|
package engine;
|
||||||
|
|
||||||
|
import engine.input.Input;
|
||||||
|
import engine.input.gamepadInput;
|
||||||
import engine.math.*;
|
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;
|
||||||
@ -21,7 +24,7 @@ public class Engine {
|
|||||||
|
|
||||||
private final List<ObjectGl> objectsGl;
|
private final List<ObjectGl> objectsGl;
|
||||||
|
|
||||||
private static boolean present = glfwJoystickPresent(GLFW_JOYSTICK_1);
|
|
||||||
|
|
||||||
private boolean running;
|
private boolean running;
|
||||||
|
|
||||||
@ -61,8 +64,8 @@ public class Engine {
|
|||||||
this.setWindow(glfwCreateWindow(width, height, "Boulevard Combattant", NULL, NULL));
|
this.setWindow(glfwCreateWindow(width, height, "Boulevard Combattant", NULL, NULL));
|
||||||
assert getWindow() != NULL;
|
assert getWindow() != NULL;
|
||||||
|
|
||||||
|
boolean present = glfwJoystickPresent(GLFW_JOYSTICK_1);
|
||||||
System.out.println(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());
|
||||||
@ -205,13 +208,19 @@ public class Engine {
|
|||||||
long lastFrame;
|
long lastFrame;
|
||||||
int frame = 0;
|
int frame = 0;
|
||||||
boolean nextFrame = false;
|
boolean nextFrame = false;
|
||||||
|
boolean present = glfwJoystickPresent(GLFW_JOYSTICK_1);
|
||||||
|
|
||||||
|
int buttonA=0;
|
||||||
|
int buttonB=1;
|
||||||
|
int buttonX=3;
|
||||||
|
int buttonY=4;
|
||||||
|
|
||||||
while (engine.isRunning()) {
|
while (engine.isRunning()) {
|
||||||
lastFrame = System.currentTimeMillis();
|
lastFrame = System.currentTimeMillis();
|
||||||
// Game logic should fit here
|
// Game logic should fit here
|
||||||
|
|
||||||
if (present) {
|
if (present) {
|
||||||
Input.gamepadInput(zangief, speed);
|
gamepadInput.gamepadInput(zangief, speed, buttonA, buttonB, buttonX, buttonY);
|
||||||
}
|
}
|
||||||
|
|
||||||
Input.keyboardInput(zangief, speed);
|
Input.keyboardInput(zangief, speed);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package engine;
|
package engine.input;
|
||||||
|
|
||||||
|
import engine.Engine;
|
||||||
import engine.math.Vector3f;
|
import engine.math.Vector3f;
|
||||||
import engine.object.ObjectGl;
|
import engine.object.ObjectGl;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
@ -38,9 +39,7 @@ public class Input extends GLFWKeyCallback {
|
|||||||
|
|
||||||
String name = GLFW.glfwGetJoystickName(GLFW_JOYSTICK_1);
|
String name = GLFW.glfwGetJoystickName(GLFW_JOYSTICK_1);
|
||||||
System.out.println("GamePad Name :" + name);
|
System.out.println("GamePad Name :" + name);
|
||||||
// for (int i =0 ; i < gamepadAxes.capacity(); i++) {
|
|
||||||
// System.out.println(i + " :" + gamepadAxes.get(i));
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
if (gamepadButton.get(0) ==1 ) { // appuie sur croix(PlayStation) A (Xbox)
|
if (gamepadButton.get(0) ==1 ) { // appuie sur croix(PlayStation) A (Xbox)
|
Loading…
x
Reference in New Issue
Block a user