38 lines
712 B
JavaScript
38 lines
712 B
JavaScript
/**
|
|
* @file ui_label.js
|
|
* @author frtk@tetalab
|
|
*/
|
|
|
|
NPGClient.UILabel = function(n, o) {
|
|
|
|
// obj name
|
|
this.name = n !== undefined ? n : '';
|
|
// bkg rect
|
|
//this.bkg = r !== undefined ? r : new NPGClient.UIRect();
|
|
// pos
|
|
this.x = o.x !== undefined ? o.x : 0;
|
|
this.y = o.y !== undefined ? o.y : 0;
|
|
|
|
// text
|
|
this.text = o.text !== undefined ? o.text : '';
|
|
// text style
|
|
this.s = o.style !== undefined ? o.style : new NPGClient.UITextStyle();
|
|
|
|
};
|
|
|
|
|
|
NPGClient.UILabel.prototype = {
|
|
|
|
// Constructor
|
|
constructor: NPGClient.UILabel,
|
|
|
|
//
|
|
draw: function(ctx) {
|
|
var self = this;
|
|
NPGClient.Utils.setTxtStyle(ctx, self.s);
|
|
ctx.fillText(self.text, self.x, self.y);
|
|
}
|
|
|
|
};
|
|
|