Advertisement
lokhmakov

Untitled

May 25th, 2014
591
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// <reference path='../bower_components/phaser-official/build/phaser.d.ts' />
  2. /// <reference path='boot.ts' />
  3. /// <reference path='preloader.ts' />
  4. /// <reference path='sector.ts' />
  5.  
  6. module SlashSystem {
  7.     export class Game extends Phaser.Game {
  8.  
  9.         static screen: string = 'small';
  10.         static srx: number = Math.max(window.innerWidth,window.innerHeight);
  11.         static sry: number = Math.min(window.innerWidth,window.innerHeight);
  12.  
  13.         static logicWidth = window.innerWidth;
  14.         static logicHeight = window.innerHeight;
  15.  
  16.         static r = Game.logicWidth / Game.logicHeight;
  17.  
  18.         static gameWidth: number;
  19.         static gameHeight: number;
  20.  
  21.         static viewX: number;
  22.         static viewY: number;
  23.         static viewWidth: number;
  24.         static viewHeight: number;
  25.  
  26.         static calcSize() {
  27.             if (Game.srx >= 360){
  28.                 Game.screen = 'small';
  29.                 Game.gameWidth = 360;
  30.             }
  31.             if (Game.srx >= 480){
  32.                 Game.screen = 'normal';
  33.                 Game.gameWidth = 480;
  34.             }
  35.             if (Game.srx >= 720){
  36.                 Game.screen = "large";
  37.                 Game.gameWidth = 720;
  38.             }
  39.             if (Game.srx >= 940){
  40.                 Game.screen = "xlarge";
  41.                 Game.gameWidth = 1024;
  42.             }
  43.  
  44.             if (Game.srx >= 1200){
  45.                 Game.screen = "xxlarge";
  46.                 Game.gameWidth = 2048;
  47.             }
  48.  
  49.             var device = new Phaser.Device(<any>null);
  50.             if (device.desktop){
  51.                 Game.screen = "xxlarge";
  52.                 Game.gameWidth = window.innerWidth;
  53.             }
  54.             device = null;
  55.  
  56.             Game.gameHeight = Game.gameWidth / Game.r;
  57.         }
  58.  
  59.         static convertWidth (value) {
  60.             return value / Game.logicWidth * Game.gameWidth;
  61.         }
  62.  
  63.         static convertHeight (value) {
  64.             return value / Game.logicHeight * Game.gameHeight;
  65.         }
  66.  
  67.         bFontsReady: boolean = false;
  68.  
  69.         constructor() {
  70.             super(Game.gameWidth, Game.gameHeight, Phaser.CANVAS, 'game', null);
  71.  
  72.             //this.input.addPointer();
  73.  
  74.             this.state.add('boot', Boot, false);
  75.             this.state.add('preloader', Preloader, false);
  76.             this.state.add('sector', Sector, false);
  77.  
  78.             this.state.start('boot');
  79.         }
  80.     }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement