starling-framework
Version:
A fast, productive library for 2D cross-platform development.
92 lines (75 loc) • 2.63 kB
JavaScript
// Class: starling.text.BitmapChar
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 haxe_ds_IntMap() {return require("./../../haxe/ds/IntMap");}
function starling_display_Image() {return require("./../../starling/display/Image");}
// Constructor
var BitmapChar = function(id,texture,xOffset,yOffset,xAdvance) {
this.__charID = id;
this.__texture = texture;
this.__xOffset = xOffset;
this.__yOffset = yOffset;
this.__xAdvance = xAdvance;
this.__kernings = null;
}
// Meta
BitmapChar.__name__ = "starling.text.BitmapChar";
BitmapChar.__isInterface__ = false;
BitmapChar.prototype = {
addKerning: function(charID,amount) {
if(this.__kernings == null) {
this.__kernings = new (haxe_ds_IntMap().default)();
}
this.__kernings.set(charID,amount);
},
getKerning: function(charID) {
if(this.__kernings == null || this.__kernings.get(charID) == null) {
return 0.0;
} else {
return this.__kernings.get(charID);
}
},
createImage: function() {
return new (starling_display_Image().default)(this.__texture);
},
get_charID: function() {
return this.__charID;
},
get_xOffset: function() {
return this.__xOffset;
},
get_yOffset: function() {
return this.__yOffset;
},
get_xAdvance: function() {
return this.__xAdvance;
},
get_texture: function() {
return this.__texture;
},
get_width: function() {
if(this.__texture != null) {
return this.__texture.get_width();
} else {
return 0;
}
},
get_height: function() {
if(this.__texture != null) {
return this.__texture.get_height();
} else {
return 0;
}
}
};
BitmapChar.prototype.__class__ = BitmapChar.prototype.constructor = $hxClasses["starling.text.BitmapChar"] = BitmapChar;
// Init
Object.defineProperties(BitmapChar.prototype,{ charID : { get : function () { return this.get_charID (); }}, xOffset : { get : function () { return this.get_xOffset (); }}, yOffset : { get : function () { return this.get_yOffset (); }}, xAdvance : { get : function () { return this.get_xAdvance (); }}, texture : { get : function () { return this.get_texture (); }}, width : { get : function () { return this.get_width (); }}, height : { get : function () { return this.get_height (); }}});
// Statics
// Export
exports.default = BitmapChar;