Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUC...
If you think the Android project Station42 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package com.station42.input;
/*www.java2s.com*/import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.controllers.Controller;
import com.badlogic.gdx.controllers.ControllerListener;
import com.badlogic.gdx.controllers.PovDirection;
import com.badlogic.gdx.math.Vector3;
publicclass MouseAndKeyboardController implements Controller {
publicstaticfinal MouseAndKeyboardController None = new MouseAndKeyboardController("No player", -1, -1, -1, -1, -1, -1);
publicstaticfinal MouseAndKeyboardController WASD = new MouseAndKeyboardController("WASD - QE", Keys.W, Keys.A, Keys.S, Keys.D, Keys.Q, Keys.E);
publicstaticfinal MouseAndKeyboardController TFGH = new MouseAndKeyboardController("TFGH - RY", Keys.T, Keys.F, Keys.G, Keys.H, Keys.R, Keys.Y);
publicstaticfinal MouseAndKeyboardController IJKL = new MouseAndKeyboardController("IJKL - UO", Keys.I, Keys.J, Keys.K, Keys.L, Keys.U, Keys.O);
publicstaticfinal MouseAndKeyboardController ARROWS = new MouseAndKeyboardController("Arrows - Left Mouse/Right Mouse", Keys.UP, Keys.LEFT, Keys.DOWN, Keys.RIGHT, -1, -1);
publicfinalint W, A, S, D, Q, E;
publicfinal String name;
private MouseAndKeyboardController(String name, int w, int a, int s, int d, int q, int e) {
this.name = name;
W = w;
A = a;
S = s;
D = d;
Q = q;
E = e;
}
@Override
publicboolean getButton(int buttonCode) {
return false;
}
@Override
publicfloat getAxis(int axisCode) {
// TODO Auto-generated method stub
return 0;
}
@Override
public PovDirection getPov(int povCode) {
// TODO Auto-generated method stub
return null;
}
@Override
publicboolean getSliderX(int sliderCode) {
// TODO Auto-generated method stub
return false;
}
@Override
publicboolean getSliderY(int sliderCode) {
// TODO Auto-generated method stub
return false;
}
@Override
public Vector3 getAccelerometer(int accelerometerCode) {
// TODO Auto-generated method stub
return null;
}
@Override
publicvoid setAccelerometerSensitivity(float sensitivity) {
// TODO Auto-generated method stub
}
@Override
public String getName() {
// TODO Auto-generated method stub
return"Keyboard: " + name;
}
@Override
publicvoid addListener(ControllerListener listener) {
// TODO Auto-generated method stub
}
@Override
publicvoid removeListener(ControllerListener listener) {
// TODO Auto-generated method stub
}
public String toString() {
return getName();
}
}