visual tweaks
This commit is contained in:
18
.idea/artifacts/ide_jar.xml
generated
Normal file
18
.idea/artifacts/ide_jar.xml
generated
Normal file
@@ -0,0 +1,18 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" build-on-make="true" name="ide:jar">
|
||||
<output-path>$PROJECT_DIR$/out/artifacts/ide_jar</output-path>
|
||||
<root id="archive" name="ide.jar">
|
||||
<element id="module-output" name="ide" />
|
||||
<element id="module-output" name="befunge" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.2.60/kotlin-stdlib-jdk8-1.2.60.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.3.0/kotlin-stdlib-1.3.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/javax/json/javax.json-api/1.1.2/javax.json-api-1.1.2.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/no/tornado/tornadofx/1.7.17/tornadofx-1.7.17.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/glassfish/javax.json/1.1.2/javax.json-1.1.2.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-common/1.3.0/kotlin-stdlib-common-1.3.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.2.60/kotlin-stdlib-jdk7-1.2.60.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-reflect/1.2.60/kotlin-reflect-1.2.60.jar" path-in-jar="/" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
||||
@@ -29,7 +29,7 @@ class B93Interpreter : Interpreter {
|
||||
override val stdInput = LinkedList<Char>()
|
||||
override val stdOutput = LinkedList<String>()
|
||||
private var outBuf: StringBuffer = StringBuffer()
|
||||
private var bufLimit = 10
|
||||
private var bufLimit = 0
|
||||
|
||||
private val fungeMods = HashMap<Vec,Value>()
|
||||
|
||||
|
||||
@@ -3,8 +3,11 @@ package befide.ide
|
||||
import befide.befunge.core.Interpreter
|
||||
import javafx.animation.Animation
|
||||
import javafx.animation.Timeline
|
||||
import javafx.beans.property.SimpleBooleanProperty
|
||||
import javafx.util.Duration
|
||||
import tornadofx.*
|
||||
import tornadofx.getValue
|
||||
import tornadofx.setValue
|
||||
|
||||
class ActionView(val interp: Interpreter, val codeView: CodeView, val ioView: IOView) : View() {
|
||||
var runTimeline: Timeline = timeline(false) {
|
||||
@@ -19,55 +22,87 @@ class ActionView(val interp: Interpreter, val codeView: CodeView, val ioView: IO
|
||||
cycleCount = Animation.INDEFINITE
|
||||
}
|
||||
|
||||
override val root = hbox {
|
||||
button("step") {
|
||||
setOnAction {
|
||||
val isRunningProperty = SimpleBooleanProperty(false)
|
||||
var isRunning by isRunningProperty
|
||||
|
||||
val canResetProperty = SimpleBooleanProperty(false)
|
||||
var canReset by canResetProperty
|
||||
|
||||
fun start(rate: Double) {
|
||||
stop()
|
||||
|
||||
isRunning = true
|
||||
canReset = true
|
||||
|
||||
interp.funge.values = codeView.values
|
||||
|
||||
runTimeline.rate = rate
|
||||
runTimeline.playFromStart()
|
||||
}
|
||||
|
||||
fun step() {
|
||||
canReset = true
|
||||
|
||||
interp.funge.values = codeView.values
|
||||
|
||||
interp.step()
|
||||
}
|
||||
|
||||
fun stop() {
|
||||
isRunning = false
|
||||
|
||||
runTimeline.stop()
|
||||
}
|
||||
|
||||
button("reset") {
|
||||
setOnAction {
|
||||
fun reset() {
|
||||
stop()
|
||||
interp.reset()
|
||||
ioView.reset()
|
||||
canReset = false
|
||||
}
|
||||
|
||||
codeView.values = interp.funge.values
|
||||
fun clearCode() {
|
||||
reset()
|
||||
codeView.clear()
|
||||
}
|
||||
|
||||
override val root = hbox {
|
||||
button("step") {
|
||||
setOnAction { step() }
|
||||
disableWhen(isRunningProperty)
|
||||
}
|
||||
|
||||
separator { }
|
||||
|
||||
button("run") {
|
||||
setOnAction {
|
||||
interp.funge.values = codeView.values
|
||||
|
||||
runTimeline.rate = 10000.0
|
||||
runTimeline.playFromStart()
|
||||
}
|
||||
setOnAction { start(10000.0) }
|
||||
}
|
||||
|
||||
button("walk") {
|
||||
setOnAction {
|
||||
interp.funge.values = codeView.values
|
||||
|
||||
runTimeline.rate = 50.0
|
||||
runTimeline.playFromStart()
|
||||
}
|
||||
setOnAction { start(50.0) }
|
||||
}
|
||||
|
||||
button("crawl") {
|
||||
setOnAction {
|
||||
interp.funge.values = codeView.values
|
||||
setOnAction { start(4.0) }
|
||||
}
|
||||
|
||||
runTimeline.rate = 4.0
|
||||
runTimeline.playFromStart()
|
||||
}
|
||||
}
|
||||
separator {}
|
||||
|
||||
button("stop") {
|
||||
setOnAction {
|
||||
runTimeline.stop()
|
||||
setOnAction { stop() }
|
||||
enableWhen(isRunningProperty)
|
||||
}
|
||||
|
||||
spacer()
|
||||
|
||||
button("reset") {
|
||||
setOnAction { reset() }
|
||||
enableWhen(canResetProperty.and(isRunningProperty.not()))
|
||||
}
|
||||
|
||||
button("clear") {
|
||||
setOnAction { clearCode() }
|
||||
disableWhen(isRunningProperty)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,14 @@ class CodeView(val interp: Interpreter) : View() {
|
||||
cursorPos = interp.funge.nextVec(cursorPos, delta ?: cursorDelta)
|
||||
}
|
||||
|
||||
fun clear() {
|
||||
for (row in labels) {
|
||||
for (lbl in row) {
|
||||
lbl.value = Value(' ')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var src: String
|
||||
get() = labels.joinToString("\n") { row ->
|
||||
row.dropLastWhile { lbl ->
|
||||
|
||||
@@ -23,9 +23,11 @@ class EditorView : View("Befide") {
|
||||
}
|
||||
|
||||
init {
|
||||
codeView.src = """v ;00000000;
|
||||
>>>>>>>>>>>>>55+0g68*-90g68*-2*+80g68*-4*+70g68*-8*+v
|
||||
@.+***288-*86g03+**88-*86g04+**84-*86g05+**44-*86g06<"""
|
||||
primaryStage.isResizable = false
|
||||
|
||||
// codeView.src = """v ;00000000;
|
||||
//>>>>>>>>>>>>>55+0g68*-90g68*-2*+80g68*-4*+70g68*-8*+v
|
||||
//@.+***288-*86g03+**88-*86g04+**84-*86g05+**44-*86g06<"""
|
||||
|
||||
// codeView.src = """ 2>:3g" "-!v\ g30 <
|
||||
// |!`"O":+1_:.:03p>03g+:"O"`|
|
||||
|
||||
@@ -7,3 +7,7 @@ class MainApp : App(EditorView::class) {
|
||||
importStylesheet(resources["style.css"])
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
launch<MainApp>(args)
|
||||
}
|
||||
@@ -3,7 +3,12 @@ package befide.ide
|
||||
import befide.befunge.b93.padEnd
|
||||
import befide.befunge.core.Interpreter
|
||||
import befide.befunge.state.Value
|
||||
import javafx.beans.property.SimpleListProperty
|
||||
import javafx.beans.property.SimpleObjectProperty
|
||||
import javafx.beans.property.SimpleStringProperty
|
||||
import javafx.collections.FXCollections
|
||||
import javafx.scene.layout.Priority
|
||||
import javafx.scene.text.Font
|
||||
import tornadofx.*
|
||||
import tornadofx.getValue
|
||||
import tornadofx.setValue
|
||||
@@ -11,39 +16,27 @@ import tornadofx.setValue
|
||||
class StackView(val interp: Interpreter) : View() {
|
||||
val charOutProperty = SimpleStringProperty()
|
||||
var charOut by charOutProperty
|
||||
val longOutProperty = SimpleStringProperty()
|
||||
var longOut by longOutProperty
|
||||
|
||||
|
||||
override val root = hbox {
|
||||
textarea(charOutProperty) {
|
||||
maxWidth = 1.0
|
||||
paddingHorizontal = 1
|
||||
prefRowCount = interp.funge.height
|
||||
override val root = textarea(charOutProperty) {
|
||||
addClass("stack-pane")
|
||||
prefWidth = 150.0
|
||||
isEditable = false
|
||||
}
|
||||
textarea(longOutProperty) {
|
||||
prefRowCount = interp.funge.height
|
||||
prefWidth = 90.0
|
||||
isEditable = false
|
||||
}
|
||||
}
|
||||
|
||||
private fun <T> getStackStr(mapping: (Value) -> T): String {
|
||||
return interp.stack.takeLast(interp.funge.height)
|
||||
val num = interp.funge.height - 3
|
||||
return interp.stack.takeLast(num)
|
||||
.map(mapping)
|
||||
.padEnd(interp.funge.height, "")
|
||||
.padEnd(num, "")
|
||||
// .reversed()
|
||||
.joinToString("\n")
|
||||
}
|
||||
|
||||
init {
|
||||
charOut = getStackStr { it.asChar ?: '*' }
|
||||
longOut = getStackStr { it.value }
|
||||
charOut = getStackStr { "${it.asChar ?: '\u2022'} (${it.value})" }
|
||||
|
||||
interp.stackChanged += {
|
||||
charOut = getStackStr { it.asChar ?: '*' }
|
||||
longOut = getStackStr { it.value }
|
||||
interp.stackChanged += { _ ->
|
||||
charOut = getStackStr { "${it.asChar ?: '\u2022'} (${it.value})" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
3
ide/src/main/resources/META-INF/MANIFEST.MF
Normal file
3
ide/src/main/resources/META-INF/MANIFEST.MF
Normal file
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Main-Class: befide.ide.MainApp
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
-fx-font-fill: black;
|
||||
}
|
||||
|
||||
.code, .text-area {
|
||||
.code, .text-area, .stack-pane {
|
||||
-fx-font-family: Consolas, monospace;
|
||||
-fx-text-fill: black;
|
||||
-fx-font-size: 18;
|
||||
@@ -14,7 +14,6 @@
|
||||
-fx-border-radius: 2px;
|
||||
-fx-border-width: 1px;
|
||||
-fx-background-color: #fff;
|
||||
-fx-graphic: none;
|
||||
}
|
||||
|
||||
.code-num {
|
||||
|
||||
Reference in New Issue
Block a user