Merge branch 'master' of github.com:lctrt/Ronin

This commit is contained in:
Quentin Leonetti 2019-07-13 14:50:27 +02:00
commit a386b2a3cf
3 changed files with 35 additions and 2 deletions

View File

@ -28,7 +28,7 @@ function Theme (_default) {
this.load = function (data) {
const theme = parse(data)
if (!validate(theme)) { console.warn('Theme', 'Not a theme', theme); return }
if (!validate(theme)) { return }
console.log('Theme', `Loaded theme!`)
this.el.innerHTML = `:root { --background: ${theme.background}; --f_high: ${theme.f_high}; --f_med: ${theme.f_med}; --f_low: ${theme.f_low}; --f_inv: ${theme.f_inv}; --b_high: ${theme.b_high}; --b_med: ${theme.b_med}; --b_low: ${theme.b_low}; --b_inv: ${theme.b_inv}; }`
localStorage.setItem('theme', JSON.stringify(theme))

View File

@ -91,4 +91,21 @@ function Library (ronin) {
this.of = function (h, k) {
return h[k]
}
// Math
this.add = function (a, b) {
return a + b
}
this.sub = function (a, b) {
return a - b
}
this.mul = function (a, b) {
return a * b
}
this.div = function (a, b) {
return a / b
}
}

View File

@ -16,5 +16,21 @@
(pos 0 (of (frame) "h")))
1 "red")
(stroke (line (pos 0 0) (pos (of (frame) "w") (of (frame) "h"))) 1 "red")
(stroke
(line
(pos (div (of (frame) "w") 2) 0)
(pos (div (of (frame) "w") 2) (of (frame) "h")))
1 "red")
(stroke
(line
(pos 0 (div (of (frame) "h") 2))
(pos (div (of (frame) "w") 2) (of (frame) "h")))
1 "#72dec2")
(stroke
(line
(pos (div (of (frame) "w") 2) 0)
(pos (of (frame) "w") (div (of (frame) "h") 2)))
1 "#72dec2")
)