Cmd+Shift+R to "reload run"

This commit is contained in:
Devine Lu Linvega 2019-07-14 13:54:30 +09:00
parent 7b4e5c3db0
commit fac74b21f8
5 changed files with 31 additions and 17 deletions

View File

@ -41,6 +41,7 @@
ronin.controller.addRole('default', 'Edit', 'delete')
ronin.controller.addRole('default', 'Edit', 'selectall')
ronin.controller.add("default","Project","Run",() => { ronin.commander.run(); },"CmdOrCtrl+R");
ronin.controller.add("default","Project","Reload Run",() => { ronin.source.revert(); ronin.commander.run(); },"CmdOrCtrl+Shift+R");
ronin.controller.add("default","Commander","Toggle",() => { ronin.commander.toggle(); },"CmdOrCtrl+K");
ronin.controller.commit();
ronin.install(document.body);

View File

@ -85,11 +85,11 @@ function Library (ronin) {
this.range = (start, end, step = 1) => {
let arr = []
if (step > 0) {
for(let i = start; i <= end ; i+= step) {
for (let i = start; i <= end; i += step) {
arr.push(i)
}
} else {
for(let i = start; i >= end ; i+= step) {
for (let i = start; i >= end; i += step) {
arr.push(i)
}
}
@ -212,13 +212,14 @@ function Library (ronin) {
// Generics
this.echo = (...args) => {
console.log(args.reduce((acc, val) => { return acc + val + ' ' }, ''))
const msg = args.reduce((acc, val) => { return acc + val + ' ' }, '')
ronin.log(msg)
return args
}
this.print = (arg) => {
console.log(arg)
return arg
this.print = (msg) => {
ronin.log(msg)
return msg
}
this.str = (...args) => {

View File

@ -49,6 +49,7 @@ function Ronin () {
}
this.log = function (msg) {
console.log(msg)
this.commander.setStatus(msg)
}

View File

@ -1,4 +1,24 @@
; Shapes
(
(stroke (circle (div (of (frame) "w") 2) (div (of (frame) "h") 2) 100) 2 "red"))
((clear)
; variables
(def center-w (div (of (frame) "w") 2))
(def center-h (div (of (frame) "h") 2))
(def rad (div (of (frame) "h") 4))
; draw circle
(stroke
(circle center-w center-h rad) 2 "red")
; draw rect
(stroke
(rect
(sub center-w rad) (sub center-h rad) center-h center-h) 2 "red")
; draw line
(stroke
(line
(pos (sub center-w rad) center-h)
(pos (add center-w rad) center-h)))
)

View File

@ -1,9 +0,0 @@
; test file
((clear)
(stroke (rect 15 15 120 80) 2 "red")
(fill (rect 30 30 120 80) "#72dec2")
(clear (rect 45 45 45 45))
(clone (rect 0 0 200 200) (rect 100 100 200 200))
(stroke (line (pos 15 15) (pos 200 200)) 10 "red")
)