API Documentation for: 1.1.23
Show:

OS Class

Extends createjs.Container | PIXI.DisplayObjectContainer
Defined in: OS:6
Namespace: cloudkid

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.

Methods

addApp

(
  • app
)
public

Defined in addApp:686

Add an app to this display list

Parameters:

addUpdateCallback

(
  • alias
  • f
)
public

Add an update callback, must take elapsed as a parameter

Parameters:

  • alias String

    An alias to associate with this callback

  • f Function

    The callback function

destroy

() public

Defined in destroy:816

Destroy the instance of the OS, can init after this, also destroys the application, if around

getApp

() Application public

Defined in getApp:708

Get the current application

Returns:

Application:

The current Application, null if no application

getTime

() public

Defined in getTime:553

Gets the current time in milliseconds for timing purposes

init

(
  • stageName
  • [options]
)
public static

Defined in init:189

Static constructor for setting up the stage

Parameters:

  • stageName String

    The stage name selector

  • [options] Dictionary optional

    Additional options

    • [mouseOverRate=30] Int optional

      (CreateJS only) the framerate for mouseover effects, higher is more responsive

    • [debug=false] Boolean optional

      If we should enable the Debug class for doing console and remote logs

    • [minLogLevel=0] Int optional

      The minimum log level for the Debug class, default is show all statements, values from 0 (all)-4 (errors only)

    • [ip=null] String optional

      The IP address for doing remote debugging

    • [parseQueryString=false] Boolean optional

      If we should convert the query string into OS options

    • [showFramerate=false] Boolean optional

      To display the current framerate counter

    • [clearView=false] Boolean optional

      Auto 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 optional

      Use the request animation frame instead of a setInterval

    • [fps=60] Int optional

      Set the framerate

    • [versionsFile] String optional

      The text field to store cache-busting versions for individual files

    • [basePath] String optional

      The base path to load all files from (useful if using a CDN)

    • [cacheBust=false] Boolean optional

      If 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]
)
protected

Defined in initialize:241

The internal constructor extends Container constructor

Parameters:

  • stageName String

    The string name of the stage id

  • [options] Object optional

    The optional options to set, see OS.init() for more information on the options that can be set.

parseQueryStringParams

(
  • output
)
private

Define all of the query string parameters

Parameters:

  • output Object

    The object reference to update

pause

() public

Defined in pause:526

Pause the OS and stop frame updates

removeApp

(
  • destroying
)
Boolean public

Defined in removeApp:632

Remove the application

Parameters:

  • destroying Boolean

    If the OS is being destroyed and shouldn't bother running any resetting code.

Returns:

Boolean:

If an Application was successfully removed

removeUpdateCallback

(
  • alias
)
public

Remove an update callback, must take elapsed as a parameter

Parameters:

  • alias String

    The callback function alias

resize

() public

Defined in resize:802

[PIXI Only] Resizes the renderer and the canvasContainer.

resume

() public

Defined in resume:563

Resume the OS updates

tick

() public

Defined in tick:748

Called by the stage listener

Properties

_app

Application protected

Defined in _app:168

Reference to the current application

_fps

Number private

Defined in _fps:110

The current internal frames per second

_frameCount

Int private

Defined in _frameCount:70

The number of frames since the last fps update

_framerate

createjs.Text | PIXI.Text private

Defined in _framerate:42

The frame rate object

_framerateValue

Number private

Defined in _framerateValue:63

The calculated _framerate

_instance

OS protected static

Defined in _instance:84

Reference to the private instance object

_isReady

Bool private

Defined in _isReady:34

When the OS is ready to use

_lastFPSUpdateTime

Int private

The last time since the last fps update

_lastFrameTime

Int private

Defined in _lastFrameTime:49

The number of ms since the last frame update

_msPerFrame

Int private

Defined in _msPerFrame:118

The number of milliseconds per frame

_paused

Bool private

Defined in _paused:26

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.

_tickCallback

Function private

Defined in _tickCallback:77

The bound callback for listening to tick events

_tickId

Number private

Defined in _tickId:93

The id of the active requestAnimationFrame or setTimeout call.

_updateFunctions

Dictionary protected

Collection of update functions

_useRAF

Bool private

Defined in _useRAF:101

If requestionAnimationFrame should be used

Default: false

canvasContainer

DOMElement public

Defined in canvasContainer:159

[Pixi Only] A div that contains the canvas, so that games can layer it with other canvases if desired.

Container_initialize

Function protected

Reference to the Container initialize()

fps

Number public

Defined in fps:581

The FPS that the OS is targeting.

options

Dictionary public

Defined in options:175

The collection of query string parameters

p

createjs.Container | PIXI.DisplayObjectContainer private

Defined in p:17

The prototype extends the easeljs' Container class or the PIXI.DisplayObjectContainer class

stage

createjs.Stage | PIXI.Stage public

Defined in stage:142

Reference to the stage object

stageHeight

Number public

Defined in stageHeight:610

Convenience for accessing the stage's height

stageWidth

Number public

Defined in stageWidth:596

Convenience for accessing the stage's width

VERSION

String public static

Defined in VERSION:126

The version number

Attributes

instance

OS public static readonly

DEFINED IN instance:853

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 EventFacade
    An Event Facade object with the following attribute-specific properties added:
    • prevVal Any
      The value of the attribute, prior to it being set.
    • newVal Any
      The value the attribute is to be set to.
    • attrName String
      The name of the attribute being set.
    • subAttrName String
      If setting a property within the attribute's value, the name of the sub-attribute property being set.