/** 默认的Screen主线程中(非ShotLoop线程)事件 */ public final void alter(LTimerContext context) { long elapsedTime = context.getTimeSinceLastUpdate(); if (touch != null) { touch.update(elapsedTime); } if (scrollDelay.action(elapsedTime)) { switch (backgroundMode) { case BACK_STAR_MODE: this.dot[this.count] = (int) (MathUtils.random() * this.getWidth()); ++this.count; this.count %= dot_size; break; case BACK_SCROLL_MODE: if (scroll != null) { scroll.update(context.getTimeSinceLastUpdate()); } break; case BACK_EMPTY_MODE: emptyBackground(); break; } } update(elapsedTime); }
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(); }