version 0.2.2

This commit is contained in:
2016-02-25 23:35:06 +01:00
parent 2636cf3db7
commit babb856b83
13 changed files with 290 additions and 48 deletions

View File

@@ -34,8 +34,18 @@ NPGClient.UICursor.prototype.constructor = NPGClient.UICursor;
NPGClient.UICursor.prototype.reset = function() {
var self = this;
self.moveTo(self.x0, self.y0);
self.bState = true;
self.bCount = 0;
}
// resetBlink
NPGClient.UICursor.prototype.resetBlink = function() {
var self = this;
self.bState = true;
self.bCount = 0;
}
// draw
NPGClient.UICursor.prototype.draw = function(ctx) {
var self = this;

View File

@@ -3,35 +3,39 @@
* @author frtk@tetalab
*/
NPGClient.UILabel = function(n, o) {
NPGClient.UILabel = function(o) {
//
NPGClient.UIObject.call(this, o);
// obj name
this.name = n !== undefined ? n : '';
// bkg rect
//this.bkg = r !== undefined ? r : new NPGClient.UIRect();
this.name = o.name !== undefined ? o.name : '';
// 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();
this.s = o.style !== undefined ? o.style : '';
};
NPGClient.UILabel.prototype = {
/**
* Inheritance
*/
NPGClient.UILabel.prototype = Object.create(NPGClient.UIObject.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);
}
/**
* Functions
*/
//
NPGClient.UILabel.prototype.constructor = NPGClient.UILabel;
//
NPGClient.UILabel.prototype.draw = function(ctx) {
var self = this;
NPGClient.Utils.setTxtStyle(ctx, self.s);
ctx.fillText(self.text, self.x, self.y);
};

View File

@@ -56,6 +56,7 @@ NPGClient.UIMenu.prototype.selectPrevItem = function(t) {
}
if (self.hasCursor) {
self.cursor.translateY(cShift);
self.cursor.resetBlink();
}
}
};
@@ -76,6 +77,7 @@ NPGClient.UIMenu.prototype.selectNextItem = function(t) {
}
if (self.hasCursor) {
self.cursor.translateY(cShift);
self.cursor.resetBlink();
}
}
};

View File

@@ -0,0 +1,52 @@
/**
* @file ui_status_value.js
* @author frtk@tetalab
*/
NPGClient.UIStatusValue = function(o) {
//
NPGClient.UIObject.call(this, o);
// obj name
this.name = o.name !== undefined ? o.name : '';
// pos
this.x = o.x !== undefined ? o.x : 0;
this.y = o.y !== undefined ? o.y : 0;
//
this.s = o.style !== undefined ? o.style : '';
// label
this.label = o.label !== undefined ? o.label : '';
// widget var value
this.value = 0;
};
/**
* Inheritance
*/
NPGClient.UIStatusValue.prototype = Object.create(NPGClient.UIObject.prototype);
/**
* Functions
*/
//
NPGClient.UIStatusValue.prototype.constructor = NPGClient.UIStatusValue;
//
NPGClient.UIStatusValue.prototype.update = function(v) {
var self = this;
self.value = v;
};
//
NPGClient.UIStatusValue.prototype.draw = function(ctx) {
var self = this;
NPGClient.Utils.setTxtStyle(ctx, self.s);
//
var txt = self.label + ' ' + self.value;
//
ctx.fillText(txt, self.x, self.y);
};