nodePong/client/lib/ui/objects/ui_label.js

41 lines
763 B
JavaScript
Raw Normal View History

2016-02-13 21:06:40 +01:00
/**
* @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 : '';
// font
this.font = o.f !== undefined ? o.f : '';
// color
this.col = o.c !== undefined ? o.c : '';
};
NPGClient.UILabel.prototype = {
// Constructor
constructor: NPGClient.UILabel,
//
draw: function(ctx) {
var self = this;
//self.rect.draw(ctx);
ctx.font = self.font
ctx.fillStyle = self.col;
ctx.fillText(self.text, self.x, self.y);
}
};