Skip to content
Permalink
Browse files

write block in commander

  • Loading branch information...
neauoire committed May 23, 2019
1 parent f855ff5 commit 93cbe9a03ade5d820ad31ba32b25ea0dcd168c53
Showing with 7 additions and 8 deletions.
  1. +3 −3 desktop/sources/scripts/commander.js
  2. +4 −5 desktop/sources/scripts/cursor.js
@@ -55,12 +55,12 @@ export default function Commander (terminal) {
'time': (val, run) => { terminal.clock.setFrame(parseInt(val)) },
'write': (val, run) => {
const pos = val.split(';')
const g = pos[0].substr(0, 1)
const t = pos[0].split('')
const x = pos[1] ? parseInt(pos[1]) : terminal.cursor.x
const y = pos[2] ? parseInt(pos[2]) : terminal.cursor.y
if (!isNaN(x) && !isNaN(y) && g) {
if (!isNaN(x) && !isNaN(y) && t.length > 0) {
terminal.cursor.select(x, y)
terminal.orca.write(x, y, g)
terminal.cursor.writeBlock([t])
}
}
}
@@ -73,8 +73,7 @@ export default function Cursor (terminal) {
terminal.update()
}

this.select = function (x, y, w, h) {
console.log(x, y, w, h)
this.select = function (x, y, w = this.w, h = this.h) {
this.moveTo(x, y)
this.scaleTo(w, h)
terminal.update()
@@ -175,10 +174,10 @@ export default function Cursor (terminal) {
if (!block || block.length === 0) { return }
const rect = this.toRect()
let _y = rect.y
for (const lineId in block) {
for (const x in block) {
let _x = rect.x
for (const glyphId in block[lineId]) {
const glyph = block[lineId][glyphId]
for (const y in block[x]) {
const glyph = block[x][y]
terminal.orca.write(_x, _y, overlap === true && glyph === '.' ? terminal.orca.glyphAt(_x, _y) : glyph)
_x++
}

0 comments on commit 93cbe9a

Please sign in to comment.
You can’t perform that action at this time.