UNPKG

evidently-pixi

Version:

TypeScript powered set of modules to make it easier to make games in Pixi.js.

47 lines (46 loc) 1.86 kB
import * as PIXI from 'pixi.js'; import { GameStageLayer, GameStage } from "./GameStage"; import { Game } from "../Bootstrap/Game"; /** * Scale mode as used by [[ScalingStage]] */ export declare enum ScalingStageUpscaleMode { /** * Stage is not scaled so the game always displays in the native size. */ NoScale = 0, /** * Scale up to fill as much of the available space as possible, while keeping the scale an integer value, * to ensure every pixel is always the same size. */ SnapScale = 1, /** * Scale up to fill as much of the available space as possible, which may result in uneven pixels. */ FullScale = 2 } /** * This stage will render the game to a render texture in its original dimensions as provided in the constructor, * then depending on selected [[ScalingStageUpscaleMode]] will scale the contents proportionally. The stage will then * be centered in the available spcae that is left. */ export declare class ScalingStage implements GameStage { private _upscaleMode; private _lastWindowWidth; private _lastWindowHeight; private readonly _game; private readonly _layers; private readonly _renderedGame; private readonly _mask; private readonly _baseWidth; private readonly _baseHeight; private readonly _renderTexture; get upscaleMode(): ScalingStageUpscaleMode; set upscaleMode(mode: ScalingStageUpscaleMode); constructor(game: Game, baseWidth: number, baseHeight: number, scaleMode?: number, upscaleMode?: ScalingStageUpscaleMode); addChild(child: PIXI.DisplayObject, layer: GameStageLayer): void; removeChild(child: PIXI.DisplayObject): void; update(): void; setWindowDimensions(windowWidth: number, windowHeight: number): void; private getDimensionsForScaleMode; }