Improve splash alignment

This commit is contained in:
Devine Lu Linvega
2019-07-27 15:41:16 +09:00
parent b844cbbc17
commit 94b062005a
7 changed files with 32 additions and 56 deletions

View File

@@ -213,15 +213,15 @@ function Commander (ronin) {
// Splash
this.splash = `; welcome to ronin - v2.2
this.splash = `; welcome to ronin - v2.21
(clear)
(def align { :x
(sub frame-rect:c 150) :y
(sub frame-rect:m 150)})
; outline
(def frame-rect
(frame))
(def align {
:x (sub (div frame-rect:c 2) 150)
:y (sub frame-rect:m 150)})
(fill
(svg align:x align:y "M15,15 L15,15 L285,15 L285,285 L15,285 Z") "#fff")
; stroke
(stroke
(svg align:x align:y "M60,60 L195,60 A45,45 0 0,1 240,105 A45,45 0 0,1 195,150 L60,150 M195,150 A45,45 0 0,1 240,195 L240,240 ") 5 "#000")`

View File

@@ -162,7 +162,6 @@ function Library (ronin) {
this.guide({ a: { x: rect.x, y: rect.y }, b: { x: pos.x + rect.x, y: pos.y + rect.y } })
this.guide(rect)
this.guide(this.offset(rect, { x: pos.x, y: pos.y }))
ronin.surface.context.drawImage(crop, rect.x, rect.y)
}

View File

@@ -1,6 +1,6 @@
'use strict'
function Lisp (lib = {}, includes = []) {
function Lisp (lib = {}) {
const path = require('path')
const fs = require('fs')
@@ -178,21 +178,12 @@ function Lisp (lib = {}, includes = []) {
.map(function (x) { return x.replace(/!whitespace!/g, ' ') })
}
this.inc = function () {
return includes.reduce((acc, item) => {
const p = path.join(__dirname, `lisp/${item}.lisp`)
if (!fs.existsSync(p)) { console.warn('Lisp', `Missing include: ${p}`); return acc }
return `${acc}(include "${p}") `
}, '')
}
this.parse = function (input) {
return parenthesize(tokenize(input))
}
this.run = async function (input) {
return interpret(this.parse(`(
${this.inc()}
${input})`))
}
}

View File

@@ -11,8 +11,6 @@ function Ronin () {
b_inv: '#ffb545'
}
this.includes = ['prelude']
this.el = document.createElement('div')
this.el.id = 'ronin'
@@ -21,7 +19,7 @@ function Ronin () {
this.commander = new Commander(this)
this.surface = new Surface(this)
this.library = new Library(this)
this.interpreter = new Lisp(this.library, this.includes)
this.interpreter = new Lisp(this.library)
this.osc = new Osc(this)
this.bindings = {}