new GOWN.Application(config, screenMode, parentId, width, height, renderer, stage)
Entry point for your application, makes some assumptions, (e.g. that you
always want fullscreen) and shortcuts some fancy stuff like a gradient
background.
Name | Type | Default | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
config |
Object |
optional
Equals the renderer config for pixi with an
exception: the backgroundColor is an Array a of colors it will drawn as
vertical gradient
|
|||||||||
screenMode |
String | Application.SCREEN_MODE_RESIZE | optional Screen mode of the canvas | ||||||||
parentId |
String | optional DOM id of the canvas element | |||||||||
width |
Number | 800 | optional Width of the canvas | ||||||||
height |
Number | 600 | optional Height of the canvas | ||||||||
renderer |
PIXI.WebGLRenderer | PIXI.CanvasRenderer | PIXI.autoDetectRenderer() | optional Renderer of the canvas | ||||||||
stage |
PIXI.Container | new PIXI.Container() | optional Root container |
Extends
Members
-
static,readonlyGOWN.Application.SCREEN_MODE_FIXEDString
-
Use fixed width/height in pixel.
-
static,readonlyGOWN.Application.SCREEN_MODE_FULLSCREENString
-
Use window.innerWidth/innerHeight to get the whole browser page width
-
static,readonlyGOWN.Application.SCREEN_MODE_RESIZEString
-
Use resize to parent div width/height
-
backgroundNumber Array.<Number>
-
Set and draw background. Create a gradient by passing an array of hex color numbers.
-
enabledBoolean
-
Enables/Disables the control. (not implemented yet)
-
layoutGOWN.layout.Layout
-
Allow layouting of children
-
screenModeString
-
Set the screen mode
Methods
-
animate()
-
Call requestAnimationFrame to render the application at max. FPS
-
destroy(destroyChildren, removeCanvas)
-
Clean application: remove event listener, free memory (can also remove the canvas from the DOM tree if wanted)
Name Type Default Description destroyChildren
boolean false optional if set to true, all the children will have their destroy method called as well removeCanvas
boolean true optional destroys the canvas and remove it from the dom tree -
inherited mousePos(){PIXI.Point}
-
Get the local mouse position from PIXI.InteractionData
Returns:
Type Description PIXI.Point -
onResize()
-
called when the browser window / the application is resized will set the dimensions of the canvas and layout children (if it has a layout)
-
redraw()
-
Redraw scene, apply layout if required
-
inherited setTheme(theme)
-
Change the theme (every control can have a theme, even if it does not inherit Skinable, e.g. if there is only some color in the skin that will be taken or if it has some skinable components as children)
Name Type Description theme
GOWN.Theme the new theme