2015-04-07 00:00:00 +00:00
|
|
|
module SpaceTac.View {
|
|
|
|
// Base class for all game views
|
|
|
|
export class BaseView extends Phaser.State {
|
|
|
|
// Link to the root UI
|
2015-04-21 22:17:00 +00:00
|
|
|
gameui: GameUI;
|
2015-04-07 00:00:00 +00:00
|
|
|
|
2015-04-15 00:00:00 +00:00
|
|
|
// Message notifications
|
|
|
|
messages: Messages;
|
|
|
|
|
2015-04-23 22:36:57 +00:00
|
|
|
// Input and key bindings
|
|
|
|
inputs: InputManager;
|
|
|
|
|
2015-04-07 00:00:00 +00:00
|
|
|
// Get the size of display
|
|
|
|
getWidth(): number {
|
|
|
|
return this.game.width || 1280;
|
|
|
|
}
|
|
|
|
getHeight(): number {
|
|
|
|
return this.game.height || 720;
|
|
|
|
}
|
|
|
|
getMidWidth(): number {
|
|
|
|
return this.getWidth() / 2;
|
|
|
|
}
|
|
|
|
getMidHeight(): number {
|
|
|
|
return this.getHeight() / 2;
|
|
|
|
}
|
|
|
|
|
2015-04-07 00:00:00 +00:00
|
|
|
// Init the view
|
|
|
|
init(...args: any[]) {
|
|
|
|
this.gameui = <GameUI>this.game;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create view graphics
|
|
|
|
create() {
|
2015-04-15 00:00:00 +00:00
|
|
|
// Notifications
|
|
|
|
this.messages = new Messages(this);
|
|
|
|
|
2015-04-23 22:36:57 +00:00
|
|
|
// Input manager
|
|
|
|
this.inputs = new InputManager(this);
|
2015-04-07 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|