コード例 #1
0
 public void releaseActionKeys() {
   keySize = keyActions.size();
   if (keySize > 0) {
     for (int i = 0; i < keySize; i++) {
       ActionKey act = (ActionKey) keyActions.get(i);
       act.release();
     }
   }
 }
コード例 #2
0
 public final void onKeyUp(LKey e) {
   keySize = keyActions.size();
   if (keySize > 0) {
     int keyCode = e.getKeyCode();
     for (int i = 0; i < keySize; i++) {
       Integer code = (Integer) keyActions.getKey(i);
       if (code == keyCode) {
         ActionKey act = (ActionKey) keyActions.getValue(code);
         act.release();
       }
     }
   }
   release(e);
 }
コード例 #3
0
  public final void alter(LTimerContext timer) {
    for (int i = 0; i < keySize; i++) {
      ActionKey act = (ActionKey) keyActions.get(i);
      if (act.isPressed()) {
        act.act(elapsedTime);
        if (act.isReturn) {
          return;
        }
      }
    }
    if (content.isVisible()) {
      processEvents();
      content.updateNode(timer.getMilliseconds());
    }
    if (follow != null) {
      for (TileMap tile : tiles) {
        float offsetX = getHalfWidth() - follow.getX();
        offsetX = MathUtils.min(offsetX, 0);
        offsetX = MathUtils.max(offsetX, getWidth() - tile.getWidth());

        float offsetY = getHalfHeight() - follow.getY();
        offsetY = MathUtils.min(offsetY, 0);
        offsetY = MathUtils.max(offsetY, getHeight() - tile.getHeight());

        setOffset(tile, offsetX, offsetY);
        tile.update(elapsedTime);
      }
    }
    for (SpriteBatchObject o : objects) {
      o.update(elapsedTime);
      if (updateListener != null) {
        updateListener.act(o, elapsedTime);
      }
    }
    update(elapsedTime);
    commits();
  }
コード例 #4
0
 public void releaseActionKey(Integer keyCode) {
   ActionKey key = (ActionKey) keyActions.getValue(keyCode);
   if (key != null) {
     key.release();
   }
 }
コード例 #5
0
 public void pressActionKey(Integer keyCode) {
   ActionKey key = (ActionKey) keyActions.getValue(keyCode);
   if (key != null) {
     key.press();
   }
 }