aboutsummaryrefslogtreecommitdiffhomepage
path: root/desktop/sources/scripts/terminal.js
diff options
context:
space:
mode:
authorDevine Lu Linvega <[email protected]>2018-10-16 10:24:09 +1200
committerDevine Lu Linvega <[email protected]>2018-10-16 10:24:09 +1200
commit66088f9d69ad20a20463937e22124b87e7a93da3 (patch)
treef2de74d10f6181dbceca211117c7f79b7b7f6297 /desktop/sources/scripts/terminal.js
parent90ec8e3f23d3bbcfcf8f7ba4fe5f59222ed8bbec (diff)
downloadOrca-66088f9d69ad20a20463937e22124b87e7a93da3.tar.gz
Orca-66088f9d69ad20a20463937e22124b87e7a93da3.zip
Implemented BPM
Diffstat (limited to 'desktop/sources/scripts/terminal.js')
-rw-r--r--desktop/sources/scripts/terminal.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/desktop/sources/scripts/terminal.js b/desktop/sources/scripts/terminal.js
index bc84dfc..e68f399 100644
--- a/desktop/sources/scripts/terminal.js
+++ b/desktop/sources/scripts/terminal.js
@@ -8,6 +8,7 @@ function Terminal (pico) {
this.is_paused = false
this.tile = { w: 12, h: 20 }
this.debug = "hello."
+ this.timer = null
this.cursor = {
x: 0,
@@ -25,7 +26,7 @@ function Terminal (pico) {
},
inspect: function () {
const g = pico.glyphAt(this.x, this.y)
- return pico.docs[g] ? pico.docs[g] : 'idle.'
+ return pico.docs[g] ? pico.docs[g] : `${this.x},${this.y}`
}
}
@@ -57,7 +58,15 @@ function Terminal (pico) {
this.log("Started.")
this.update()
- setInterval(() => { this.run() }, 200)
+ this.setSpeed(120)
+ }
+
+ this.setSpeed = function(bpm)
+ {
+ this.log(`Changed speed to ${bpm}.`)
+ const ms = (60000/bpm)/4
+ clearInterval(this.timer);
+ this.timer = setInterval(() => { this.run() }, ms)
}
this.run = function () {
@@ -174,7 +183,6 @@ function Terminal (pico) {
this.clear = function () {
const ctx = this.context()
-
ctx.clearRect(0, 0, this.size.width, this.size.height)
}