Packagecitrus.core.starling
Classpublic class StarlingCitrusEngine
InheritanceStarlingCitrusEngine Inheritance CitrusEngine Inheritance flash.display.MovieClip

Extends this class if you create a Starling based game. Don't forget to call setUpStarling function.

CitrusEngine can access to the Stage3D power thanks to the Starling Framework.



Public Properties
 PropertyDefined By
  baseHeight : int
StarlingCitrusEngine
  baseWidth : int
StarlingCitrusEngine
 Inheritedconsole : Console
[read-only] A reference to the console, so that you can add your own console commands.
CitrusEngine
 InheritedDEBUG : Boolean = false
DEBUG is not used by CitrusEngine, it is there for your own convenience so you can access it wherever the _ce 'shortcut' is.
CitrusEngine
 InheritedfullScreen : Boolean
CitrusEngine
 InheritedfutureState : IState
Get a direct access to the futureState.
CitrusEngine
 InheritedgameData : AGameData
You may use a class to store your game's data, this is already an abstract class made for that.
CitrusEngine
 Inheritedinput : Input
[read-only] You can get access to the Input manager object from this reference so that you can see which keys are pressed and stuff.
CitrusEngine
  juggler : CitrusStarlingJuggler
[read-only]
StarlingCitrusEngine
 InheritedlevelManager : LevelManager
You may use the Citrus Engine's level manager if you have several levels to handle.
CitrusEngine
 InheritedonPlayingChange : Signal
Used to pause animations in SpriteArt and StarlingArt.
CitrusEngine
 InheritedonStageResize : Signal
called after a stage resize event signal passes the new screenWidth and screenHeight as arguments.
CitrusEngine
 Inheritedplaying : Boolean
Runs and pauses the game loop.
CitrusEngine
  scaleFactor : Number = 1
StarlingCitrusEngine
 InheritedscreenHeight : int
[read-only]
CitrusEngine
 InheritedscreenWidth : int
[read-only]
CitrusEngine
 Inheritedsound : SoundManager
[read-only] A reference to the SoundManager instance.
CitrusEngine
  starling : Starling
[read-only]
StarlingCitrusEngine
 Inheritedstate : IState
A reference to the active game state.
CitrusEngine
Protected Properties
 PropertyDefined By
  _assetSizes : Array
StarlingCitrusEngine
  _baseHeight : int = -1
StarlingCitrusEngine
  _baseWidth : int = -1
StarlingCitrusEngine
  _context3DProfiles : Array
context3D profiles to test for in Ascending order (the more important first).
StarlingCitrusEngine
 Inherited_fullScreen : Boolean = false
CitrusEngine
 Inherited_futureState : IState
CitrusEngine
 Inherited_input : Input
CitrusEngine
  _juggler : CitrusStarlingJuggler
StarlingCitrusEngine
 Inherited_newState : IState
CitrusEngine
 Inherited_playing : Boolean = true
CitrusEngine
 Inherited_screenHeight : int = 0
CitrusEngine
 Inherited_screenWidth : int = 0
CitrusEngine
  _starling : Starling
StarlingCitrusEngine
 Inherited_state : IState
CitrusEngine
 Inherited_stateDisplayIndex : uint = 0
CitrusEngine
 Inherited_stateTransitionning : IState
CitrusEngine
  _suspendRenderingOnDeactivate : Boolean = false
StarlingCitrusEngine
 Inherited_timeDelta : Number
CitrusEngine
  _viewport : Rectangle
StarlingCitrusEngine
  _viewportMode : String = LEGACY
StarlingCitrusEngine
Public Methods
 MethodDefined By
  
StarlingCitrusEngine
  
destroy():void
[override] Destroy the Citrus Engine, use it only if the Citrus Engine is just a part of your project and not your Main class.
StarlingCitrusEngine
 Inherited
[static]
CitrusEngine
  
This function is called when context3D is ready and the starling root is created.
StarlingCitrusEngine
 Inherited
initialize():void
Called when CitrusEngine is added to the stage and ready to run.
CitrusEngine
  
setUpStarling(debugMode:Boolean = false, antiAliasing:uint = 1, viewPort:Rectangle = null, stage3D:Stage3D = null):void
You should call this function to create your Starling view.
StarlingCitrusEngine
  
setupStats(hAlign:String = left, vAlign:String = top, scale:Number = 1):void
StarlingCitrusEngine
Protected Methods
 MethodDefined By
  
_context3DCreated(evt:Event):void
Be sure that starling is initialized (especially on mobile).
StarlingCitrusEngine
  
_starlingRootCreated(evt:Event):void
StarlingCitrusEngine
  
findScaleFactor(assetSizes:Array):Number
returns the asset size closest to one of the available asset sizes you have (based on Starling.contentScaleFactor).
StarlingCitrusEngine
 Inherited
handleAddedToStage(e:Event):void
Set up things that need the stage access.
CitrusEngine
  
handleEnterFrame(e:Event):void
[override] This is the game loop.
StarlingCitrusEngine
  
handlePlayingChange(value:Boolean):void
[override] called when the value of 'playing' changes.
StarlingCitrusEngine
  
handleStageActivated(e:Event):void
[override] Set CitrusEngine's playing to true.
StarlingCitrusEngine
  
[override] Set CitrusEngine's playing to false.
StarlingCitrusEngine
 Inherited
handleStageFullscreen(e:FullScreenEvent):void
CitrusEngine
 Inherited
