mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 21:24:09 +00:00
54 lines
884 B
TypeScript
54 lines
884 B
TypeScript
/// <reference path="../../Game.ts" />
|
|
/// <reference path="Mouse.ts" />
|
|
/// <reference path="Keyboard.ts" />
|
|
/// <reference path="Touch.ts" />
|
|
|
|
class Input {
|
|
|
|
constructor(game: Game) {
|
|
|
|
this._game = game;
|
|
|
|
this.mouse = new Mouse(this._game);
|
|
this.keyboard = new Keyboard(this._game);
|
|
this.touch = new Touch(this._game);
|
|
|
|
}
|
|
|
|
private _game: Game;
|
|
|
|
public mouse: Mouse;
|
|
public keyboard: Keyboard;
|
|
public touch: Touch;
|
|
|
|
public x: number;
|
|
public y: number;
|
|
|
|
public update() {
|
|
|
|
this.mouse.update();
|
|
this.touch.update();
|
|
|
|
}
|
|
|
|
public reset() {
|
|
|
|
this.mouse.reset();
|
|
this.keyboard.reset();
|
|
this.touch.reset();
|
|
|
|
}
|
|
|
|
public getWorldX(camera: Camera): number {
|
|
|
|
return this.x;
|
|
|
|
}
|
|
|
|
public getWorldY(camera: Camera): number {
|
|
|
|
return this.y;
|
|
|
|
}
|
|
|
|
}
|