_physicalLayer = new PhysicalLayer(new LwjglKeyboardWrapper(), new LwjglMouseWrapper(),
new LwjglControllerWrapper(), _glCanvas);
_logicalLayer.registerInput(_glCanvas, _physicalLayer);
_controlHandle = FirstPersonControl.setupTriggers(_logicalLayer, _worldUp, true);
_logicalLayer.registerTrigger(new InputTrigger(new KeyReleasedCondition(Key.F), new TriggerAction() {
public void perform(final com.ardor3d.framework.Canvas source, final TwoInputStates inputState,
final double tpf) {
try {
_glCanvas.setFullScreen(!_glCanvas.isFullScreen());
final Camera cam = _glCanvas.getCanvasRenderer().getCamera();
if (_glCanvas.isFullScreen()) {
final DisplayMode mode = Display.getDisplayMode();
cam.resize(mode.getWidth(), mode.getHeight());
cam.setFrustumPerspective(cam.getFovY(), mode.getWidth() / (float) mode.getHeight(),
cam.getFrustumNear(), cam.getFrustumFar());
appletResized(mode.getWidth(), mode.getHeight());
} else {
cam.resize(getWidth(), getHeight());
cam.setFrustumPerspective(cam.getFovY(), getWidth() / (float) getHeight(),
cam.getFrustumNear(), cam.getFrustumFar());
appletResized(getWidth(), getHeight());
}
} catch (final LWJGLException ex) {
ex.printStackTrace();
}
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyReleasedCondition(Key.V), new TriggerAction() {
public void perform(final com.ardor3d.framework.Canvas source, final TwoInputStates inputState,
final double tpf) {
_glCanvas.setVSyncEnabled(true);
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyReleasedCondition(Key.B), new TriggerAction() {
public void perform(final com.ardor3d.framework.Canvas source, final TwoInputStates inputState,
final double tpf) {
_glCanvas.setVSyncEnabled(false);
}
}));