Search in sources :

Example 1 with KeyRepeatEvent

use of org.terasology.engine.input.events.KeyRepeatEvent in project Terasology by MovingBlocks.

the class EventCopier method createNewKeyEvent.

private KeyEvent createNewKeyEvent(KeyEvent originalEvent) {
    KeyEvent newEvent = null;
    Class eventClass = originalEvent.getClass();
    if (eventClass.equals(KeyDownEvent.class)) {
        newEvent = KeyDownEvent.createCopy((KeyDownEvent) originalEvent);
    } else if (eventClass.equals(KeyRepeatEvent.class)) {
        newEvent = KeyRepeatEvent.createCopy((KeyRepeatEvent) originalEvent);
    } else if (eventClass.equals(KeyUpEvent.class)) {
        newEvent = KeyUpEvent.createCopy((KeyUpEvent) originalEvent);
    } else {
        logger.error("ERROR!!! Event not Identified");
    }
    return newEvent;
}
Also used : KeyEvent(org.terasology.engine.input.events.KeyEvent) KeyDownEvent(org.terasology.engine.input.events.KeyDownEvent) KeyUpEvent(org.terasology.engine.input.events.KeyUpEvent) KeyRepeatEvent(org.terasology.engine.input.events.KeyRepeatEvent)

Aggregations

KeyDownEvent (org.terasology.engine.input.events.KeyDownEvent)1 KeyEvent (org.terasology.engine.input.events.KeyEvent)1 KeyRepeatEvent (org.terasology.engine.input.events.KeyRepeatEvent)1 KeyUpEvent (org.terasology.engine.input.events.KeyUpEvent)1