mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 18:44:05 +09:00
working io.read from STDIN
Former-commit-id: b1168a53fd5fbd09c6a5a76506402560fc4e0fd7 Former-commit-id: a0d455da14a6eb7bf0127e136949273ec5a28628
This commit is contained in:
@@ -206,6 +206,8 @@ class GraphicsTerminal(private val host: TerrarumComputer) : Terminal {
|
||||
)
|
||||
(0..displacement - 1).forEach { rgba[it] = 0.toByte() }
|
||||
}
|
||||
|
||||
cursorY += -amount
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,35 +8,16 @@ import java.io.InputStream
|
||||
*/
|
||||
class TerminalInputStream(val host: TerrarumComputer) : InputStream() {
|
||||
|
||||
private val pauseLock = java.lang.Object()
|
||||
|
||||
override fun read(): Int {
|
||||
System.err.println("TerminalInputStream.read called")
|
||||
|
||||
//System.err.println(Thread.currentThread().name)
|
||||
// would display "LuaJ Separated", which means this InputStream will not block main thread
|
||||
|
||||
|
||||
host.openStdin()
|
||||
|
||||
|
||||
synchronized(this) {
|
||||
(this as java.lang.Object).wait()
|
||||
}
|
||||
|
||||
System.err.println("TerminalInputStream.read exit")
|
||||
|
||||
|
||||
|
||||
return host.stdinInput
|
||||
}
|
||||
|
||||
override fun read(b: ByteArray?): Int {
|
||||
TODO()
|
||||
}
|
||||
|
||||
override fun read(b: ByteArray?, off: Int, len: Int): Int {
|
||||
TODO()
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user