The Application class is the entry point for your game. It is responsible for initializing the game, loading assets, and managing the game loop.
The Application class is the entry point for your game. It is responsible for initializing the game, loading assets, and managing the game loop. It extends PIXI’s Application class and implements core functionality through plugins and signals.
Creating an Application
The simplest way to create an application is using the create function:
Configuration
Applications can be configured with various options in your dill-pixel.config.ts file:
Bootstrapping
To bootstrap a custom application:
Then, in index.ts, you can import the application and start it:
Core Features
Signals
The Application provides core signals (defined in ICoreSignals) for various built-in signals. These signals are used to communicate between different parts of the application, and can be accessed via this.app.signals or this.app.signal. These signals are usually aliases for plugins that provide the functionality. E.G. this.app.signals.onSceneChangeStart is just an alias for the SceneManagerPlugin’s onSceneChangeStart signal - this.app.scenes.onSceneChangeStart.connect((detail) => { ... }):
Core Functions
Similarly, the Application provides core functions (defined in ICoreFunctions) for common operations. These functions are used to perform various actions, and can be accessed via this.app.exec or this.app.func. These functions are usually just aliases for the plugins that provide the functionality. E.G. app.exec.loadScene('gameScene') is just an alias for the SceneManagerPlugin’s loadScene function - this.app.scenes.loadScene('gameScene').
Using this.app in Containers and Scenes
Both Container and Scene classes provide access to the Application instance via this.app. This gives you easy access to all Application features:
Example Implementation
Here’s a complete example showing how to create a custom Application: