PXStage Class Reference
| Inherits from | PXDisplayObjectContainer : PXInteractiveObject : PXDisplayObject : PXEventDispatcher : NSObject |
| Declared in | PXStage.h PXStage.m |
Overview
A special display object that represents the entire drawing surface of the Pixelwave engine and contains several global properties such as the screen size and orientation.
Display objects should never be added directly to the stage. instead they should be added to the root display object.
An instace of the PXStage class is automatically created when the display list is created by a PXView object.
The PXStage class should never be instantiated by the user. To access the global stage object, the [PXDisplayObject stage] property may be read on any display object one the main display list. Alternatively you can use the [PXStage mainStage] method.
Tasks
-
stageWidthThe width, in points, of the stage.
property -
stageHeightThe height, in points, of the stage.
property -
orientationThe orientation of the stage. This value may be changed at any time.
property -
autoOrientsIf
propertyYESthen the stage automatically rotates to the orientations acceptable It will send out a #PXStageOrientation with the typePXStageOrientationEvent_OrientationChanging. If that event is canceled (usingpreventDefault) then the orientation will not take affect. If the orientation is accepted then aPXStageOrientationEvent_OrientationChangewill be sent. -
defaultCaptureTouchesValueThe value the
propertycaptureTouchesproperty of a PXInteractiveObject instance should be set to when initialized. -
backgroundColorThe color with which to clear the stage every frame. This values is used if clearScreen is set to
propertyYES. -
clearScreenWhether the screen will be cleared before each draw. This option is set to
propertyYESby default, but may be set toNOas an optimization. -
dispatchesDisplayListEventsDescribes whether display list modification events should be dispatched when a PXDisplayObject is added or removed from a display list.
property -
frameRateThe frame rate at which enterFrame events will be dispatched. 0 < renderFrameRate <= frameRate <= 60. This is due to the iPhone’s screen refresh rate being 60hz.
property -
renderFrameRateThe frame rate at which the contents of the stage will be rendered to the screen. 0 < renderFrameRate <= frameRate <= 60. This is due to the iPhone’s screen refresh rate being 60hz.
property -
playingDefines whether or not the engine is currently running. To pause the engine set this property to code>false. Set it to
propertytrueto resume normal operations. -
contentScaleFactorThe pixel scale factor.
property -
nativeViewThe PXView instance with which the stage is associated
property -
– invalidateSignals Pixelwave to dispatch a
renderevent to alert display objects the next time a frame is about to be rendered. After the invalidate method is called, before the rendering phase is about to start, but after allenterFrameevents have been fired, arenderevent is dispatched. -
+ mainStageA reference to the main stage associated with the Pixelwave engine.
Properties
autoOrients
If YES then the stage automatically rotates to the orientations
acceptable It will send out a #PXStageOrientation with the type
PXStageOrientationEvent_OrientationChanging. If that event is
canceled (using preventDefault) then the orientation will not
take affect. If the orientation is accepted then a
PXStageOrientationEvent_OrientationChange will be sent.
@property (nonatomic, assign) BOOL autoOrientsDiscussion
Default: NO
Declared In
PXStage.hbackgroundColor
The color with which to clear the stage every frame. This values is used if
clearScreen is set to YES.
@property (nonatomic, assign) unsigned backgroundColorDiscussion
Represented as a hexadecimal number with the format: RRGGBB
Example: The following examples set the stage’s background color to red.
stage.backgroundColor = 0xFF0000;
Declared In
PXStage.hclearScreen
Whether the screen will be cleared before each draw.
This option is set to YES by default, but may be set to
NO as an optimization.
@property (nonatomic) BOOL clearScreenDiscussion
Default: YES
Declared In
PXStage.hcontentScaleFactor
The pixel scale factor.
@property (nonatomic, readonly) float contentScaleFactorDeclared In
PXStage.hdefaultCaptureTouchesValue
The value the captureTouches property of a PXInteractiveObject
instance should be set to when initialized.
@property (nonatomic, assign) BOOL defaultCaptureTouchesValueDiscussion
Default: YES
Declared In
PXStage.hdispatchesDisplayListEvents
Describes whether display list modification events should be dispatched when a PXDisplayObject is added or removed from a display list.
@property (nonatomic) BOOL dispatchesDisplayListEventsDiscussion
If set to YES, the following display list modification events
may be dispatched:
- added – When a display object is added to a display list.
- addedToStage – When a display object or any of its ancestors are added to the main display list.
- removed – When a display object is removed from the display list.
- removedFromStage – When a display object or any of its ancestors are removed from the main display list.
The value of this property may be changed at any time and has an immediate effect.
This option is set to YES by default, but may be set to
NO to avoid the overhead involved with dispatching display list
modification events.
Declared In
PXStage.hframeRate
The frame rate at which enterFrame events will be dispatched. 0 < renderFrameRate <= frameRate <= 60. This is due to the iPhone’s screen refresh rate being 60hz.
@property (nonatomic) float frameRateDeclared In
PXStage.hnativeView
The PXView instance with which the stage is associated
@property (nonatomic, readonly) PXView *nativeViewDeclared In
PXStage.horientation
The orientation of the stage. This value may be changed at any time.
@property (nonatomic, assign) PXStageOrientation orientationDiscussion
Must be one of the following:
–PXStageOrientation_Portrait
–PXStageOrientation_PortraitUpsideDown
–PXStageOrientation_LandscapeLeft
–PXStageOrientation_LandscapeRight
Declared In
PXStage.hplaying
Defines whether or not the engine is currently running. To pause the engine
set this property to code>false. Set it to true to
resume normal operations.
@property (nonatomic) BOOL playingDiscussion
Important note: The engine will not dispatch any events when not playing. These include the ENTER_FRAME event and touch related events.
Declared In
PXStage.hrenderFrameRate
The frame rate at which the contents of the stage will be rendered to the screen. 0 < renderFrameRate <= frameRate <= 60. This is due to the iPhone’s screen refresh rate being 60hz.
@property (nonatomic) float renderFrameRateDeclared In
PXStage.hInstance Methods
invalidate
Signals Pixelwave to dispatch a render event to alert display objects
the next time a frame is about to be rendered. After the invalidate method
is called, before the rendering phase is about to start, but after all
enterFrame events have been fired, a render event is dispatched.
- (void)invalidateDiscussion
this method must be called every time you need a render event to be
dispatched.
The render event lets you make changes to the display list right before
the rendering phase. This allows to write more optimized code which
only updates the display list when it is absolutely necessary.
Declared In
PXStage.m