move standalone projects into own directory
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
(loadFrom "kiss-godot" "src/kiss_godot/Util.kiss")
|
||||
|
||||
(prop &mut :TabContainer pgTabs)
|
||||
(prop &mut :PackedScene pgScene)
|
||||
(prop &mut :VBoxContainer uiContainer)
|
||||
|
||||
(defNew []
|
||||
[
|
||||
// TODO find a better way to pass the archiveDir to a Godot game
|
||||
:Archive archive
|
||||
(let [archiveDir (or (Sys.getEnv "NAT_DIR") (throw "NAT_DIR environment variable must be set"))]
|
||||
(new Archive archiveDir))
|
||||
:GodotUI ui
|
||||
(new GodotUI archive this)
|
||||
]
|
||||
&first (super))
|
||||
|
||||
(method &override &public :Void _Ready []
|
||||
(printThroughGD)
|
||||
|
||||
(set pgTabs (getNode this "PlaygroundTabContainer"))
|
||||
(set pgScene (GD.load "res://Playground.tscn"))
|
||||
(set uiContainer (getNode this "UIPanel/ScrollContainer/UIContainer"))
|
||||
|
||||
(doFor =>key playground archive.playgrounds
|
||||
(unless (= key "default")
|
||||
(let [pg (pgScene.instance)]
|
||||
(set pg.name key)
|
||||
(pgTabs.addChild pg))))
|
||||
|
||||
(set ui.controller (new ArchiveController archive ui)))
|
||||
|
||||
(method &override &public :Void _Process [:Float delta]
|
||||
(when (Input.isActionJustPressed "type_command")
|
||||
(ui.controller.typeCommand))
|
||||
|
||||
(when (Input.isActionJustPressed "type_shortcut")
|
||||
0 **(ui.controller.typeShortcut)))
|
||||
|
||||
(method :Void _on_PlaygroundTabContainer_tab_changed [:Int tab]
|
||||
(when ui.controller (.switchPlaygroundKey (ui.playgroundSystem) .name (pgTabs.getChild tab))))
|
||||
|
||||
(prop &mut :String->Void resolveString null)
|
||||
|
||||
(method :Void _on_LineEdit_text_entered [:String text]
|
||||
(let [rs resolveString]
|
||||
(set resolveString null)
|
||||
(rs text)))
|
||||
|
||||
(prop &mut :Position->Void resolvePosition null)
|
||||
|
||||
(method &override &public :Void _Input [:InputEvent event]
|
||||
(typeCase [event]
|
||||
([:InputEventMouseButton mouseButtonEvent]
|
||||
(when (= mouseButtonEvent.buttonIndex ButtonList.Left)
|
||||
(whenLet [rp resolvePosition]
|
||||
(set resolvePosition null)
|
||||
(rp (GodotUI.vector2ToPosition (.getMousePosition (getViewport)))))))
|
||||
(otherwise)))
|
||||
|
||||
(prop &mut :Float->Void resolveFloat)
|
||||
|
||||
(method :Void _on_NaNButton_pressed []
|
||||
(resolveFloat Math.NaN))
|
||||
|
||||
(method :Void _on_SubmitNumberButton_pressed [:SpinBox spinBox]
|
||||
(resolveFloat spinBox.value))
|
Reference in New Issue
Block a user