View source

class flaxen.component.Transitional implements Completable

Available on all platforms

When transitioning from one application mode to another, all entities are destroyed, unless they are protected: Transitional entities are protected if their transitional mode is Always, Next, or matches the mode being transitioned to.

To transition the application to a new mode: flaxen.setMode(Play);

For a custom mode, a typedef is helpful: import flaxen.component.Application; typedef ConfigController = Mode("ConfigController"); flaxen.setMode(ConfigController);

To protect an entity from being removed when the mode changes: entity.add(Transitional.ALWAYS); // Never will be removed entity.add(Transitional.NEXT); // Will be protected through transition to next mode, only, then protection is removed entity.add(new Transitional(Play)); // Will be protected only if next mode matches this mode

  • TODO: The entire "transitional" system needs to be made clearer and cleaner. Also, the mode system needs to support layered/stacked modes. For example, hitting ESC brings an options window, and selecting calibrate controller brings an additional window. The original content is not removed in these cases although they may be "paused" or otherwise recognize their activity has been commandeered. Hitting ESC progressively "unstacks" the layered modes.

Class Fields

static var ALWAYS:Transitional

static var NEXT:Transitional

Instance Fields

var complete:Bool

Marked true when protected during transition

var kind:String

Optional classification of transitions

var mode:ApplicationMode

Application mode where this entity is protected

var onComplete:OnCompleteTransition

When this transition completes, what action do we take?

function new(mode:ApplicationMode, ?kind:String, ?onComplete:OnCompleteTransition):Void

function isCompleted():Bool

Returns true if this entity was protected during a transition, with the exception of Always (null) transitions, which never really complete so always return false.

function isProtected(mode:ApplicationMode):Bool

Returns true if this entity should be protected

function setKind(kind:String):Transitional