generated from rnentjes/kotlin-server-web-undertow
Remove legacy JVM-specific file system, shell, and related implementations; migrate to platform-agnostic and common main modules.
This commit is contained in:
26
src/commonMain/kotlin/mtmc/emulator/MTMCIO.kt
Normal file
26
src/commonMain/kotlin/mtmc/emulator/MTMCIO.kt
Normal file
@@ -0,0 +1,26 @@
|
||||
package mtmc.emulator
|
||||
|
||||
class MTMCIO {
|
||||
var value: Int = 0
|
||||
|
||||
internal enum class Buttons(val mask: Int) {
|
||||
UP(128),
|
||||
DOWN(64),
|
||||
LEFT(32),
|
||||
RIGHT(16),
|
||||
START(8),
|
||||
SELECT(4),
|
||||
B(2),
|
||||
A(1)
|
||||
}
|
||||
|
||||
fun keyPressed(key: String) {
|
||||
val button = Buttons.valueOf(key.uppercase())
|
||||
value = value or button.mask
|
||||
}
|
||||
|
||||
fun keyReleased(key: String) {
|
||||
val button = Buttons.valueOf(key.uppercase())
|
||||
value = value and button.mask.inv()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user