diff options
author | neauoire <[email protected]> | 2019-12-02 10:43:25 -0500 |
---|---|---|
committer | neauoire <[email protected]> | 2019-12-02 10:43:25 -0500 |
commit | 64ab9c284cda13ad68a4c8f544e756992fad4cae (patch) | |
tree | 50376379cd36b9da5750d0e7c94909048682954d | |
parent | 2bcf3bdc69a2b06bd59f3b9b79803805c41b0d6d (diff) | |
download | Orca-64ab9c284cda13ad68a4c8f544e756992fad4cae.tar.gz Orca-64ab9c284cda13ad68a4c8f544e756992fad4cae.zip |
Minor optimizations
-rw-r--r-- | desktop/sources/scripts/client.js | 2 | ||||
-rw-r--r-- | desktop/sources/scripts/core/orca.js | 17 | ||||
-rw-r--r-- | sw.js | 2 |
3 files changed, 6 insertions, 15 deletions
diff --git a/desktop/sources/scripts/client.js b/desktop/sources/scripts/client.js index 0c51308..00d845c 100644 --- a/desktop/sources/scripts/client.js +++ b/desktop/sources/scripts/client.js @@ -12,7 +12,7 @@ /* global Theme */ function Client () { - this.version = 160 + this.version = 161 this.library = library this.theme = new Theme(this) diff --git a/desktop/sources/scripts/core/orca.js b/desktop/sources/scripts/core/orca.js index e5fe5a6..218088a 100644 --- a/desktop/sources/scripts/core/orca.js +++ b/desktop/sources/scripts/core/orca.js @@ -1,7 +1,7 @@ 'use strict' function Orca (library) { - this.keys = Object.keys(library).slice(0, 36) + this.keys = '0123456789abcdefghijklmnopqrstuvwxyz'.split('') this.w = 1 // Default Width this.h = 1 // Default Height @@ -62,22 +62,13 @@ function Orca (library) { for (let y = 0; y < this.h; y++) { for (let x = 0; x < this.w; x++) { const g = this.glyphAt(x, y) - const operator = this.cast(g, x, y) - if (operator) { - a.push(operator) - } + if (g === '.' || !this.isAllowed(g)) { continue } + a.push(new library[g.toLowerCase()](this, x, y, g === g.toUpperCase())) } } return a } - this.cast = function (g, x, y) { - if (g === '.') { return } - if (!library[g.toLowerCase()]) { return } - const passive = g === g.toUpperCase() - return new library[g.toLowerCase()](this, x, y, passive) - } - this.operate = function (operators) { this.release() for (const operator of operators) { @@ -124,7 +115,7 @@ function Orca (library) { let _x = x for (const y in line) { const glyph = line[y] - client.orca.write(_x, _y, overlap === true && glyph === '.' ? this.glyphAt(_x, _y) : glyph) + this.write(_x, _y, overlap === true && glyph === '.' ? this.glyphAt(_x, _y) : glyph) _x++ } _y++ @@ -1,4 +1,4 @@ -// 160 +// 161 const assets = [ './', |