summaryrefslogtreecommitdiff
path: root/js/app.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-11-21 23:29:44 -0500
committerJules Laplace <jules@okfoc.us>2014-11-21 23:29:44 -0500
commit4a674cd3089346a02f6ffd3e6686e3b7fd01a367 (patch)
tree1ed6b356f4449c638a8ec73d8f381578e88f8d45 /js/app.js
parent37e95b5b5944cea70504dd47c1288927b027c69c (diff)
shader
Diffstat (limited to 'js/app.js')
-rw-r--r--js/app.js31
1 files changed, 22 insertions, 9 deletions
diff --git a/js/app.js b/js/app.js
index 3f2a206..4c5100a 100644
--- a/js/app.js
+++ b/js/app.js
@@ -22,14 +22,9 @@ function init () {
function build () {
canvas = new Matrix (cols, rows, function(x,y){
var lex = new Lex (x,y)
- if (x > y || y > x + 20 || x > y / 4 + 10) {
- lex.clear()
- }
- else {
- lex.bg = x+y*y
- lex.fg = (x+y)%2
- lex.char = ":"
- }
+ //
+ shader(lex, x, y)
+ //
lex.build()
return lex
})
@@ -90,6 +85,8 @@ function build () {
controls.width = new Lex (width_el)
controls.height = new Lex (height_el)
+ controls.canvas_width = new Lex (canvas_width_el)
+ controls.canvas_height = new Lex (canvas_height_el)
controls.circle.focus()
@@ -144,7 +141,7 @@ function bind () {
dragging = erasing = false
});
- [controls.width, controls.height].forEach(function(lex){
+ [controls.width, controls.height, controls.canvas_width, controls.canvas_height].forEach(function(lex){
lex.span.addEventListener('mousedown', function(e){
lex.focus()
})
@@ -170,6 +167,22 @@ function bind () {
brush.h = n
brush.rebuild()
})
+
+ controls.canvas_width.key = int_key(function(n, keyCode){
+ controls.canvas_width.blur()
+ controls.canvas_width.char = ""+n
+ controls.canvas_width.build()
+ brush.w = n
+ brush.rebuild()
+ })
+ controls.canvas_height.key = int_key(function(n, keyCode){
+ controls.canvas_height.blur()
+ controls.canvas_height.char = ""+n
+ controls.canvas_height.build()
+ brush.h = n
+ brush.rebuild()
+ })
+
window.addEventListener('keydown', function(e){
if (! e.metaKey && ! e.ctrlKey && ! e.altKey) {
e.preventDefault()