mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-12 06:41:51 +09:00
working io.read from STDIN
Former-commit-id: b1168a53fd5fbd09c6a5a76506402560fc4e0fd7 Former-commit-id: a0d455da14a6eb7bf0127e136949273ec5a28628
This commit is contained in:
@@ -213,23 +213,15 @@ class TerrarumComputer(peripheralSlots: Int) {
|
||||
fun keyPressed(key: Int, c: Char) {
|
||||
stdinInput = c.toInt()
|
||||
|
||||
|
||||
System.err.println("TerrarumComputer.keyPressed got input: $stdinInput")
|
||||
|
||||
|
||||
// wake thread
|
||||
runnableRunCommand.resume()
|
||||
|
||||
|
||||
synchronized(stdin!!) {
|
||||
(stdin as java.lang.Object).notifyAll()
|
||||
}
|
||||
}
|
||||
|
||||
fun openStdin() {
|
||||
System.err.println("TerrarumComputer.openStdin")
|
||||
|
||||
|
||||
stdinInput = -1
|
||||
// sleep the thread
|
||||
runnableRunCommand.pause()
|
||||
@@ -344,8 +336,6 @@ class TerrarumComputer(peripheralSlots: Int) {
|
||||
synchronized(pauseLock) {
|
||||
paused = false
|
||||
pauseLock.notifyAll() // Unblocks thread
|
||||
|
||||
System.err.println("ThreadRunCommand resume()")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user