added input package
test for control binding
This commit is contained in:
parent
4f8a32d5a4
commit
09562c4216
36
.classpath
36
.classpath
@ -1,16 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<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">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
@ -1,9 +1,12 @@
|
||||
package engine;
|
||||
|
||||
import engine.input.Input;
|
||||
import engine.input.gamepadInput;
|
||||
import engine.math.*;
|
||||
import engine.object.*;
|
||||
import engine.sound.*;
|
||||
|
||||
|
||||
import org.lwjgl.glfw.GLFWFramebufferSizeCallback;
|
||||
import org.lwjgl.glfw.GLFWVidMode;
|
||||
import org.lwjgl.opengl.GL;
|
||||
@ -21,7 +24,7 @@ public class Engine {
|
||||
|
||||
private final List<ObjectGl> objectsGl;
|
||||
|
||||
private static boolean present = glfwJoystickPresent(GLFW_JOYSTICK_1);
|
||||
|
||||
|
||||
private boolean running;
|
||||
|
||||
@ -61,8 +64,8 @@ public class Engine {
|
||||
this.setWindow(glfwCreateWindow(width, height, "Boulevard Combattant", NULL, NULL));
|
||||
assert getWindow() != NULL;
|
||||
|
||||
|
||||
System.out.println(present);
|
||||
boolean present = glfwJoystickPresent(GLFW_JOYSTICK_1);
|
||||
System.out.println("Manette détectée : " + present);
|
||||
|
||||
// On récupère les informations du moniteur principal
|
||||
GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor());
|
||||
@ -205,14 +208,20 @@ public class Engine {
|
||||
long lastFrame;
|
||||
int frame = 0;
|
||||
boolean nextFrame = false;
|
||||
boolean present = glfwJoystickPresent(GLFW_JOYSTICK_1);
|
||||
|
||||
int buttonA=0;
|
||||
int buttonB=1;
|
||||
int buttonX=3;
|
||||
int buttonY=4;
|
||||
|
||||
while (engine.isRunning()) {
|
||||
lastFrame = System.currentTimeMillis();
|
||||
// Game logic should fit here
|
||||
|
||||
if (present) {
|
||||
Input.gamepadInput(zangief, speed);
|
||||
}
|
||||
if (present) {
|
||||
gamepadInput.gamepadInput(zangief, speed, buttonA, buttonB, buttonX, buttonY);
|
||||
}
|
||||
|
||||
Input.keyboardInput(zangief, speed);
|
||||
// input(smiley2, speed);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package engine;
|
||||
package engine.input;
|
||||
|
||||
import engine.Engine;
|
||||
import engine.math.Vector3f;
|
||||
import engine.object.ObjectGl;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
@ -38,9 +39,7 @@ public class Input extends GLFWKeyCallback {
|
||||
|
||||
String name = GLFW.glfwGetJoystickName(GLFW_JOYSTICK_1);
|
||||
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)
|
Loading…
x
Reference in New Issue
Block a user