Working line-of-text and single key input

Former-commit-id: 339650979ff2cb5ec18b52a9f3f38b281c7862c9
Former-commit-id: d5ebd860afc8d569ba9ab741b6ca7872380af949
This commit is contained in:
Song Minjae
2016-09-21 22:13:48 +09:00
parent 0dabe3971c
commit cbff53ad23
16 changed files with 481 additions and 381 deletions

View File

@@ -14,14 +14,14 @@ object ComputerPartsCodex {
init {
// in kilobytes
rams.put(4864, 128.KiB()) // 64k is not enough for Lua, so we start here.
rams.put(4865, 192.KiB())
rams.put(4866, 256.KiB())
rams.put(4867, 320.KiB()) // 320 * 2 = "640k ought to be enough for anybody" --Someone that is NOT Bill Gates
rams.put(4868, 480.KiB())
rams.put(4869, 512.KiB())
rams.put(4870, 1024.KiB()) // server ops hate it
rams.put(4871, 2048.KiB()) // wait, we can multiplayer?
rams.put(4864, 16.MiB())
rams.put(4865, 24.MiB())
rams.put(4866, 32.MiB())
rams.put(4867, 64.MiB())
rams.put(4868, 96.MiB())
rams.put(4869, 128.MiB())
rams.put(4870, 160.MiB())
rams.put(4871, 256.MiB())
processors.put(4872, 1000)
processors.put(4873, 2000)
@@ -52,4 +52,5 @@ object ComputerPartsCodex {
private fun Int.MB() = this * 1000000 // 1 MB == 1 000 000 bytes, bitches!
private fun Int.kB() = this * 1000
private fun Int.KiB() = this.shr(10)
private fun Int.MiB() = this.shr(20)
}

View File

@@ -14,17 +14,6 @@ import java.util.*
*/
open class FixtureComputerBase() : FixtureBase() {
val processorCycle: Int // number of Lua statement to process per tick (1/100 s)
get() = ComputerPartsCodex.getProcessorCycles(computerInside!!.computerValue.getAsInt("processor") ?: -1)
val memSize: Int // max: 8 GB
get() {
var size = 0
for (i in 0..3)
size += ComputerPartsCodex.getRamSize(computerInside!!.computerValue.getAsInt("memSlot$i") ?: -1)
return size
}
/** Connected terminal */
var terminal: FixtureBasicTerminal? = null
@@ -70,6 +59,7 @@ open class FixtureComputerBase() : FixtureBase() {
fun keyPressed(key: Int, c: Char) {
if (terminal != null) {
terminal!!.vt.keyPressed(key, c)
computerInside!!.keyPressed(key, c)
}
}
}