コード例 #1
0
ファイル: InputSystem.java プロジェクト: ajerezg/Terasology
 private boolean sendMouseEvent(
     MouseInput button, boolean buttonDown, Vector2i position, float delta) {
   MouseButtonEvent event;
   switch (button) {
     case NONE:
       return false;
     case MOUSE_LEFT:
       event =
           (buttonDown)
               ? LeftMouseDownButtonEvent.create(position, delta)
               : LeftMouseUpButtonEvent.create(position, delta);
       break;
     case MOUSE_RIGHT:
       event =
           (buttonDown)
               ? RightMouseDownButtonEvent.create(position, delta)
               : RightMouseUpButtonEvent.create(position, delta);
       break;
     default:
       event =
           (buttonDown)
               ? MouseDownButtonEvent.create(button, position, delta)
               : MouseUpButtonEvent.create(button, position, delta);
       break;
   }
   setupTarget(event);
   for (EntityRef entity : getInputEntities()) {
     entity.send(event);
     if (event.isConsumed()) {
       break;
     }
   }
   boolean consumed = event.isConsumed();
   event.reset();
   return consumed;
 }
コード例 #2
0
 public static RightMouseDownButtonEvent create(Vector2i position, float delta) {
   event.reset(delta);
   event.setMousePosition(position);
   return event;
 }