2016-02-14 10:23:22 +11:00
|
|
|
/**
|
|
|
|
* @file ui_input_text.js
|
|
|
|
* @author frtk@tetalab
|
|
|
|
*/
|
|
|
|
|
|
|
|
NPGClient.UIInputText = function(n, o) {
|
|
|
|
|
|
|
|
// obj name
|
|
|
|
this.name = n !== undefined ? n : '';
|
|
|
|
// 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 : '';
|
|
|
|
//
|
|
|
|
this.input = '';
|
|
|
|
|
|
|
|
// text style
|
|
|
|
this.s = o.style !== undefined ? o.style : new NPGClient.UITextStyle();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
NPGClient.UIInputText.prototype = {
|
|
|
|
|
|
|
|
// Constructor
|
|
|
|
constructor: NPGClient.UIInputText,
|
|
|
|
|
|
|
|
//
|
2016-02-14 14:37:31 +11:00
|
|
|
updateInput: function() {
|
2016-02-14 10:23:22 +11:00
|
|
|
var self = this;
|
2016-02-14 14:37:31 +11:00
|
|
|
self.input = NPGClient.userName;
|
2016-02-14 10:23:22 +11:00
|
|
|
},
|
|
|
|
|
|
|
|
//
|
|
|
|
draw: function(ctx, state) {
|
|
|
|
var self = this;
|
2016-02-16 10:47:28 +11:00
|
|
|
var t = self.text + self.input;
|
2016-02-14 14:37:31 +11:00
|
|
|
self.updateInput();
|
2016-02-16 10:47:28 +11:00
|
|
|
//console.log(self.s);
|
2016-02-14 10:23:22 +11:00
|
|
|
NPGClient.Utils.setTxtStyle(ctx, self.s);
|
2016-02-16 10:47:28 +11:00
|
|
|
ctx.fillText(t, self.x, self.y);
|
2016-02-14 10:23:22 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|