diff --git a/desktop/sources/scripts/commander.js b/desktop/sources/scripts/commander.js index 852b2b9..658c34a 100644 --- a/desktop/sources/scripts/commander.js +++ b/desktop/sources/scripts/commander.js @@ -33,6 +33,7 @@ function Commander (ronin) { this.run = (txt = this._input.value) => { if (txt.indexOf('$') > -1) { ronin.log('Present: $'); return } + ronin.surface.maximize() ronin.interpreter.run(txt) ronin.always === true && requestAnimationFrame(() => this.run(txt)) } diff --git a/desktop/sources/scripts/library.js b/desktop/sources/scripts/library.js index 35b48b2..0bd9482 100644 --- a/desktop/sources/scripts/library.js +++ b/desktop/sources/scripts/library.js @@ -31,8 +31,8 @@ function Library (ronin) { return { x, y, w, h, t } } - this.circle = (x, y, r, t = 'circle') => { // Returns a circle shape. - return { x, y, r, t } + this.circle = (cx, cy, r, t = 'circle') => { // Returns a circle shape. + return { cx, cy, r, t } } this.line = (a, b, t = 'line') => { // Returns a line shape. @@ -345,6 +345,11 @@ function Library (ronin) { return args } + this.table = (arg) => { + console.table(arg) + return arg + } + this.time = (rate = 1) => { // Returns timestamp in milliseconds. return (Date.now() * rate) } diff --git a/desktop/sources/scripts/surface.js b/desktop/sources/scripts/surface.js index b2ee463..78ec8c9 100644 --- a/desktop/sources/scripts/surface.js +++ b/desktop/sources/scripts/surface.js @@ -100,7 +100,7 @@ function Surface (ronin) { } this.traceCircle = function (circle, context) { - context.arc(circle.x, circle.y, circle.r, 0, 2 * Math.PI) + context.arc(circle.cx, circle.cy, circle.r, 0, 2 * Math.PI) } this.traceText = function (text, context) { diff --git a/examples/stars.lisp b/examples/stars.lisp new file mode 100644 index 0000000..920843d --- /dev/null +++ b/examples/stars.lisp @@ -0,0 +1,51 @@ +; stars +(clear) +; +(defn deg-rad + (deg) + (mul deg + (div PI 180))) +; +(defn circle-pos + (cx cy r a) {:x + (add cx + (mul r + (cos a))) :y + (add cy + (mul r + (sin a)))}) +; +(defn draw-spoke + (cx cy r a) + ( + (stroke + (line + (pos cx cy) + (circle-pos cx cy r a)) 2 "white"))) +; +(defn draw-star + (cx cy r c) + ( + (times c + (lambda + (i) + ( + (draw-spoke cx cy r + (deg-rad + (mul i + (div 360 c))))))))) +; main +(times 100 + (λ + () + ( + (draw-star + (random 100 + (of + (frame) :w)) + (random 100 + (of + (frame) :h)) + (random 10 100) + (floor + (random 3 32)))))) \ No newline at end of file