initial commit: overall class structure and small maven-compatible tornadofx app
This commit is contained in:
46
ide/src/main/kotlin/befide/ide/Sample.kt
Normal file
46
ide/src/main/kotlin/befide/ide/Sample.kt
Normal file
@@ -0,0 +1,46 @@
|
||||
package befide.ide
|
||||
|
||||
import befide.befunge.b93.B93Interpreter
|
||||
import befide.befunge.core.Interpreter
|
||||
import javafx.beans.property.SimpleIntegerProperty
|
||||
import javafx.scene.Parent
|
||||
import javafx.scene.control.Label
|
||||
import tornadofx.*
|
||||
|
||||
class SampleView : View() {
|
||||
private val controller: SampleController by inject()
|
||||
|
||||
override val root: Parent by fxml()
|
||||
|
||||
private val width: Label by fxid()
|
||||
private val height: Label by fxid()
|
||||
|
||||
init {
|
||||
importStylesheet(resources["style.css"])
|
||||
|
||||
width.bind(controller.width)
|
||||
height.bind(controller.height)
|
||||
}
|
||||
}
|
||||
|
||||
class SampleController : Controller() {
|
||||
private val bf: Interpreter = B93Interpreter()
|
||||
|
||||
val width = SimpleIntegerProperty()
|
||||
val height = SimpleIntegerProperty()
|
||||
|
||||
init {
|
||||
bf.fungeChanged += { updateFungeLabels() }
|
||||
|
||||
updateFungeLabels()
|
||||
}
|
||||
|
||||
fun updateFungeLabels() {
|
||||
width.set(bf.funge.width)
|
||||
height.set(bf.funge.height)
|
||||
}
|
||||
}
|
||||
|
||||
class SampleApp : App() {
|
||||
override val primaryView = SampleView::class
|
||||
}
|
||||
16
ide/src/main/resources/befide/ide/SampleView.fxml
Normal file
16
ide/src/main/resources/befide/ide/SampleView.fxml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
<GridPane alignment="CENTER" minHeight="-Infinity" minWidth="-Infinity" prefHeight="200.0" prefWidth="300.0"
|
||||
xmlns="http://javafx.com/javafx/8.0.172-ea" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<Label text="Width: " styleClass="lbl"
|
||||
fx:id="widthLabel"/>
|
||||
<Label text="Height: " styleClass="lbl"
|
||||
fx:id="heightLabel" GridPane.rowIndex="1"/>
|
||||
<Label text="{width}" styleClass="val"
|
||||
fx:id="width" GridPane.columnIndex="1"/>
|
||||
<Label text="{height}" styleClass="val"
|
||||
fx:id="height" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
|
||||
</GridPane>
|
||||
16
ide/src/main/resources/befide/ide/style.css
Normal file
16
ide/src/main/resources/befide/ide/style.css
Normal file
@@ -0,0 +1,16 @@
|
||||
.lbl {
|
||||
-fx-text-fill: maroon;
|
||||
}
|
||||
|
||||
.val {
|
||||
-fx-font-weight: bold;
|
||||
}
|
||||
|
||||
#heightLabel {
|
||||
-fx-font-style: italic;
|
||||
}
|
||||
|
||||
GridPane {
|
||||
-fx-font-size: 20px;
|
||||
-fx-font-family: Consolas, monospace;
|
||||
}
|
||||
Reference in New Issue
Block a user