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 event
event optional orientationchange event
-
convertPointFromNodeToPage (displayObject, x, y)Point
-
Supports the page as a global coordinate system and converts local DisplayObject coordinates to browser page coordinates.
Name Type Description displayObject
DisplayObject The PIXI displayObject.
x
number The x coordinate.
y
number 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 displayObject
DisplayObject The PIXI displayObject.
x
number The x coordinate.
y
number 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 expand
number 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 width
number optional The width of the app.
height
number optional The height of the app.
-
loadSprites (resources, loaded, opts)PIXIApp
-
Loads sprites, e.g. images into the PIXI TextureCache.
Name Type Default Description resources
string | Array.<string> A String or an Array of urls to the images to load.
loaded
function 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.
opts
object optional An options object for more specific parameters.
Name Type Default Description resolutionDependent
boolean true optional Should the sprites be loaded dependent of the renderer resolution?
progress
boolean 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 resources
string | Array.<string> A String or an Array of urls to the images to load.
loaded
function 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.
opts
object optional An options object for more specific parameters.
Name Type Default Description resolutionDependent
boolean true optional Should the textures be loaded dependent of the renderer resolution?
progress
boolean 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 opts
object 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 opts
object optional An options object for the Modal object.
Returns:
Type Description Modal Returns the Modal object. -
Mutate the GraphQL endpoint.
Name Type Default Description mutation
string optional The GraphQL mutation string.
opts
object {} 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 force
boolean 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 value
number 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 query
string optional The GraphQL query string.
opts
object {} 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 event
object optional The event.
opts
object {} optional The event.
Name Type Default Description width
number window.innerWidth optional The width of the app to resize to.
height
number 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 subscription
string optional The GraphQL subscription.
opts
object {} 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.