NAT Godot make tabs and entries without crashing
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
(loadFrom "kiss-godot" "src/kiss_godot/Util.kiss")
|
||||
|
||||
(defNew [&prop :GodotUI godotUI
|
||||
&prop :Node rootNode]
|
||||
&prop :RootNode rootNode]
|
||||
(super
|
||||
godotUI
|
||||
->[archive e] (hasComponent e Name)
|
||||
@@ -12,7 +12,7 @@
|
||||
:PanelContainer ePanel (cast (ePanelScene.instance))
|
||||
:Label eLabel (getNode ePanel "EntryLabel")]
|
||||
(set eLabel.text (readComponentOr e Name ""))
|
||||
(.addChild (getNode pgScrollContainer "Entries") ePanel)
|
||||
(pgEntries.addChild ePanel)
|
||||
ePanel)
|
||||
// Draw line:
|
||||
->[archive e pos e2 pos2 &opt ui]
|
||||
@@ -22,10 +22,12 @@
|
||||
null))
|
||||
|
||||
(prop &mut :ScrollContainer pgScrollContainer null)
|
||||
(prop &mut :Node pgEntries null)
|
||||
|
||||
(method &override :Void switchPlaygroundKey [key]
|
||||
(super.switchPlaygroundKey key)
|
||||
(set pgScrollContainer (getNode rootNode key)))
|
||||
(method &override :Void switchPlaygroundKey [:String key]
|
||||
(set pgScrollContainer (getNode rootNode.pgTabs key))
|
||||
(set pgEntries (getNode pgScrollContainer "Entries"))
|
||||
(super.switchPlaygroundKey key))
|
||||
|
||||
(method &override :Void clear [:ColorF color]
|
||||
null)
|
@@ -32,14 +32,7 @@
|
||||
(method :Void chooseBetweenStrings [:String prompt :Array<String> choices :String->Void resolve] (throw "TODO Not implemented!"))
|
||||
|
||||
(defNew [&prop :Archive archive
|
||||
&prop :Node rootNode]
|
||||
&prop :RootNode rootNode]
|
||||
[
|
||||
:EntryPanelSystem pgSystem (new EntryPanelSystem this rootNode)
|
||||
:TabContainer pgTabs (getNode rootNode "PlaygroundTabContainer")
|
||||
:PackedScene pgScene (GD.load "res://Playground.tscn")
|
||||
]
|
||||
|
||||
(doFor =>key playground archive.playgrounds
|
||||
(let [pg (pgScene.instance)]
|
||||
(set pg.name key)
|
||||
(pgTabs.addChild pg))))
|
||||
])
|
@@ -1,9 +1,26 @@
|
||||
(loadFrom "kiss-godot" "src/kiss_godot/Util.kiss")
|
||||
|
||||
(prop &mut :TabContainer pgTabs)
|
||||
(prop &mut :PackedScene pgScene)
|
||||
|
||||
(method &override &public :Void _Ready []
|
||||
(printThroughGD)
|
||||
|
||||
(set pgTabs (getNode this "PlaygroundTabContainer"))
|
||||
(set pgScene (GD.load "res://Playground.tscn"))
|
||||
|
||||
// TODO find a better way to pass the archiveDir to a Godot game
|
||||
(let [archiveDir
|
||||
(or (Sys.getEnv "NAT_DIR") (throw "NAT_DIR environment variable must be set"))
|
||||
archive
|
||||
(new Archive archiveDir)
|
||||
ui (new GodotUI archive this)
|
||||
(new Archive archiveDir)]
|
||||
|
||||
(doFor =>key playground archive.playgrounds
|
||||
(unless (= key "default")
|
||||
(let [pg (pgScene.instance)]
|
||||
(set pg.name key)
|
||||
(pgTabs.addChild pg))))
|
||||
|
||||
(let [ui (new GodotUI archive this)
|
||||
controller (new ArchiveController archive ui)]
|
||||
(set ui.controller controller)))
|
||||
(set ui.controller controller))))
|
Reference in New Issue
Block a user