Skip to content

Commit

Permalink
FlxTimerManager: remove completeAll() again for now
Browse files Browse the repository at this point in the history
It shouldn't exclude looping timers (as long as they're not infinitely looping / have loops == 0).
+ some docs formatting
  • Loading branch information
Gama11 committed Aug 21, 2016
1 parent dfc8470 commit 1980cd8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 21 deletions.
19 changes: 12 additions & 7 deletions flixel/tweens/FlxTween.hx
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,8 @@ typedef TweenOptions =
}

/**
* A simple manager for tracking and updating game tween objects. Normally accessed via the static `FlxTween.manager` rather than being created separately.
* A simple manager for tracking and updating game tween objects.
* Normally accessed via the static `FlxTween.manager` rather than being created separately.
*/
@:access(flixel.tweens.FlxTween)
class FlxTweenManager extends FlxBasic
Expand Down Expand Up @@ -826,6 +827,7 @@ class FlxTweenManager extends FlxBasic

return Tween;
}

/**
* Removes all FlxTweens.
*/
Expand All @@ -834,22 +836,25 @@ class FlxTweenManager extends FlxBasic
while (_tweens.length > 0)
remove(_tweens[0]);
}

/**
* Immediately updates all tweens of type PERSIST or ONESHOT through their endings, triggering their onComplete callbacks.
* Immediately updates all tweens of type `PERSIST` or `ONESHOT` through their endings,
* triggering their `onComplete` callbacks.
*
* Note: if they haven't yet begun, this will first trigger their onStart callback.
* Note: if they haven't yet begun, this will first trigger their `onStart` callback.
*
* Note: their onComplete callbacks are triggered in the next frame. To trigger them immediately, call `FlxTween.manager.update(0);` after this function.
* Note: their `onComplete` callbacks are triggered in the next frame.
* To trigger them immediately, call `FlxTween.manager.update(0);` after this function.
*
* In no case should it trigger an onUpdate callback.
* In no case should it trigger an `onUpdate` callback.
*/
public function completeAll():Void
{
for (tween in _tweens)
if (tween.type == FlxTween.PERSIST || tween.type == FlxTween.ONESHOT) {
if (tween.type == FlxTween.PERSIST || tween.type == FlxTween.ONESHOT)
tween.update(FlxMath.MAX_VALUE_FLOAT);
}
}

/**
* Applies a function to all tweens
*
Expand Down
17 changes: 3 additions & 14 deletions flixel/util/FlxTimer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ class FlxTimer implements IFlxDestroyable
}

/**
* A simple manager for tracking and updating game timer objects. Normally accessed via the static `FlxTimer.manager` rather than being created separately.
* A simple manager for tracking and updating game timer objects.
* Normally accessed via the static `FlxTimer.manager` rather than being created separately.
*/
class FlxTimerManager extends FlxBasic
{
Expand Down Expand Up @@ -273,19 +274,7 @@ class FlxTimerManager extends FlxBasic
{
FlxArrayUtil.clearArray(_timers);
}

/**
* Immediately updates all non-looping timers to their end points.
*/
public function completeAll():Void
{
var timersToFinish:Array<FlxTimer> = [];
for (timer in _timers)
if (timer.loops == 1)
timersToFinish.push(timer);
for (timer in timersToFinish)
timer.update(timer.timeLeft);
}

/**
* Applies a function to all timers
*
Expand Down

0 comments on commit 1980cd8

Please sign in to comment.