Cretes a new PIXI.Sprite on the specified layer. This new sprite will be attached to the GameStage, and can be used to actually display something on the screen. See GameStageLayer for more information about the types of layers.
Layer on which to create the container.
The sprite created and attached to stage.
Removes a container previously created by the call to createContainer
from the stage. Use
it when it's no longer in use, typicall when switching from a Scene.
The contianer to remove
Initializes and runs the game.
Generated using TypeDoc
The bootstrap and entrypoint for a PIXI game. It does the following things in order:
config.gameContainerId
.Example configuration
const game = new Game({ // `document` and `window` are required to be passed to the configuration document, window, // ID of the element where the PIXI's canvas should be added gameContainerId: 'game', // optional PIXI configuration, at the very least you want to provide width and height pixiConfig: { width: 640, height: 360, backgroundColor: 0, antialias: false, }, // Creates and configures a stage which scales the game pixel-perfect, snapping to full integers of scale, // ie. x1, x2, x3, for a crisp pixel look. It also handles all of the magic required for Pixi's // interactions to work and for `MouseInput` library to report proper position stageFactory: (game: Game) => new ScalingStage( game, 640, 360, PIXI.SCALE_MODES.NEAREST, Config.containerUpscaleMode, ), // Queue some assets to be loaded onQueueAssets: (game: Game): void { game.assetLoader.queuePixiAutoFont('topaz_0.png', FontTopaz8Image); game.assetLoader.queuePixiAutoFont('font-topaz', FontTopaz8); game.assetLoader.queueTexture(GfxConstants.InitialTileset, InitialTileset); game.assetLoader.queueTileset(GfxConstants.InitialTileset, { tileWidth: 16, tileHeight: 16, offsetX: 0, offsetY: 0, spacingX: 0, spacingY: 0, }) }, // Callback to create the starting scene initialSceneFactory: (game) => new IntroScene(game), // Called once everything has finished initializing onStartGame: () => { console.log("Game started"); }, ); // Actually starts the initialization of the game game.start();