summaryrefslogtreecommitdiff
path: root/js/lex.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-12-09 01:40:49 -0500
committerJules Laplace <jules@okfoc.us>2014-12-09 01:41:14 -0500
commit6a16ad9c408fb84dd27c618312f3111563ca2ad5 (patch)
tree968ae1a0bbb75af36e8ee0611ca28d8f379fabf4 /js/lex.js
parentdddd544a566ce53a70351b9fc1391af5034ae09e (diff)
blitting functions
Diffstat (limited to 'js/lex.js')
-rw-r--r--js/lex.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/js/lex.js b/js/lex.js
index 1dc07a0..62144b6 100644
--- a/js/lex.js
+++ b/js/lex.js
@@ -10,12 +10,14 @@ function Lex (x,y) {
this.fg = colors.white
this.bg = colors.black
this.char = " "
+ this.opacity = 1
}
Lex.prototype.build = function(){
this.span.className = this.css()
this.span.innerHTML = this.html()
}
Lex.prototype.css = function(){
+ if (this.opacity == 0) return "fabb"
return "f" + letters[mod(this.fg,16)] + "b" + letters[mod(this.bg,16)]
}
Lex.prototype.html = function(){
@@ -52,16 +54,17 @@ Lex.prototype.clone = function (lex){
this.fg = lex.fg
this.bg = lex.bg
this.char = lex.char
+ this.opacity = lex.opacity
this.build()
}
-Lex.prototype.erase = function (lex){
- if (lex.opacity == 0) return
+Lex.prototype.erase = function (){
this.fg = colors.white
this.bg = colors.black
this.char = " "
+ this.opacity = 0
this.build()
}
-Lex.prototype.fill = function(fg,bg){
+Lex.prototype.fill = function(fg, bg){
this.fg = fg
this.bg = bg
this.opacity = 1