Exemplo n.º 1
0
 public final void dispose() {
   this.keySize = 0;
   if (batch != null) {
     batch.dispose();
     batch = null;
   }
   if (content != null) {
     content.dispose();
     content = null;
   }
   if (indexTile != null) {
     indexTile.dispose();
     indexTile = null;
   }
   if (objects != null) {
     objects.clear();
     objects = null;
   }
   if (pendingAdd != null) {
     pendingAdd.clear();
     pendingAdd = null;
   }
   if (pendingRemove != null) {
     pendingRemove.clear();
     pendingRemove = null;
   }
   tiles.clear();
   close();
 }
Exemplo n.º 2
0
 public final void draw(GLEx g) {
   if (isOnLoadComplete()) {
     batch.begin();
     before(batch);
     for (TileMap tile : tiles) {
       tile.draw(g, batch, offset.x(), offset.y());
     }
     for (SpriteBatchObject o : objects) {
       objX = o.getX() + offset.x;
       objY = o.getY() + offset.y;
       if (contains(objX, objY)) {
         o.draw(batch, offset.x, offset.y);
       }
     }
     if (content.isVisible()) {
       content.drawNode(batch);
     }
     after(batch);
     batch.end();
   }
 }
Exemplo n.º 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();
  }
Exemplo n.º 4
0
 public void setOffset(TileMap tile, float sx, float sy) {
   offset.set(sx, sy);
   tile.setOffset(offset);
 }