aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDevine Lu Linvega <[email protected]>2019-04-15 07:35:35 +0900
committerDevine Lu Linvega <[email protected]>2019-04-15 07:35:35 +0900
commitf676fbc8be18cd3c61fdca90904054ee65f596cc (patch)
tree88c7643284464d8111dd72a2ba22570481347747
parent54c199146e6cabc472d839e0ee8d7e2cb62652ae (diff)
downloadOrca-f676fbc8be18cd3c61fdca90904054ee65f596cc.tar.gz
Orca-f676fbc8be18cd3c61fdca90904054ee65f596cc.zip
Added shorthands to commands
-rw-r--r--README.md3
-rw-r--r--desktop/sources/scripts/commander.js24
2 files changed, 21 insertions, 6 deletions
diff --git a/README.md b/README.md
index 7bbcc30..fbfbb21 100644
--- a/README.md
+++ b/README.md
@@ -94,6 +94,8 @@ Some of Orca's features can be **controlled externally** via UDP though port `49
### Commands
+All commands have a shorthand equivalent to their first character, for example, `write` can also be called using `w`.
+
- `play` Plays program.
- `stop` Stops program.
- `run` Runs current frame.
@@ -101,6 +103,7 @@ Some of Orca's features can be **controlled externally** via UDP though port `49
- `goto:aV` Sends cursor to `aV`.
- `bpm:140` Sets bpm speed to `140`.
- `apm:160` Animates bpm speed to `160`.
+- `write:H12;34` Write glyph `H`, at `12,34`.
## Base36 Table
diff --git a/desktop/sources/scripts/commander.js b/desktop/sources/scripts/commander.js
index 57d3aa2..7d91a1f 100644
--- a/desktop/sources/scripts/commander.js
+++ b/desktop/sources/scripts/commander.js
@@ -36,15 +36,27 @@ function Commander (terminal) {
}
this.operations = {
+ 'apm': (val) => { terminal.clock.set(null, parseInt(val)) },
+ 'bpm': (val) => { terminal.clock.set(parseInt(val), parseInt(val), true) },
+ 'goto': (val) => { terminal.cursor.goto(val) },
'play': (val) => { terminal.clock.play() },
+ 'run': (val) => { terminal.run() },
'stop': (val) => { terminal.clock.stop() },
'time': (val) => { terminal.clock.setFrame(parseInt(val)) },
- 'next': (val) => { terminal.clock.setFrame(parseInt(val)) },
- 'back': (val) => { terminal.clock.setFrame(parseInt(val)) },
- 'goto': (val) => { terminal.cursor.goto(val) },
- 'run': (val) => { terminal.run() },
- 'bpm': (val) => { terminal.clock.set(parseInt(val), parseInt(val), true) },
- 'apm': (val) => { terminal.clock.set(null, parseInt(val)) }
+ 'write': (val) => {
+ const g = val.substr(0, 1)
+ const pos = val.substr(1).split(';')
+ const x = parseInt(pos[0])
+ const y = parseInt(pos[1])
+ if (!isNaN(x) && !isNaN(y) && g) {
+ terminal.orca.write(x, y, g)
+ }
+ }
+ }
+
+ // Make shorthands
+ for (const id in this.operations) {
+ this.operations[id.substr(0, 1)] = this.operations[id]
}
this.trigger = function (msg = this.query) {