Created
July 10, 2018 07:28
-
-
Save Nek-/57f14ddc051d4f6bfced39d10e8e9cbc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module "phaser-ce" { | |
export = Phaser; | |
} | |
declare class Phaser { | |
static VERSION: string; | |
static DEV_VERSION: string; | |
static GAMES: Phaser.Game[]; | |
} | |
declare module Phaser { | |
enum blendModes { | |
NORMAL, | |
ADD, | |
MULTIPLY, | |
SCREEN, | |
OVERLAY, | |
} | |
class Animation { | |
onComplete: Phaser.Signal; | |
onLoop: Phaser.Signal; | |
onStart: Phaser.Signal; | |
complete(): void; | |
destroy(): void; | |
static generateFrameNames(prefix: string, start: number, stop: number, suffix?: string, zeroPad?: number): string[]; | |
next(quantity?: number): void; | |
onPause(): void; | |
onResume(): void; | |
play(frameRate?: number, loop?: boolean, killOnComplete?: boolean): Phaser.Animation; | |
previous(quantity?: number): void; | |
restart(): void; | |
reverse(): Animation; | |
reverseOnce(): Animation; | |
setFrame(frameId?: string | number, useLocalFrameIndex?: boolean): void; | |
stop(resetFrame?: boolean, dispatchComplete?: boolean): void; | |
update(): boolean; | |
updateCurrentFrame(signalUpdate: boolean, fromPlay?: boolean): boolean; | |
} | |
class Signal { | |
active: boolean; | |
boundDispatch: Function; | |
memorize: boolean; | |
add(listener: Function, listenerContext?: any, priority?: number, ...args: any[]): any; | |
addOnce(listener: Function, listenerContext?: any, priority?: number, ...args: any[]): any; | |
dispatch(...params: any[]): void; | |
} | |
class Game { | |
constructor(width?: number | string, height?: number | string, renderer?: number, parent?: any, state?: any, transparent?: boolean, antialias?: boolean, physicsConfig?: any); | |
context: CanvasRenderingContext2D; | |
count: number; | |
paused: boolean; | |
pendingDestroy: boolean; | |
pendingStep: boolean; | |
physics: Phaser.Physics; | |
physicsConfig: any; | |
boot(): void; | |
destroy(): void; | |
disableStep(): void; | |
enableStep(): void; | |
showDebugHeader(): void; | |
step(): void; | |
update(time: number): void; | |
updateLogic(timeStep: number): void; | |
updateRender(timeStep: number): void; | |
} | |
class Physics { | |
constructor(game: Phaser.Game, config?: any); | |
static ARCADE: number; | |
static P2JS: number; | |
static NINJA: number; | |
static BOX2D: number; | |
static CHIPMUNK: number; | |
static MATTERJS: number; | |
arcade: Phaser.Physics.Arcade; | |
config: any; | |
game: Phaser.Game; | |
ninja: Phaser.Physics.Ninja; | |
p2: Phaser.Physics.P2; | |
box2d: any; | |
} | |
module Physics { | |
class Arcade { | |
} | |
class Ninja { | |
} | |
class P2 { | |
} | |
module P2 { | |
class Body { | |
static DYNAMIC: number; | |
static STATIC: number; | |
static KINEMATIC: number; | |
} | |
} | |
} | |
} | |
// I want to add this class to the P2 module. How ? | |
class Awesome { | |
constructor(hello: string) { | |
console.log(hello); | |
} | |
} | |
declare module Phaser { | |
module Physics { | |
module P2 { | |
export = Awesome; | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment