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

54 lines
925 B
JavaScript
Raw Normal View History

2016-02-13 21:06:40 +01:00
/**
* @file ui_style.js
* @author frtk@tetalab
*/
2016-02-14 04:37:31 +01:00
NPGClient.UIStyle = function(o) {
/*
this.fm = o.fm !== undefined ? o.fm : false;
this.fc = o.fc !== undefined ? o.fc : '';
this.bm = o.bm !== undefined ? o.bm : false;
this.bw = o.bw !== undefined ? o.bw : 0;
this.bc = o.bc !== undefined ? o.bc : '';
*/
2016-02-13 21:06:40 +01:00
};
NPGClient.UIStyle.prototype = {
constructor: NPGClient.UIStyle,
2016-02-14 04:37:31 +01:00
/*
2016-02-13 21:06:40 +01:00
borderMode: function() {
return this.bm;
},
fillMode: function() {
return this.fm;
},
setBorders: function(m, w, c) {
this.bm = m;
this.bw = w;
this.bc = c;
},
setFillStyle: function(m, c) {
this.fm = m;
this.fc = c;
},
applyStyle: function(ctx) {
var self = this;
// fill style
2016-02-14 04:37:31 +01:00
if (self.fm == true) ctx.fillStyle = self.fc;
2016-02-13 21:06:40 +01:00
// border mode
if (bm == true) {
2016-02-14 04:37:31 +01:00
ctx.lineWidth = self.bw;
ctx.strokeStyle = self.bc;
2016-02-13 21:06:40 +01:00
}
}
2016-02-14 04:37:31 +01:00
*/
2016-02-13 21:06:40 +01:00
};