diff options
author | Devine Lu Linvega <[email protected]> | 2018-12-02 08:03:18 +1200 |
---|---|---|
committer | Devine Lu Linvega <[email protected]> | 2018-12-02 08:03:18 +1200 |
commit | aee5fbd7151f551ab6883a0284fffa80eb925258 (patch) | |
tree | 62e08d2ae6a4ffa99031b2f4f857a1a24e9409fc | |
parent | a56dc3af9229fba430ae0ed0661426303967b93a (diff) | |
download | Orca-aee5fbd7151f551ab6883a0284fffa80eb925258.tar.gz Orca-aee5fbd7151f551ab6883a0284fffa80eb925258.zip |
Made X and P passive.
-rw-r--r-- | desktop/core/library/p.js | 4 | ||||
-rw-r--r-- | desktop/core/library/x.js | 4 | ||||
-rw-r--r-- | desktop/sources/index.html | 2 | ||||
-rw-r--r-- | desktop/sources/scripts/history.js | 19 | ||||
-rw-r--r-- | desktop/sources/scripts/source.js | 6 | ||||
-rw-r--r-- | desktop/sources/scripts/terminal.js | 1 |
6 files changed, 26 insertions, 10 deletions
diff --git a/desktop/core/library/p.js b/desktop/core/library/p.js index df0aea5..55c5e91 100644 --- a/desktop/core/library/p.js +++ b/desktop/core/library/p.js @@ -3,7 +3,7 @@ const Operator = require('../operator') function OperatorP (orca, x, y, passive) { - Operator.call(this, orca, x, y, 'p', passive) + Operator.call(this, orca, x, y, 'p', true) this.name = 'push' this.info = 'Writes an eastward operator with offset.' @@ -23,7 +23,7 @@ function OperatorP (orca, x, y, passive) { } this.run = function () { - if (!this.bang()) { return } + if (!passive && !this.bang()) { return } this.draw = false diff --git a/desktop/core/library/x.js b/desktop/core/library/x.js index 55cd141..65177f8 100644 --- a/desktop/core/library/x.js +++ b/desktop/core/library/x.js @@ -3,7 +3,7 @@ const Operator = require('../operator') function OperatorX (orca, x, y, passive) { - Operator.call(this, orca, x, y, 'x', passive) + Operator.call(this, orca, x, y, 'x', true) this.name = 'teleport' this.info = 'Writes a distant operator with offset.' @@ -20,7 +20,7 @@ function OperatorX (orca, x, y, passive) { } this.run = function () { - if (!this.bang()) { return } + if (!passive && !this.bang()) { return } this.draw = false diff --git a/desktop/sources/index.html b/desktop/sources/index.html index dddbfbc..32478ea 100644 --- a/desktop/sources/index.html +++ b/desktop/sources/index.html @@ -44,6 +44,8 @@ terminal.controller.add("default","Edit","Copy",() => { terminal.cursor.copy(); },"CmdOrCtrl+C") terminal.controller.add("default","Edit","Cut",() => { terminal.cursor.cut(); },"CmdOrCtrl+X") terminal.controller.add("default","Edit","Paste",() => { terminal.cursor.paste(); },"CmdOrCtrl+V") + terminal.controller.add("default","Edit","Undo",() => { terminal.history.undo(); },"CmdOrCtrl+Z") + terminal.controller.add("default","Edit","Redo",() => { terminal.history.redo(); },"CmdOrCtrl+Shift+Z") terminal.controller.add("default","Program","Play/Pause",() => { terminal.pause(); },"Space") terminal.controller.add("default","Program","Incr. Speed",() => { terminal.modSpeed(1); },">") diff --git a/desktop/sources/scripts/history.js b/desktop/sources/scripts/history.js new file mode 100644 index 0000000..a19cdb7 --- /dev/null +++ b/desktop/sources/scripts/history.js @@ -0,0 +1,19 @@ +'use strict' + +function History() +{ + this.record = function() + { + + } + + this.undo = function() + { + + } + + this.redo = function() + { + + } +}
\ No newline at end of file diff --git a/desktop/sources/scripts/source.js b/desktop/sources/scripts/source.js index 2d032ed..483d72a 100644 --- a/desktop/sources/scripts/source.js +++ b/desktop/sources/scripts/source.js @@ -60,16 +60,10 @@ function Source (orca, terminal) { this.read = function (path) { fs.readFile(path, 'utf8', function (err, data) { if (err) throw err - if (!terminal.source.validate(data)) { console.warn('Invalid File'); return } terminal.load(data.trim()) }) } - this.validate = function (data) { - // TODO - return true - } - this.name = function () { const parts = this.path.split('/') return parts[parts.length - 1].replace('.orca', '').trim() diff --git a/desktop/sources/scripts/terminal.js b/desktop/sources/scripts/terminal.js index ed89b62..a2b2a87 100644 --- a/desktop/sources/scripts/terminal.js +++ b/desktop/sources/scripts/terminal.js @@ -3,6 +3,7 @@ function Terminal (orca, tile = { w: 20, h: 30 }) { const Cursor = require('./cursor') const Source = require('./source') + const History = require('./history') const IO = require('./io') this.io = new IO(this) |