Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added property 'paused' to Juggler #320

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions starling/src/starling/animation/Juggler.as
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

package starling.animation
{
import starling.core.starling_internal;
import starling.events.Event;
import starling.events.EventDispatcher;

import starling.core.starling_internal;
import starling.events.Event;
import starling.events.EventDispatcher;
/** The Juggler takes objects that implement IAnimatable (like Tweens) and executes them.
*
* <p>A juggler is a simple object. It does no more than saving a list of objects implementing
Expand Down Expand Up @@ -48,12 +48,14 @@ package starling.animation
{
private var mObjects:Vector.<IAnimatable>;
private var mElapsedTime:Number;
private var mPaused : Boolean;

/** Create an empty juggler. */
public function Juggler()
{
mElapsedTime = 0;
mObjects = new <IAnimatable>[];
mPaused = false;
}

/** Adds an object to the juggler. */
Expand Down Expand Up @@ -187,7 +189,9 @@ package starling.animation

/** Advances all objects by a certain time (in seconds). */
public function advanceTime(time:Number):void
{
{
if (mPaused) return;

var numObjects:int = mObjects.length;
var currentIndex:int = 0;
var i:int;
Expand Down Expand Up @@ -237,6 +241,10 @@ package starling.animation
}

/** The total life time of the juggler. */
public function get elapsedTime():Number { return mElapsedTime; }
public function get elapsedTime():Number { return mElapsedTime; }

public function get paused():Boolean { return mPaused; }
public function set paused(value:Boolean):void { mPaused = value; }

}
}
17 changes: 17 additions & 0 deletions starling/src/starling/core/Starling.as
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ package starling.core
private var mLastFrameTimestamp:Number;
private var mLeftMouseDown:Boolean;
private var mStatsDisplay:StatsDisplay;
private var mStatsAlpha:Number;
private var mShareContext:Boolean;
private var mProfile:String;
private var mSupportHighResolutions:Boolean;
Expand Down Expand Up @@ -779,6 +780,10 @@ package starling.core
{
mStatsDisplay = new StatsDisplay();
mStatsDisplay.touchable = false;
if (!isNaN(mStatsAlpha))
{
mStatsDisplay.alpha = mStatsAlpha;
}
mStage.addChild(mStatsDisplay);
}

Expand All @@ -802,6 +807,18 @@ package starling.core
removeEventListener(starling.events.Event.ROOT_CREATED, onRootCreated);
}
}

public function set statsAlpha(value:Number):void
{
if (mStatsDisplay == null)
{
mStatsAlpha = value;
}
else
{
mStatsDisplay.alpha = value;
}
}

/** The Starling stage object, which is the root of the display tree that is rendered. */
public function get stage():Stage
Expand Down