import Stage from "./../state/stage.ts"; /** * a State Manager (state machine) */ declare const state: { /** * default state ID for Loading Stage */ LOADING: 0; /** * default state ID for Menu Stage */ MENU: 1; /** * default state ID for "Ready" Stage */ READY: 2; /** * default state ID for Play Stage */ PLAY: 3; /** * default state ID for Game Over Stage */ GAMEOVER: 4; /** * default state ID for Game End Stage */ GAME_END: 5; /** * default state ID for High Score Stage */ SCORE: 6; /** * default state ID for Credits Stage */ CREDITS: 7; /** * default state ID for Settings Stage */ SETTINGS: 8; /** * default state ID for the default Stage * (the default stage is the one running as soon as melonJS is started) */ DEFAULT: 9; /** * default state ID for user defined constants
* @example * const STATE_INFO = state.USER + 0; * const STATE_WARN = state.USER + 1; * const STATE_ERROR = state.USER + 2; * const STATE_CUTSCENE = state.USER + 3; */ USER: 100; /** * Stop the current stage. * @param [shouldPauseTrack=false] - pause current track on screen stop. */ stop(shouldPauseTrack?: boolean): void; /** * pause the current stage * @param [music=false] - pause current music track on screen pause */ pause(music?: boolean): void; /** * Restart the current stage from a full stop. * @param [music=false] - resume current music track on screen resume */ restart(music?: boolean): void; /** * resume the current stage * @param [music=false] - resume current music track on screen resume */ resume(music?: boolean): void; /** * return the running state of the state manager * @returns true if a "process is running" */ isRunning(): boolean; /** * Return the pause state of the state manager * @returns true if the game is paused */ isPaused(): boolean; /** * associate the specified state with a Stage * @param stateId - State ID (see constants) * @param stage - Instantiated Stage to associate with state ID * @param [start = false] - if true the state will be changed immediately after adding it. * @example * class MenuScreen extends Stage { * onResetEvent(app) { * // Load background image * app.world.addChild( * new ImageLayer(0, 0, { * image : "bg", * z: 0 // z-index * }) * ); * * // Play music * audio.playTrack("menu"); * } * * onDestroyEvent() { * // Stop music * audio.stopTrack(); * } * } * * state.set(state.MENU, new MenuScreen()); */ set(stateId: number, stage: Stage, start?: boolean): void; /** * returns the stage associated with the specified state * (or the current one if none is specified) * @param [stateId] - State ID (see constants) * @returns the Stage instance associated with the given state ID, or undefined */ get(stateId?: number): Stage | undefined; /** * return a reference to the current stage
* useful to call a object specific method * @returns the current Stage instance, or undefined if no stage is active */ current(): Stage | undefined; /** * specify a global transition effect * @param effect - (only "fade" is supported for now) * @param color - a CSS color value * @param [duration=1000] - expressed in milliseconds */ transition(effect: string, color: string, duration: number): void; /** * enable/disable the transition to a particular state (by default enabled for all) * @param stateId - State ID (see constants) * @param enable - true to enable transition, false to disable */ setTransition(stateId: number, enable: boolean): void; /** * change the game/app state * @param stateId - State ID (see constants) * @param [forceChange=false] - if true the state will be changed immediately (without waiting for the next frame) * @param extraArgs - extra arguments to be passed to the reset functions * @example * // The onResetEvent method on the play screen will receive two args: * // "level_1" and the number 3 * state.change(state.PLAY, false, "level_1", 3); */ change(stateId: number, forceChange?: boolean, ...extraArgs: unknown[]): void; /** * return true if the specified state is the current one * @param stateId - State ID (see constants) * @returns true if the specified state is the current one */ isCurrent(stateId: number): boolean; }; export default state; //# sourceMappingURL=state.d.ts.map