From 6be31e0f6945ba74cb874b3e1264387f1d1fbd4b Mon Sep 17 00:00:00 2001 From: "inductible.dev" Date: Sun, 22 Dec 2013 13:34:52 +0000 Subject: [PATCH] added TypeScript definitions for Key and CursorKeys object --- build/phaser.d.ts | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/build/phaser.d.ts b/build/phaser.d.ts index 560b6c465..9a57431b1 100644 --- a/build/phaser.d.ts +++ b/build/phaser.d.ts @@ -255,7 +255,7 @@ declare module Phaser { randomY: number; boot(): void; update(): void; - setSize(width: number, height: number): void; + setBounds( x:number, y:number, width: number, height: number): void; destroy(): void; } @@ -366,6 +366,32 @@ declare module Phaser { addPointer(): Phaser.Pointer; } + class Key { + constructor( game:Phaser.Game, keycode:number ) + isDown:boolean; + isUp:boolean; + altKey:boolean; + ctrlKey:boolean; + shiftKey:boolean; + timeDown:number; + duration:number; + timeUp:number; + repeats:number; + keycode:number; + onDown:Phaser.Signal; + onUp:Phaser.Signal; + justPressed( duration:number ):boolean; + justReleased( duration:number ):boolean; + } + + interface CursorKeys + { + up:Phaser.Key; + down:Phaser.Key; + left:Phaser.Key; + right:Phaser.Key; + } + class Keyboard { constructor(game: Phaser.Game); game: Phaser.Game; @@ -479,6 +505,7 @@ declare module Phaser { justPressed(keycode: number, duration?: number): boolean; justReleased(keycode: number, duration?: number): boolean; isDown(keycode: number): boolean; + createCursorKeys():CursorKeys; } class Mouse {