mirror of
https://github.com/ethauvin/chip-8.git
synced 2025-04-25 16:57:12 -07:00
commit
87f6d21a93
1 changed files with 6 additions and 1 deletions
|
@ -3,6 +3,7 @@ package com.beust.chip8
|
||||||
import com.beust.jcommander.JCommander
|
import com.beust.jcommander.JCommander
|
||||||
import com.beust.jcommander.Parameter
|
import com.beust.jcommander.Parameter
|
||||||
import javafx.application.Application
|
import javafx.application.Application
|
||||||
|
import javafx.application.Platform
|
||||||
import javafx.beans.property.SimpleBooleanProperty
|
import javafx.beans.property.SimpleBooleanProperty
|
||||||
import javafx.beans.property.SimpleStringProperty
|
import javafx.beans.property.SimpleStringProperty
|
||||||
import javafx.event.EventHandler
|
import javafx.event.EventHandler
|
||||||
|
@ -97,6 +98,10 @@ class MyFxApp : Application() {
|
||||||
}
|
}
|
||||||
|
|
||||||
primaryStage.title = "CHIP-8"
|
primaryStage.title = "CHIP-8"
|
||||||
|
primaryStage.onCloseRequest = EventHandler {
|
||||||
|
Platform.exit()
|
||||||
|
exitProcess(0)
|
||||||
|
}
|
||||||
val url = this::class.java.classLoader.getResource("main.fxml")
|
val url = this::class.java.classLoader.getResource("main.fxml")
|
||||||
val loader = FXMLLoader(url)
|
val loader = FXMLLoader(url)
|
||||||
val res = url.openStream()
|
val res = url.openStream()
|
||||||
|
@ -190,7 +195,7 @@ class MyFxApp : Application() {
|
||||||
try {
|
try {
|
||||||
val key = Integer.parseInt(event.code.char, 16)
|
val key = Integer.parseInt(event.code.char, 16)
|
||||||
keyListener.onKey(key)
|
keyListener.onKey(key)
|
||||||
} catch(ex: NumberFormatException) {
|
} catch (ex: NumberFormatException) {
|
||||||
println("Can't parse key " + event.code.char + ", ignoring")
|
println("Can't parse key " + event.code.char + ", ignoring")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue