Search in sources :

Example 1 with ControllerConfig

use of org.terasology.engine.config.ControllerConfig 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);
}
Also used : ControllerConfig(org.terasology.engine.config.ControllerConfig) LwjglControllerDevice(org.terasology.engine.input.lwjgl.LwjglControllerDevice) Config(org.terasology.engine.config.Config) ControllerConfig(org.terasology.engine.config.ControllerConfig) LwjglMouseDevice(org.terasology.engine.input.lwjgl.LwjglMouseDevice) LwjglKeyboardDevice(org.terasology.engine.input.lwjgl.LwjglKeyboardDevice) InputSystem(org.terasology.engine.input.InputSystem)

Example 2 with ControllerConfig

use of org.terasology.engine.config.ControllerConfig 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);
}
Also used : AwtMouseDevice(org.terasology.editor.input.AwtMouseDevice) ControllerConfig(org.terasology.engine.config.ControllerConfig) LwjglControllerDevice(org.terasology.engine.input.lwjgl.LwjglControllerDevice) Config(org.terasology.engine.config.Config) ControllerConfig(org.terasology.engine.config.ControllerConfig) InputSystem(org.terasology.engine.input.InputSystem) AwtKeyboardDevice(org.terasology.editor.input.AwtKeyboardDevice)

Aggregations

Config (org.terasology.engine.config.Config)2 ControllerConfig (org.terasology.engine.config.ControllerConfig)2 InputSystem (org.terasology.engine.input.InputSystem)2 LwjglControllerDevice (org.terasology.engine.input.lwjgl.LwjglControllerDevice)2 AwtKeyboardDevice (org.terasology.editor.input.AwtKeyboardDevice)1 AwtMouseDevice (org.terasology.editor.input.AwtMouseDevice)1 LwjglKeyboardDevice (org.terasology.engine.input.lwjgl.LwjglKeyboardDevice)1 LwjglMouseDevice (org.terasology.engine.input.lwjgl.LwjglMouseDevice)1