summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-11-22 01:01:58 -0500
committerJules Laplace <jules@okfoc.us>2014-11-22 01:01:58 -0500
commita33bb28019c25fd885bb6fe5402fc87a2dc04829 (patch)
tree35a5202fb9403fda4f8d6e1d903628c310546fe7
parent4a674cd3089346a02f6ffd3e6686e3b7fd01a367 (diff)
paste percents properly
-rw-r--r--index.html8
-rw-r--r--js/app.js11
-rw-r--r--js/lex.js4
3 files changed, 16 insertions, 7 deletions
diff --git a/index.html b/index.html
index f049247..733c782 100644
--- a/index.html
+++ b/index.html
@@ -24,12 +24,17 @@ body.grid .focused { box-shadow: inset 0 0 2px white, inset 0 0 2px white, inset
<span id="text_el" class="tool">text</span>
brush size: <span id="width_el" class="ed">5</span> x <span id="height_el" class="ed">5</span>
- canvas size: <span id="canvas_width_el" class="ed">5</span> x <span id="canvas_height_el" class="ed">5</span>
+ canvas size: <span id="canvas_width_el" class="ed">80</span> x <span id="canvas_height_el" class="ed">24</span>
</div>
</div>
</body>
<script type="text/javascript-shader" id="demo_shader">
+lex.bg = colors[color_hue_order[Math.floor((x+y*y)/20)%16]]
+ lex.fg = (x+y)%16
+ lex.char = (y%2) ? ":" : "%"
+
+/*
if (x > y || y > x + 20 || x > y / 4 + 10) {
lex.clear()
}
@@ -38,6 +43,7 @@ body.grid .focused { box-shadow: inset 0 0 2px white, inset 0 0 2px white, inset
lex.fg = (x+y)%2
lex.char = ":"
}
+*/
</script>
<script src="js/lex.js"></script>
<script src="js/matrix.js"></script>
diff --git a/js/app.js b/js/app.js
index 4c5100a..9c27a3f 100644
--- a/js/app.js
+++ b/js/app.js
@@ -1,7 +1,7 @@
var contentType = 'text/plain;charset=utf-8'
-var cols = 80
-var rows = 24
+var cols = 10
+var rows = 5
var dragging = false
var drawing = true
var erasing = false
@@ -9,8 +9,10 @@ var focused
var canvas, tools, palette, brush, mode, current_tool
-var color_names = ("white black dark-blue green red dark-red purple orange" +
+var color_names = ("white black dark-blue green red dark-red purple orange " +
"yellow lime dark-cyan cyan blue magenta dark-gray light-gray").split(" ");
+var color_hue_order = ("black dark-blue purple dark-red red orange " +
+ "yellow lime green dark-cyan cyan blue magenta dark-gray light-gray white").split(" ");
var letters = "abcdefghijklmnop";
var colors = {}, controls = {}
color_names.forEach(function(name, i){ colors[name] = i })
@@ -35,7 +37,8 @@ function build () {
})
palette = new Matrix (32, 2, function(x,y){
var lex = new Lex (x,y)
- lex.bg = y>>1
+ console.log(color_hue_order[y>>1])
+ lex.bg = colors[color_hue_order[y>>1]]
lex.build()
return lex
})
diff --git a/js/lex.js b/js/lex.js
index ed4679d..723546a 100644
--- a/js/lex.js
+++ b/js/lex.js
@@ -24,10 +24,10 @@ Lex.prototype.html = function(){
Lex.prototype.irc = function(){
if (this.bg == 1 && this.fg == 0) {
// return "\\x03" + "," + (this.bg&15) + this.char
- return this.char
+ return this.char == "%" ? '%%' : this.char
}
else {
- return "\\x03" + (this.fg&15) + "," + (this.bg&15) + this.char
+ return "\\x03" + (this.fg&15) + "," + (this.bg&15) + (this.char == "%" ? '%%' : this.char)
}
}
Lex.prototype.clone = function (lex){