mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-06-18 10:24:04 +09:00
gui buttons will now trigger the action only once per click
This commit is contained in:
@@ -71,12 +71,7 @@ class VM(
|
||||
init {
|
||||
println("[VM] Creating new VM with ID of $id, memsize $memsize")
|
||||
|
||||
peripheralTable[0] = PeripheralEntry(
|
||||
IOSpace(this),
|
||||
// HW_RESERVE_SIZE,
|
||||
// MMIO_SIZE.toInt() - 256,
|
||||
// 64
|
||||
)
|
||||
peripheralTable[0] = PeripheralEntry(IOSpace(this))
|
||||
}
|
||||
|
||||
fun killAllContexts() {
|
||||
|
||||
@@ -36,16 +36,19 @@ class ProfilesMenu(parent: VMEmuExecutable, x: Int, y: Int, w: Int, h: Int) : Em
|
||||
|
||||
}
|
||||
|
||||
private var guiClickLatched = arrayOf(false, false, false, false, false, false, false, false)
|
||||
|
||||
override fun update() {
|
||||
|
||||
if (Gdx.input.isButtonPressed(Buttons.LEFT)) {
|
||||
if (!guiClickLatched[Buttons.LEFT]) {
|
||||
val mx = Gdx.input.x - x
|
||||
val my = Gdx.input.y - y
|
||||
|
||||
// make profile list work
|
||||
if (mx in 10 until 10+228) {
|
||||
if (my in 11 until 11+446) {
|
||||
val li = (my - 11) / (2*FONT.H)
|
||||
if (mx in 10 until 10 + 228) {
|
||||
if (my in 11 until 11 + 446) {
|
||||
val li = (my - 11) / (2 * FONT.H)
|
||||
|
||||
if (li < profileNames.size - profilesScroll)
|
||||
selectedProfileIndex = li + profilesScroll
|
||||
@@ -79,16 +82,21 @@ class ProfilesMenu(parent: VMEmuExecutable, x: Int, y: Int, w: Int, h: Int) : Em
|
||||
|
||||
println("vm: $profileName; isRunning = ${theVM.isRunning}; mx = $mx")
|
||||
|
||||
if (mx in 377..390 && theVM.isRunning) {
|
||||
if (mx in 374..394 && theVM.isRunning) {
|
||||
parent.killVMenv(theVM)
|
||||
}
|
||||
else if (mx in 398..412 && !theVM.isRunning) {
|
||||
else if (mx in 395..415 && !theVM.isRunning) {
|
||||
parent.initVMenv(theVM)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
guiClickLatched[Buttons.LEFT] = true
|
||||
}
|
||||
}
|
||||
else {
|
||||
guiClickLatched[Buttons.LEFT] = false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ class VMEmuExecutable(val windowWidth: Int, val windowHeight: Int, var panelsX:
|
||||
private fun changeActiveSession(index: Int?) {
|
||||
currentVMselection = index
|
||||
// TODO somehow implement the inputstream that cares about the currentVMselection
|
||||
Gdx.input.inputProcessor = if (currentVMselection != null) vms[currentVMselection!!]?.vm?.getIO() else vmEmuInputProcessor
|
||||
Gdx.input.inputProcessor = if (currentVMselection != null) vms[currentVMselection!!]?.vm?.getIO() ?: null else vmEmuInputProcessor
|
||||
}
|
||||
|
||||
internal fun initVMenv(vm: VM) {
|
||||
@@ -214,6 +214,9 @@ class VMEmuExecutable(val windowWidth: Int, val windowHeight: Int, var panelsX:
|
||||
|
||||
vmRunners[vm.id]?.close()
|
||||
coroutineJobs[vm.id]?.cancel()
|
||||
|
||||
// re-create the IOSpace (peripheral index 0)
|
||||
vm.peripheralTable[0] = PeripheralEntry(IOSpace(vm))
|
||||
}
|
||||
|
||||
private fun setCameraPosition(newX: Float, newY: Float) {
|
||||
|
||||
Reference in New Issue
Block a user