starling-framework
Version:
A fast, productive library for 2D cross-platform development.
118 lines (101 loc) • 4.04 kB
JavaScript
// Class: starling.textures.TextureOptions
var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this
$global.Object.defineProperty(exports, "__esModule", {value: true});
var __map_reserved = {};
// Imports
var $hxClasses = require("./../../hxClasses_stub").default;
var $hxEnums = require("./../../hxEnums_stub").default;
var $import = require("./../../import_stub").default;
function starling_core_Starling() {return require("./../../starling/core/Starling");}
// Constructor
var TextureOptions = function(scale,mipMapping,format,premultipliedAlpha,forcePotTexture) {
if(forcePotTexture == null) {
forcePotTexture = false;
}
if(premultipliedAlpha == null) {
premultipliedAlpha = true;
}
if(format == null) {
format = "bgra";
}
if(mipMapping == null) {
mipMapping = false;
}
if(scale == null) {
scale = 1.0;
}
this._onReady = null;
this._optimizeForRenderToTexture = false;
this._scale = scale;
this._format = format;
this._mipMapping = mipMapping;
this._forcePotTexture = forcePotTexture;
this._premultipliedAlpha = premultipliedAlpha;
}
// Meta
TextureOptions.__name__ = "starling.textures.TextureOptions";
TextureOptions.__isInterface__ = false;
TextureOptions.prototype = {
clone: function() {
var clone = new TextureOptions();
clone.copyFrom(this);
return clone;
},
copyFrom: function(other) {
this._scale = other._scale;
this._mipMapping = other._mipMapping;
this._format = other._format;
this._optimizeForRenderToTexture = other._optimizeForRenderToTexture;
this._premultipliedAlpha = other._premultipliedAlpha;
this._forcePotTexture = other._forcePotTexture;
this._onReady = other._onReady;
},
get_scale: function() {
return this._scale;
},
set_scale: function(value) {
return this._scale = value > 0 ? value : (starling_core_Starling().default).get_current().get_contentScaleFactor();
},
get_format: function() {
return this._format;
},
set_format: function(value) {
return this._format = value;
},
get_mipMapping: function() {
return this._mipMapping;
},
set_mipMapping: function(value) {
return this._mipMapping = value;
},
get_optimizeForRenderToTexture: function() {
return this._optimizeForRenderToTexture;
},
set_optimizeForRenderToTexture: function(value) {
return this._optimizeForRenderToTexture = value;
},
get_forcePotTexture: function() {
return this._forcePotTexture;
},
set_forcePotTexture: function(value) {
return this._forcePotTexture = value;
},
get_onReady: function() {
return this._onReady;
},
set_onReady: function(value) {
return this._onReady = value;
},
get_premultipliedAlpha: function() {
return this._premultipliedAlpha;
},
set_premultipliedAlpha: function(value) {
return this._premultipliedAlpha = value;
}
};
TextureOptions.prototype.__class__ = TextureOptions.prototype.constructor = $hxClasses["starling.textures.TextureOptions"] = TextureOptions;
// Init
Object.defineProperties(TextureOptions.prototype,{ scale : { get : function () { return this.get_scale (); }, set : function (v) { return this.set_scale (v); }}, format : { get : function () { return this.get_format (); }, set : function (v) { return this.set_format (v); }}, mipMapping : { get : function () { return this.get_mipMapping (); }, set : function (v) { return this.set_mipMapping (v); }}, optimizeForRenderToTexture : { get : function () { return this.get_optimizeForRenderToTexture (); }, set : function (v) { return this.set_optimizeForRenderToTexture (v); }}, forcePotTexture : { get : function () { return this.get_forcePotTexture (); }, set : function (v) { return this.set_forcePotTexture (v); }}, onReady : { get : function () { return this.get_onReady (); }, set : function (v) { return this.set_onReady (v); }}, premultipliedAlpha : { get : function () { return this.get_premultipliedAlpha (); }, set : function (v) { return this.set_premultipliedAlpha (v); }}});
// Statics
// Export
exports.default = TextureOptions;