handleStageResize(e:Event):void
CitrusEngine
  
StarlingCitrusEngine
  
[override] on resize or fullscreen this is called and makes sure _screenWidth/_screenHeight is correct, it can be overriden to update other values that depend on the values of _screenWidth/_screenHeight.
StarlingCitrusEngine
  
resetViewport():Rectangle
StarlingCitrusEngine
Public Constants
 ConstantDefined By
 InheritedtransformMatrix : Matrix
the matrix that describes the transformation required to go from state container space to flash stage space.
CitrusEngine
 InheritedVERSION : String = 3.1.12
[static]
CitrusEngine
Property Detail
_assetSizesproperty
protected var _assetSizes:Array

_baseHeightproperty 
protected var _baseHeight:int = -1

_baseWidthproperty 
protected var _baseWidth:int = -1

_context3DProfilesproperty 
protected var _context3DProfiles:Array

context3D profiles to test for in Ascending order (the more important first). reset this array to a single entry to force one specific profile. More informations.

_jugglerproperty 
protected var _juggler:CitrusStarlingJuggler

_starlingproperty 
protected var _starling:Starling

_suspendRenderingOnDeactivateproperty 
protected var _suspendRenderingOnDeactivate:Boolean = false

_viewportproperty 
protected var _viewport:Rectangle

_viewportModeproperty 
protected var _viewportMode:String = LEGACY

baseHeightproperty 
baseHeight:int


Implementation
    public function get baseHeight():int
    public function set baseHeight(value:int):void
baseWidthproperty 
baseWidth:int


Implementation
    public function get baseWidth():int
    public function set baseWidth(value:int):void
jugglerproperty 
juggler:CitrusStarlingJuggler  [read-only]


Implementation
    public function get juggler():CitrusStarlingJuggler
scaleFactorproperty 
public var scaleFactor:Number = 1

starlingproperty 
starling:Starling  [read-only]


Implementation
    public function get starling():Starling
Constructor Detail
StarlingCitrusEngine()Constructor
public function StarlingCitrusEngine()



Method Detail
_context3DCreated()method
protected function _context3DCreated(evt:Event):void

Be sure that starling is initialized (especially on mobile).

Parameters

evt:Event

_starlingRootCreated()method 
protected function _starlingRootCreated(evt:Event):void

Parameters

evt:Event

destroy()method 
override public function destroy():void

Destroy the Citrus Engine, use it only if the Citrus Engine is just a part of your project and not your Main class.

findScaleFactor()method 
protected function findScaleFactor(assetSizes:Array):Number

returns the asset size closest to one of the available asset sizes you have (based on Starling.contentScaleFactor). If you design your app with a Starling's stage dimension equals to the Flash's stage dimension, you will have to overwrite this function since the Starling.contentScaleFactor will be always equal to 1.

Parameters

assetSizes:Array — Array of numbers listing all asset sizes you use

Returns
Number
handleEnterFrame()method 
override protected function handleEnterFrame(e:Event):void

This is the game loop. It switches states if necessary, then calls update on the current state.

Parameters

e:Event

handlePlayingChange()method 
override protected function handlePlayingChange(value:Boolean):void

called when the value of 'playing' changes. resets input actions , pauses/resumes all sounds by default.

Parameters

value:Boolean

handleStageActivated()method 
override protected function handleStageActivated(e:Event):void

Set CitrusEngine's playing to true. The main loop is performed.

Parameters

e:Event

handleStageDeactivated()method 
override protected function handleStageDeactivated(e:Event):void

Set CitrusEngine's playing to false. Every update methods aren't anymore called.

Parameters

e:Event

handleStarlingReady()method 
public function handleStarlingReady():void

This function is called when context3D is ready and the starling root is created. the idea is to use this function for asset loading through the starling AssetManager and create the first state.

handleStarlingStageResize()method 
protected function handleStarlingStageResize(evt:Event):void

Parameters

evt:Event

resetScreenSize()method 
override protected function resetScreenSize():void

on resize or fullscreen this is called and makes sure _screenWidth/_screenHeight is correct, it can be overriden to update other values that depend on the values of _screenWidth/_screenHeight.

resetViewport()method 
protected function resetViewport():Rectangle

Returns
Rectangle
setUpStarling()method 
public function setUpStarling(debugMode:Boolean = false, antiAliasing:uint = 1, viewPort:Rectangle = null, stage3D:Stage3D = null):void

You should call this function to create your Starling view. The RootClass is internal, it is never used elsewhere. StarlingState is added on the starling stage : _starling.stage.addChildAt(_state as StarlingState, _stateDisplayIndex);

Parameters

debugMode:Boolean (default = false) — If true, display a Stats class instance.
 
antiAliasing:uint (default = 1) — The antialiasing value allows you to set the anti-aliasing (0 - 16), generally a value of 1 is totally acceptable.
 
viewPort:Rectangle (default = null) — Starling's viewport, default is (0, 0, stage.stageWidth, stage.stageHeight, change to (0, 0, stage.fullScreenWidth, stage.fullScreenHeight) for mobile.
 
stage3D:Stage3D (default = null) — The reference to the Stage3D, useful for sharing a 3D context. More informations.

setupStats()method 
public function setupStats(hAlign:String = left, vAlign:String = top, scale:Number = 1):void

Parameters

hAlign:String (default = left)
 
vAlign:String (default = top)
 
scale:Number (default = 1)