private void fireKeyboardListeners(final boolean onoff) { if (!listeners.isEmpty() && !pressedKeyCodes.isEmpty()) { listeners.fire( new IFire<IKeyboardListener>() { @Override public void fire(IKeyboardListener listener) { listener.keyEvent(pressedKeyCodes, onoff); } }); listeners.fire( new IFire<IKeyboardListener>() { @Override public void fire(IKeyboardListener listener) { listener.physKeyEvent(pressedKeyIds, onoff); } }); } }
/* (non-Javadoc) * @see v9t9.engine.keyboard.IKeyboardState#setJoystick(int, int, int, int, boolean, long) */ @Override public synchronized void setJoystick(final int joy, int mask, int x, int y, boolean fire) { int joyRow = JOY1_C + joy - 1; byte oldValue = crukeyboardmap[joyRow]; if ((mask & JOY_X) != 0) { // logger(_L | L_1, _("changing JOY_X (%d)\n\n"), x); changeJoyMatrix(joy, JOY_LEFT_R, x < 0); changeJoyMatrix(joy, JOY_RIGHT_R, x > 0); } if ((mask & JOY_Y) != 0) { // logger(_L | L_1, _("changing JOY_Y (%d)\n\n"), y); changeJoyMatrix(joy, JOY_UP_R, y < 0); changeJoyMatrix(joy, JOY_DOWN_R, y > 0); } if ((mask & JOY_B) != 0) { // logger(_L | L_1, _("changing JOY_B (%d)\n\n"), fire); changeJoyMatrix(joy, JOY_FIRE_R, fire); } /* clear unused bits */ changeJoyMatrix(joy, 0, false); changeJoyMatrix(joy, 1, false); changeJoyMatrix(joy, 2, false); final byte newValue = crukeyboardmap[joyRow]; fireListeners(); if (oldValue != newValue && !listeners.isEmpty()) { listeners.fire( new IFire<IKeyboardListener>() { @Override public void fire(IKeyboardListener listener) { listener.joystickChangeEvent(joy, newValue); } }); } }