(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
/// <reference path="../../typescript/typescriptAPI/TypeScriptAPIPlugin.d.ts" />

SupCore.system.registerPlugin("typescriptAPI", "Sup.Sprite", {
    code: "namespace Sup {\r\n  export class Sprite extends Asset {\r\n    getPixelsPerUnit() { return this.__inner.pixelsPerUnit; }\r\n    getRendering() { return this.__inner.filtering; }\r\n    getFramesPerSecond() { return this.__inner.framesPerSecond; }\r\n    getAlphaTest() { return this.__inner.alphaTest; }\r\n    getGridSize() { return { width: this.__inner.grid.width, height: this.__inner.grid.height }; }\r\n    getOrigin() { return new Sup.Math.Vector2(this.__inner.origin.x * 100, this.__inner.origin.y * 100); }\r\n    getAnimationList() {\r\n      let animations = [];\r\n      for (let animation of this.__inner.animations) animations.push(animation.name);\r\n      return animations;\r\n    }\r\n  }\r\n}\r\n",
    defs: "declare namespace Sup {\r\n  class Sprite extends Asset {\r\n    dummySpriteMember;\r\n\r\n    getPixelsPerUnit(): number;\r\n    getRendering(): string;\r\n    getFramesPerSecond(): number;\r\n    getAlphaTest(): number;\r\n    getGridSize(): { width: number; height: number; };\r\n    getOrigin(): Sup.Math.Vector2;\r\n    getAnimationList(): string[];\r\n  }\r\n}\r\n",
});
SupCore.system.registerPlugin("typescriptAPI", "SpriteRenderer", {
    code: "namespace Sup {\r\n  let materialTypes = [\"basic\", \"phong\", \"shader\"];\r\n\r\n  export class SpriteRenderer extends Sup.ActorComponent {\r\n    constructor(actor: Actor, pathOrAsset?: string|Sprite, materialIndex?: number, shaderPathOrAsset?: string|Shader) {\r\n      super(actor);\r\n      this.__inner = new SupEngine.componentClasses.SpriteRenderer(this.actor.__inner);\r\n      if (pathOrAsset != null) this.setSprite(pathOrAsset, materialIndex, shaderPathOrAsset);\r\n      this.__inner.__outer = this;\r\n      this.actor.spriteRenderer = this;\r\n    }\r\n    destroy() {\r\n      this.actor.spriteRenderer = null;\r\n      super.destroy();\r\n    }\r\n\r\n    getSprite() { return (this.__inner.asset != null) ? this.__inner.asset.__outer : null; }\r\n    setSprite(pathOrAsset: string|Sprite, materialIndex?: number, shaderPathOrAsset?: string|Shader) {\r\n      let material: string;\r\n      if (materialIndex != null) material = materialTypes[materialIndex];\r\n\r\n      if (material === \"shader\" && shaderPathOrAsset == null) {\r\n        throw new Error(`Shader asset is missing when setting sprite on actor named \"${this.actor.getName()}\"`);\r\n      }\r\n\r\n      let spriteAsset: Sprite;\r\n      if (pathOrAsset != null) {\r\n        spriteAsset = (typeof pathOrAsset === \"string\") ? get(pathOrAsset, Sprite) : <Sprite>pathOrAsset;\r\n        this.__inner.opacity = spriteAsset.__inner.opacity;\r\n      }\r\n      let shaderAsset: Shader;\r\n      if (shaderPathOrAsset != null)\r\n        shaderAsset = (typeof shaderPathOrAsset === \"string\") ? get(shaderPathOrAsset, Shader) : <Shader>shaderPathOrAsset;\r\n\r\n      this.__inner.setSprite((spriteAsset != null) ? spriteAsset.__inner : null, material, (shaderAsset != null) ? shaderAsset.__inner : null);\r\n      return this;\r\n    }\r\n    \r\n    getMaterialType() { return materialTypes.indexOf(this.__inner.materialType); }\r\n    getShader() { return this.__inner.materialType === \"shader\" ? this.__inner.shaderAsset.__outer : null; }\r\n    uniforms = new Sup.ShaderUniforms(this);\r\n\r\n    setHorizontalFlip(horizontalFlip) { this.__inner.setHorizontalFlip(horizontalFlip); return this; }\r\n    getHorizontalFlip() { return this.__inner.horizontalFlip; }\r\n    setVerticalFlip(verticalFlip) { this.__inner.setVerticalFlip(verticalFlip); return this; }\r\n    getVerticalFlip() { return this.__inner.verticalFlip; }\r\n    getOpacity() { return this.__inner.opacity; }\r\n    setOpacity(opacity) { this.__inner.setOpacity(opacity); return this; }\r\n    getColor() { return new Color(this.__inner.color.r, this.__inner.color.g, this.__inner.color.b); }\r\n    setColor(r, g, b) {\r\n      if (g == null && b == null) {\r\n        let color = r;\r\n        this.__inner.setColor(color.r, color.g, color.b);\r\n      } else this.__inner.setColor(r, g, b);\r\n      this.__inner.threeMesh.material.color.setRGB(this.__inner.color.r, this.__inner.color.g, this.__inner.color.b);\r\n      return this;\r\n    }\r\n\r\n    setAnimation(animationName, looping) { this.__inner.setAnimation(animationName, looping); return this; }\r\n    getAnimation() { return this.__inner.getAnimation(); }\r\n    setAnimationFrameTime(frametime) { this.__inner.setAnimationFrameTime(frametime); return this; }\r\n    getAnimationFrameTime() { return this.__inner.getAnimationFrameTime(); }\r\n    getAnimationFrameIndex() { return this.__inner.getAnimationFrameIndex(); }\r\n    getAnimationFrameCount() { return this.__inner.getAnimationFrameCount(); }\r\n    getAnimationSpeed() { return this.__inner.animation != null ? this.__inner.animation.speed : null; }\r\n\r\n    isAnimationPlaying() { return this.__inner.isAnimationPlaying; }\r\n    playAnimation(looping) { this.__inner.playAnimation(looping); return this; }\r\n    pauseAnimation() { this.__inner.pauseAnimation(); return this; }\r\n    stopAnimation() { this.__inner.stopAnimation(); return this; }\r\n    setPlaybackSpeed(playbackSpeed) { this.__inner.playbackSpeed = playbackSpeed; return this; }\r\n    getPlaybackSpeed() { return this.__inner.playbackSpeed; }\r\n  }\r\n\r\n  export namespace SpriteRenderer {\r\n    export enum MaterialType { Basic, Phong, Shader };\r\n  }\r\n}\r\n",
    defs: "declare namespace Sup {\r\n  class SpriteRenderer extends ActorComponent {\r\n    constructor(actor: Actor, pathOrAsset?: string|Sprite);\r\n    constructor(actor: Actor, pathOrAsset: string|Sprite, materialType?: SpriteRenderer.MaterialType, shaderPathOrAsset?: string|Shader);\r\n\r\n    getSprite(): Sprite;\r\n    setSprite(pathOrAsset: string|Sprite): SpriteRenderer;\r\n    setSprite(pathOrAsset: string|Sprite, materialType?: SpriteRenderer.MaterialType, shaderPathOrAsset?: string|Shader): SpriteRenderer;\r\n    \r\n    getMaterialType(): SpriteRenderer.MaterialType;\r\n    getShader(): Shader;\r\n    uniforms: Sup.ShaderUniforms;\r\n\r\n    setHorizontalFlip(horizontalFlip: boolean): SpriteRenderer;\r\n    getHorizontalFlip(): boolean;\r\n    setVerticalFlip(verticalFlip: boolean): SpriteRenderer;\r\n    getVerticalFlip(): boolean;\r\n    getOpacity(): number;\r\n    setOpacity(opacity: number): SpriteRenderer;\r\n    getColor(): Sup.Color;\r\n    setColor(color: Sup.Color): SpriteRenderer;\r\n    setColor(r: number, g: number, b: number): SpriteRenderer;\r\n\r\n    getAnimation(): string;\r\n    setAnimation(animationName: string, looping?: boolean): SpriteRenderer;\r\n    setAnimationFrameTime(frameTime: number): SpriteRenderer;\r\n    getAnimationFrameTime(): number;\r\n    getAnimationFrameIndex(): number;\r\n    getAnimationFrameCount(): number;\r\n    getAnimationSpeed(): number;\r\n\r\n    isAnimationPlaying(): boolean;\r\n    playAnimation(looping?: boolean): SpriteRenderer;\r\n    pauseAnimation(): SpriteRenderer;\r\n    stopAnimation(): SpriteRenderer;\r\n    setPlaybackSpeed(playbackSpeed: number): SpriteRenderer;\r\n    getPlaybackSpeed();\r\n  }\r\n\r\n  namespace SpriteRenderer {\r\n    enum MaterialType { Basic, Phong, Shader }\r\n  }\r\n}\r\n",
    exposeActorComponent: { propertyName: "spriteRenderer", className: "Sup.SpriteRenderer" }
});

},{}]},{},[1]);
