text: var __extends = (this && this.__extends) || (function () {
      var extendStatics = Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
          function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
      return function (d, b) {
          extendStatics(d, b);
          function __() { this.constructor = d; }
          d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
      };
  })();
  var MainState = (function (_super) {
      __extends(MainState, _super);
      function MainState() {
          return _super !== null && _super.apply(this, arguments) || this;
      }
      MainState.prototype.create = function () {
          var bgr = this.game.add.image(0, 0, "sprites", "background");
          bgr.width = this.game.width;
          bgr.height = this.game.height;
      };
      MainState.prototype.destroy = function () {
      };
      MainState.prototype.update = function () {
      };
      return MainState;
  }(Phaser.State));
  window.onload = function () {
      var game = new OcarinaApplication();
  };
  var OcarinaApplication = (function (_super) {
      __extends(OcarinaApplication, _super);
      function OcarinaApplication() {
          var _this = _super.call(this, 1280, 800, Phaser.AUTO, "", null, false, false) || this;
          _this.state.add("Boot", new BootState());
          _this.state.add("Preload", new PreloadState());
          _this.state.add("Main", new MainState());
          _this.state.start("Boot");
          return _this;
      }
      OcarinaApplication.getURLName = function (key, defaultValue) {
          if (defaultValue === void 0) { defaultValue = ""; }
          var name = decodeURIComponent(window.location.search.replace(new RegExp("^(?:.*[&\\?]" + encodeURIComponent(key.toLowerCase()).replace(/[\.\+\*]/g, "\\$&") + "(?:\\=([^&]*))?)?.*$", "i"), "$1"));
          return (name == "") ? defaultValue : name;
      };
      return OcarinaApplication;
  }(Phaser.Game));
  var BootState = (function (_super) {
      __extends(BootState, _super);
      function BootState() {
          return _super !== null && _super.apply(this, arguments) || this;
      }
      BootState.prototype.preload = function () {
          var _this = this;
          this.game.load.image("loader", "assets/sprites/loader.png");
          this.game.load.onLoadComplete.add(function () { _this.game.state.start("Preload", true, false, 1); }, this);
      };
      BootState.prototype.create = function () {
          this.game.scale.pageAlignHorizontally = true;
          this.game.scale.pageAlignVertically = true;
          this.game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
      };
      return BootState;
  }(Phaser.State));
  var PreloadState = (function (_super) {
      __extends(PreloadState, _super);
      function PreloadState() {
          return _super !== null && _super.apply(this, arguments) || this;
      }
      PreloadState.prototype.preload = function () {
          var _this = this;
          this.game.stage.backgroundColor = "#000000";
          var loader = this.add.sprite(this.game.width / 2, this.game.height / 2, "loader");
          loader.width = this.game.width * 9 / 10;
          loader.height = this.game.height / 8;
          loader.anchor.setTo(0.5);
          this.game.load.setPreloadSprite(loader);
          this.game.load.atlas("sprites", "assets/sprites/sprites.png", "assets/sprites/sprites.json");
          for (var _i = 0, _a = ["4-hole-atlas", "6-hole-atlas"]; _i < _a.length; _i++) {
              var picset = _a[_i];
              this.game.load.atlas(picset, "assets/sprites/" + picset + ".png", "assets/sprites/" + picset + ".json");
          }
          for (var _b = 0, _c = ["7seg", "font"]; _b < _c.length; _b++) {
              var fontName = _c[_b];
              this.game.load.bitmapFont(fontName, "assets/fonts/" + fontName + ".png", "assets/fonts/" + fontName + ".fnt");
          }
          for (var i = 1; i <= PreloadState.NOTE_COUNT; i++) {
              var sound = i.toString();
              this.game.load.audio(sound, ["assets/sounds/" + sound + ".mp3",
                  "assets/sounds/" + sound + ".ogg"]);
          }
          this.game.load.audio("metronome", ["assets/sounds/metronome.mp3",
              "assets/sounds/metronome.ogg"]);
          var src = OcarinaApplication.getURLName("music", "music.json");
          this.game.load.json("music", OcarinaApplication.getURLName("music", src));
          this.game.load.onLoadComplete.add(function () { _this.game.state.start("Main", true, false, 1); }, this);
      };
      return PreloadState;
  }(Phaser.State));
  PreloadState.NOTE_COUNT = 42;
  