Search in sources :

Example 1 with BindableButtonImpl

use of org.terasology.input.internal.BindableButtonImpl in project Terasology by MovingBlocks.

the class BindsSubsystem method registerBindButton.

private BindableButton registerBindButton(SimpleUri bindId, String displayName, BindButtonEvent event) {
    BindableButtonImpl bind = new BindableButtonImpl(bindId, displayName, event);
    buttonLookup.put(bindId, bind);
    buttonBinds.add(bind);
    return bind;
}
Also used : BindableButtonImpl(org.terasology.input.internal.BindableButtonImpl)

Example 2 with BindableButtonImpl

use of org.terasology.input.internal.BindableButtonImpl in project Terasology by MovingBlocks.

the class InputSystemTests method testKeyBinding.

@Test
public void testKeyBinding() {
    Map<Integer, BindableButton> keyBinds = new HashMap<>();
    // mock binding to the TestEventButton, this is done by the BindsManager over the annotations by default
    keyBinds.put(KeyId.T, new BindableButtonImpl(new SimpleUri("engine-tests", "testEvent"), "theTestEvent", new TestEventButton()));
    when(bindsManager.getKeyBinds()).thenReturn(keyBinds);
    pressKey(Key.T);
    inputSystem.update(1f);
    verify(clientEntity).send(Mockito.any(TestEventButton.class));
}
Also used : HashMap(java.util.HashMap) SimpleUri(org.terasology.engine.SimpleUri) BindableButtonImpl(org.terasology.input.internal.BindableButtonImpl) Test(org.junit.Test)

Aggregations

BindableButtonImpl (org.terasology.input.internal.BindableButtonImpl)2 HashMap (java.util.HashMap)1 Test (org.junit.Test)1 SimpleUri (org.terasology.engine.SimpleUri)1