From dc9bc73529d2b7018d94a8fd8f98ff22b82ee2c1 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Mon, 24 Aug 2020 00:10:18 -0700 Subject: [PATCH] Added mnemonic and pause/pause to resume. --- src/main/kotlin/com/beust/chip8/Main.kt | 10 +++++++--- src/main/resources/main.fxml | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/com/beust/chip8/Main.kt b/src/main/kotlin/com/beust/chip8/Main.kt index 517a79b..7283841 100644 --- a/src/main/kotlin/com/beust/chip8/Main.kt +++ b/src/main/kotlin/com/beust/chip8/Main.kt @@ -45,7 +45,7 @@ class MyFxApp : Application() { // Computer is paused // Update the pause button label - pauseButton?.text = if (newVal) "Resume" else "Pause" + pauseButton?.text = if (newVal) "_Resume" else "_Pause" // Display the disassembly updateDisassembly(disassembly!!, computer.disassemble()) @@ -187,10 +187,14 @@ class MyFxApp : Application() { exitProcess(0) } KeyCode.P -> { - computer.pause() + if (computer.paused) { + computer.start() + } else { + computer.pause() + } } else -> { - if (computer.paused) computer.start() + if (computer.paused && event.code != KeyCode.ALT) computer.start() else { try { val key = Integer.parseInt(event.code.char, 16) diff --git a/src/main/resources/main.fxml b/src/main/resources/main.fxml index f4c3db9..99e45bd 100644 --- a/src/main/resources/main.fxml +++ b/src/main/resources/main.fxml @@ -26,7 +26,7 @@ -