OS Class
Designed to mimic the feature-set of the CloudKidOS for AS3 Provides a staging framework for other things to load handles the stage query string parameters, provides debug tools, as well as browser cache-busting.
Item Index
Methods
Properties
- _app
- _fps
- _frameCount
- _framerate
- _framerateValue
- _instance static
- _isReady
- _lastFPSUpdateTime
- _lastFrameTime
- _msPerFrame
- _paused
- _renderer The PixiJS renderer.
- _tickCallback
- _tickId
- _updateFunctions
- _useRAF
- canvasContainer
- Container_initialize
- fps
- options
- p
- stage
- stageHeight
- stageWidth
- VERSION static
Attributes
Methods
addApp
-
app
Add an app to this display list
Parameters:
-
app
ApplicationThe application to add
addUpdateCallback
-
alias
-
f
Add an update callback, must take elapsed as a parameter
destroy
()
public
Destroy the instance of the OS, can init after this, also destroys the application, if around
getApp
()
Application
public
Get the current application
Returns:
The current Application, null if no application
getTime
()
public
Gets the current time in milliseconds for timing purposes
init
-
stageName
-
[options]
Static constructor for setting up the stage
Parameters:
-
stageName
StringThe stage name selector
-
[options]
Dictionary optionalAdditional options
-
[mouseOverRate=30]
Int optional(CreateJS only) the framerate for mouseover effects, higher is more responsive
-
[debug=false]
Boolean optionalIf we should enable the Debug class for doing console and remote logs
-
[minLogLevel=0]
Int optionalThe minimum log level for the Debug class, default is show all statements, values from 0 (all)-4 (errors only)
-
[ip=null]
String optionalThe IP address for doing remote debugging
-
[parseQueryString=false]
Boolean optionalIf we should convert the query string into OS options
-
[showFramerate=false]
Boolean optionalTo display the current framerate counter
-
[clearView=false]
Boolean optionalAuto clear the stage render
-
[backgroundColor=0x000000]
Int optional(PIXI only) The background color of the stage as a uint, e.g. 0xFFFFFF for white.
-
[preMultAlpha=false]
Boolean optional(PIXI only) If the renderer is to use pre multiplied alpha for all images. This only affects the WebGL renderer.
-
[transparent=false]
Boolean optional(PIXI only) The stage is transparent
-
[width]
Int optional(PIXI only) The width of the renderer, default is the canvas width
-
[height]
Int optional(PIXI only) The height of the renderer, default is the canvas height
-
[forceContext=null]
String optional(PIXI only) The stage renderer, options are "canvas2d", "webgl" or null. Omitting this (or null) uses WebGL if available, and Canvas2D otherwise.
-
[raf=false]
Boolean optionalUse the request animation frame instead of a setInterval
-
[fps=60]
Int optionalSet the framerate
-
[versionsFile]
String optionalThe text field to store cache-busting versions for individual files
-
[basePath]
String optionalThe base path to load all files from (useful if using a CDN)
-
[cacheBust=false]
Boolean optionalIf all file requests with the MediaLoader should be cacheBusted (e.g., "file.mp3?cb=123123")
-
Example:
var os = cloudkid.OS.init("stage", {
showFramerate: true,
fps: 60,
parseQueryString: true,
debug: true
});
os.addApp(myApplication);
initialize
-
stageName
-
[options]
The internal constructor extends Container constructor
parseQueryStringParams
-
output
Define all of the query string parameters
Parameters:
-
output
ObjectThe object reference to update
pause
()
public
Pause the OS and stop frame updates
removeApp
-
destroying
Remove the application
Parameters:
-
destroying
BooleanIf the OS is being destroyed and shouldn't bother running any resetting code.
Returns:
If an Application
was successfully removed
removeUpdateCallback
-
alias
Remove an update callback, must take elapsed as a parameter
Parameters:
-
alias
StringThe callback function alias
resize
()
public
[PIXI Only] Resizes the renderer and the canvasContainer.
resume
()
public
Resume the OS updates
tick
()
public
Called by the stage listener
Properties
_frameCount
Int
private
The number of frames since the last fps update
_framerate
createjs.Text | PIXI.Text
private
The frame rate object
_isReady
Bool
private
When the OS is ready to use
_lastFPSUpdateTime
Int
private
The last time since the last fps update
_lastFrameTime
Int
private
The number of ms since the last frame update
_msPerFrame
Int
private
The number of milliseconds per frame
_paused
Bool
private
Boolean to keep track if we're paused
_renderer The PixiJS renderer.
PIXI.CanvasRenderer | PIXI.WebGLRenderer
private
[Pixi Only] The renderer used to draw the frame.
_updateFunctions
Dictionary
protected
Collection of update functions
_useRAF
Bool
private
If requestionAnimationFrame should be used
Default: false
canvasContainer
DOMElement
public
[Pixi Only] A div that contains the canvas, so that games can layer it with other canvases if desired.
options
Dictionary
public
The collection of query string parameters
p
createjs.Container | PIXI.DisplayObjectContainer
private
The prototype extends the easeljs' Container class or the PIXI.DisplayObjectContainer class
stage
createjs.Stage | PIXI.Stage
public
Reference to the stage object
Attributes
instance
OS
public
static
readonly
Static function for getting the singleton instance
Fires event instanceChange
Fires when the value for the configuration attribute instance
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added: