use of org.terasology.engine.input.InputSystem in project Terasology by MovingBlocks.
the class RegisterInputSystem method step.
@Override
public boolean step() {
ComponentSystemManager componentSystemManager = context.get(ComponentSystemManager.class);
LocalPlayerSystem localPlayerSystem = new LocalPlayerSystem();
componentSystemManager.register(localPlayerSystem, "engine:localPlayerSystem");
context.put(LocalPlayerSystem.class, localPlayerSystem);
CameraTargetSystem cameraTargetSystem = new CameraTargetSystem();
context.put(CameraTargetSystem.class, cameraTargetSystem);
componentSystemManager.register(cameraTargetSystem, "engine:CameraTargetSystem");
InputSystem inputSystem = context.get(InputSystem.class);
componentSystemManager.register(inputSystem, "engine:InputSystem");
return true;
}
use of org.terasology.engine.input.InputSystem in project Terasology by MovingBlocks.
the class TerasologyEngine method switchState.
private void switchState(GameState newState) {
if (currentState != null) {
currentState.dispose();
}
CoreRegistry.setContext(newState.getContext());
currentState = newState;
LoggingContext.setGameState(newState);
newState.init(this);
stateChangeSubscribers.forEach(StateChangeSubscriber::onStateChange);
InputSystem inputSystem = rootContext.get(InputSystem.class);
if (inputSystem != null) {
inputSystem.drainQueues();
}
}
use of org.terasology.engine.input.InputSystem in project Terasology by MovingBlocks.
the class LwjglInput method initControls.
private void initControls() {
Config config = context.get(Config.class);
InputSystem inputSystem = new InputSystem();
context.put(InputSystem.class, inputSystem);
inputSystem.setMouseDevice(new LwjglMouseDevice(config.getRendering()));
inputSystem.setKeyboardDevice(new LwjglKeyboardDevice());
ControllerConfig controllerConfig = config.getInput().getControllers();
LwjglControllerDevice controllerDevice = new LwjglControllerDevice(controllerConfig);
inputSystem.setControllerDevice(controllerDevice);
long window = GLFW.glfwGetCurrentContext();
((LwjglKeyboardDevice) inputSystem.getKeyboard()).registerToLwjglWindow(window);
((LwjglMouseDevice) inputSystem.getMouseDevice()).registerToLwjglWindow(window);
}
use of org.terasology.engine.input.InputSystem in project Terasology by MovingBlocks.
the class LwjglPortlet method initInputs.
public void initInputs() {
final InputSystem inputSystem = context.get(InputSystem.class);
Preconditions.checkNotNull(inputSystem);
mouseDevice = ((AwtMouseDevice) inputSystem.getMouseDevice());
mouseDevice.registerToAwtGlCanvas(canvas);
((AwtKeyboardDevice) inputSystem.getKeyboard()).registerToAwtGlCanvas(canvas);
}
use of org.terasology.engine.input.InputSystem in project Terasology by MovingBlocks.
the class AwtInput method initControls.
private void initControls() {
Config config = context.get(Config.class);
InputSystem inputSystem = new InputSystem();
context.put(InputSystem.class, inputSystem);
inputSystem.setMouseDevice(new AwtMouseDevice(config.getRendering()));
inputSystem.setKeyboardDevice(new AwtKeyboardDevice());
ControllerConfig controllerConfig = config.getInput().getControllers();
LwjglControllerDevice controllerDevice = new LwjglControllerDevice(controllerConfig);
inputSystem.setControllerDevice(controllerDevice);
}
Aggregations