Creates an instance of a PixiApp.
| Name | Type | Default | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts |
object | {} |
optional
An options object. The following options can be set:
|
- See:
Example
// Create the app
const app = new PIXIApp({
view: canvas,
width: 450,
height: 150,
fpsLogging: true,
theme: 'light',
transparent: false
}).setup().run()
Extends
- PIXI.Application
Members
-
Returns the center of the renderer as an object with the keys x and y.
-
Returns the size of the renderer as an object with the keys width and height.
Methods
-
addFpsDisplay ()PIXIApp
-
Adds the display of the frames per second to the renderer in the upper left corner.
Returns:
Type Description PIXIApp - Returns the PIXIApp for chaining.
-
Checks orientation and adapts view size if necessary. Implements a handler for the orientationchange event.
Name Type Description eventevent optional orientationchange event
-
Supports the page as a global coordinate system and converts local DisplayObject coordinates to browser page coordinates.
Name Type Description displayObjectDisplayObject The PIXI displayObject.
xnumber The x coordinate.
ynumber The y coordinate.
Returns:
Type Description Point Returns a DOM Point. -
Supports the page as a global coordinate system and converts browser page coordinates to local DisplayObject coordinates.
Name Type Description displayObjectDisplayObject The PIXI displayObject.
xnumber The x coordinate.
ynumber The y coordinate.
Returns:
Type Description PIXI.Point Returns a PIXI.Point. -
Draws the display tree of the app. Typically this can be delegated to the layout method.
-
Expand the renderer step-wise on resize.
Name Type Default Description expandnumber 256 optional The amount of additional space for the renderer [px].
Returns:
Type Description boolean true if the renderer was resized. -
Called after a resize. Empty method but can be overwritten to adapt their layout to the new app size.
Name Type Description widthnumber optional The width of the app.
heightnumber optional The height of the app.
-
loadSprites (resources, loaded, opts)PIXIApp
-
Loads sprites, e.g. images into the PIXI TextureCache.
Name Type Default Description resourcesstring | Array.<string> A String or an Array of urls to the images to load.
loadedfunction null optional A callback which is executed after all resources has been loaded. Receives one paramter, a Map of sprites where the key is the path of the image which was loaded and the value is the PIXI.Sprite object.
optsobject optional An options object for more specific parameters.
Name Type Default Description resolutionDependentboolean true optional Should the sprites be loaded dependent of the renderer resolution?
progressboolean false optional Should a progress bar display the loading status?
Returns:
Type Description PIXIApp The PIXIApp object for chaining. -
loadTextures (resources, loaded, opts)PIXIApp
-
Loads textures, e.g. images into the PIXI TextureCache.
Name Type Default Description resourcesstring | Array.<string> A String or an Array of urls to the images to load.
loadedfunction null optional A callback which is executed after all resources has been loaded. Receives one paramter, a Map of textures where the key is the path of the image which was loaded and the value is the PIXI.Texture object.
optsobject optional An options object for more specific parameters.
Name Type Default Description resolutionDependentboolean true optional Should the textures be loaded dependent of the renderer resolution?
progressboolean false optional Should a progress bar display the loading status?
Returns:
Type Description PIXIApp The PIXIApp object for chaining. -
message (opts)Message
-
Opens a new Message object binded to this app.
Name Type Description optsobject optional An options object for the Message object.
Returns:
Type Description Message Returns the Message object. -
modal (opts)Modal
-
Opens a new Modal object binded to this app.
Name Type Description optsobject optional An options object for the Modal object.
Returns:
Type Description Modal Returns the Modal object. -
Mutate the GraphQL endpoint.
Name Type Default Description mutationstring optional The GraphQL mutation string.
optsobject {} optional An options object. The following options can be set: http://dev.apollodata.com/core/apollo-client-api.html#ApolloClient.mutate
Returns:
Type Description Promise Returns a Promise which is either resolved with the resulting data or rejected with an error. -
Tests whether the width is larger than the height of the application.
Returns:
Type Description boolean Returns true if app is in landscape mode. -
Called if checkOrientation detects an orientation change event.
Name Type Default Description forceboolean false optional Called if checkOrientation detects an orientation change event.
-
Set the loading progress of the application. If called for the first time, display the progress bar.
Name Type Description valuenumber optional Should be a value between 0 and 100. If 100, the progress bar will disappear.
Returns:
Type Description PIXIApp | Progress The PixiApp object for chaining or the Progress object when the method was called without a parameter. -
Queries the GraphQL endpoint.
Name Type Default Description querystring optional The GraphQL query string.
optsobject {} optional An options object. The following options can be set: http://dev.apollodata.com/core/apollo-client-api.html#ApolloClient.query
Returns:
Type Description Promise Returns a Promise which is either resolved with the resulting data or rejected with an error. -
resize (event, opts)PIXIApp
-
Resizes the renderer to fit into the window or given width and height.
Name Type Default Description eventobject optional The event.
optsobject {} optional The event.
Name Type Default Description widthnumber window.innerWidth optional The width of the app to resize to.
heightnumber window.innerHeight optional The height of the app to resize to.
Returns:
Type Description PIXIApp - Returns the PIXIApp for chaining.
-
setup ()PIXIApp
-
Extra setup method to construct complex scenes, etc... Overwrite this method if you need additonal views and components.
Returns:
Type Description PIXIApp A reference to the PIXIApp for chaining. -
Subscribe the GraphQL endpoint.
Name Type Default Description subscriptionstring optional The GraphQL subscription.
optsobject {} optional An options object. The following options can be set: http://dev.apollodata.com/core/apollo-client-api.html#ApolloClient.query
Returns:
Type Description Promise Returns a Promise which is either resolved with the resulting data or rejected with an error.