Function: init()
Call Signature
> init(element, options, devtoolsOptions?): Promise<void>
Defined in: src/index.ts:80
Initialize the Game and PixiJS Application and the interface div. This method should be called before any other method.
Parameters
element
HTMLElement
The html element where I will put the canvas. Example: document.body
options
Partial<ApplicationOptions> & object
Equivalent to the options you can use when initializing a PixiJS Application. Additionally, it supports the following options:
id: The id of the canvas element.navigate: The route navigate function.resizeMode: The resize mode of the canvas.
devtoolsOptions?
Devtools
Equivalent to the options you can use when initializing the PixiJS Devtools.
Returns
Promise<void>
Example
const body = document.body
if (!body) {
throw new Error('body element not found')
}
await Game.initialize(body, {
navigate: (path) => {
// navigate to the path
},
width: 1920,
height: 1080,
backgroundColor: "#303030"
resizeMode: "contain"
})
Call Signature
> init(): Promise<void>
Defined in: src/index.ts:110
Initialize only the GameUnifier, and not the PixiJS Application and the interface div. This method can be used if you want to use only the GameUnifier features, such as save/load game, without initializing the canvas.
Returns
Promise<void>