Newer
Older
kotlin-use-kudens-js-lib / web / js / generated / KotlinTest.js
rnentjes on 21 Jan 2017 3 KB Inital commit
if (typeof kotlin === 'undefined') {
  throw new Error("Error loading module 'KotlinTest'. Its dependency 'kotlin' was not found. Please, check whether 'kotlin' is loaded prior to 'KotlinTest'.");
}
if (typeof kudens === 'undefined') {
  throw new Error("Error loading module 'KotlinTest'. Its dependency 'kudens' was not found. Please, check whether 'kudens' is loaded prior to 'KotlinTest'.");
}
var KotlinTest = function (_, Kotlin, $module$kudens) {
  'use strict';
  var sound_0 = $module$kudens.com.persesgames.sound;
  var EmptyInputProcessor = $module$kudens.com.persesgames.input.EmptyInputProcessor;
  var texture_0 = $module$kudens.com.persesgames.texture;
  var input_0 = $module$kudens.com.persesgames.input;
  var text_0 = $module$kudens.com.persesgames.text;
  var game_0 = $module$kudens.com.persesgames.game;
  var Screen = $module$kudens.com.persesgames.game.Screen;
  var SpriteBatch = $module$kudens.com.persesgames.sprite.SpriteBatch;
  var Sprite = $module$kudens.com.persesgames.sprite.Sprite;
  var DrawMode = $module$kudens.com.persesgames.game.DrawMode;
  GameInputProcessor.prototype = Object.create(EmptyInputProcessor.prototype);
  GameInputProcessor.prototype.constructor = GameInputProcessor;
  WelcomeScreen.prototype = Object.create(Screen.prototype);
  WelcomeScreen.prototype.constructor = WelcomeScreen;
  function GameInputProcessor() {
    EmptyInputProcessor.call(this);
  }
  GameInputProcessor.prototype.keyPressed_za3lpa$ = function (charCode) {
    Kotlin.println('charCode: ' + charCode);
    if (charCode === 32) {
      sound_0.Sounds.play_9sobi5$('EXPLOSION', 0.5);
    }
     else if (charCode === 'x'.charCodeAt(0)) {
      sound_0.Sounds.play_9sobi5$('DROP', 0.75);
    }
  };
  GameInputProcessor.prototype.pointerClick_nhq4am$ = function (pointer, x, y) {
    Kotlin.println('POINTER ' + pointer + ' -> (' + x + ', ' + y + ')');
  };
  GameInputProcessor.$metadata$ = {
    type: Kotlin.TYPE.CLASS,
    classIndex: Kotlin.newClassIndex(),
    simpleName: 'GameInputProcessor',
    baseClasses: [EmptyInputProcessor]
  };
  function WelcomeScreen() {
    Screen.call(this);
    this.sprites = new SpriteBatch();
    this.sprite = new Sprite('SHIP');
    this.music = null;
    this.time = 0.0;
  }
  WelcomeScreen.prototype.loadResources = function () {
    this.music = sound_0.Music.play_1truf$('music/DST-TacticalSpace.mp3', 1.0, true);
    texture_0.Textures.load_puj7f4$('SHIP', 'images/ship2.png');
    input_0.Keys.setInputProcessor_wjqqmu$(new GameInputProcessor());
  };
  WelcomeScreen.prototype.update_dleff0$ = function (time, delta) {
    this.time = time;
  };
  WelcomeScreen.prototype.render = function () {
    text_0.Texts.drawText_k35s1u$(20.0, 100.0, 'Hello! FPS ' + game_0.Game.fps, 'bold 72pt Arial');
    this.sprites.draw_xrfpo0$(this.sprite, 350.0, 350.0, 1.0, -this.time);
    this.sprites.render();
  };
  WelcomeScreen.$metadata$ = {
    type: Kotlin.TYPE.CLASS,
    classIndex: Kotlin.newClassIndex(),
    simpleName: 'WelcomeScreen',
    baseClasses: [Screen]
  };
  function main(args) {
    game_0.Game.view.setToHeight_mx4ult$(1000.0);
    game_0.Game.view.drawMode = DrawMode.LINEAR;
    game_0.Game.view.minAspectRatio = 0.8;
    game_0.Game.view.maxAspectRatio = 0.8;
    game_0.Game.start_ocgj3q$(new WelcomeScreen());
  }
  var package$games = _.games || (_.games = {});
  var package$perses = package$games.perses || (package$games.perses = {});
  var package$shooter = package$perses.shooter || (package$perses.shooter = {});
  package$shooter.GameInputProcessor = GameInputProcessor;
  package$shooter.WelcomeScreen = WelcomeScreen;
  package$shooter.main_kand9s$ = main;
  Kotlin.defineModule('KotlinTest', _);
  main([]);
  return _;
}(typeof KotlinTest === 'undefined' ? {} : KotlinTest, kotlin, kudens);

//@ sourceMappingURL=KotlinTest.js.map