diff options
author | Devine Lu Linvega <[email protected]> | 2019-04-15 07:35:35 +0900 |
---|---|---|
committer | Devine Lu Linvega <[email protected]> | 2019-04-15 07:35:35 +0900 |
commit | f676fbc8be18cd3c61fdca90904054ee65f596cc (patch) | |
tree | 88c7643284464d8111dd72a2ba22570481347747 /desktop/sources/scripts/commander.js | |
parent | 54c199146e6cabc472d839e0ee8d7e2cb62652ae (diff) | |
download | Orca-f676fbc8be18cd3c61fdca90904054ee65f596cc.tar.gz Orca-f676fbc8be18cd3c61fdca90904054ee65f596cc.zip |
Added shorthands to commands
Diffstat (limited to 'desktop/sources/scripts/commander.js')
-rw-r--r-- | desktop/sources/scripts/commander.js | 24 |
1 files changed, 18 insertions, 6 deletions
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) { |