added TypeScript definitions for Key and CursorKeys object

This commit is contained in:
inductible.dev 2013-12-22 13:34:52 +00:00
parent 5cf7ed4fdb
commit 6be31e0f69

29
build/phaser.d.ts vendored
View file

@ -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 {