NAT Godot make playground tabs and entry panels
This commit is contained in:
@@ -16,13 +16,13 @@ func _ready():
|
||||
# pass
|
||||
|
||||
|
||||
func _on_EntryContainer_mouse_entered():
|
||||
func _on_EntryPanel_mouse_entered():
|
||||
var current_focus_z = get_parent().current_focus_z
|
||||
if is_nan(current_focus_z) or current_focus_z <= self.z:
|
||||
get_parent().current_focus = self
|
||||
get_parent().current_focus_z = self.z
|
||||
|
||||
func _on_EntryContainer_mouse_exited():
|
||||
func _on_EntryPanel_mouse_exited():
|
||||
if get_parent().current_focus == self:
|
||||
get_parent().current_focus = null
|
||||
get_parent().current_focus_z = NAN
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package;
|
||||
|
||||
import kiss.Prelude;
|
||||
|
||||
@:build(kiss.Kiss.build())
|
||||
class EntryPanelSystem extends PlaygroundSystem<PanelContainer> {}
|
||||
31
projects/nat-godot-playground/scripts/EntryPanelSystem.kiss
Normal file
31
projects/nat-godot-playground/scripts/EntryPanelSystem.kiss
Normal file
@@ -0,0 +1,31 @@
|
||||
(loadFrom "nat-archive-tool" "src/nat/Lib.kiss")
|
||||
(loadFrom "kiss-godot" "src/kiss_godot/Macros.kiss")
|
||||
|
||||
(defNew [&prop :GodotUI godotUI
|
||||
&prop :Node rootNode]
|
||||
(super
|
||||
godotUI
|
||||
->[archive e] (hasComponent e Name)
|
||||
// Create Entry node:
|
||||
->[archive e pos &opt ui]
|
||||
(let [:PackedScene ePanelScene (GD.load "res://EntryPanel.tscn")
|
||||
:PanelContainer ePanel (cast (ePanelScene.instance))
|
||||
:Label eLabel (getNode ePanel "EntryLabel")]
|
||||
(set eLabel.text (readComponentOr e Name ""))
|
||||
(.addChild (getNode pgScrollContainer "Entries") ePanel)
|
||||
ePanel)
|
||||
// Draw line:
|
||||
->[archive e pos e2 pos2 &opt ui]
|
||||
null
|
||||
// Remove Entry node:
|
||||
->[archive e &opt ui]
|
||||
null))
|
||||
|
||||
(prop &mut :ScrollContainer pgScrollContainer null)
|
||||
|
||||
(method &override :Void switchPlaygroundKey [key]
|
||||
(super.switchPlaygroundKey key)
|
||||
(set pgScrollContainer (getNode rootNode key)))
|
||||
|
||||
(method &override :Void clear [:ColorF color]
|
||||
null)
|
||||
@@ -1,18 +1,45 @@
|
||||
(loadFrom "kiss-godot" "src/kiss_godot/Macros.kiss")
|
||||
|
||||
(prop &mut :ArchiveController controller (property default default))
|
||||
(prop &mut :Null<KeyShortcutHandler<Entry>> shortcutHandler (property default null))
|
||||
|
||||
(method :Void showPrefixMap [:Map<String,String> map] (throw "TODO Not implemented!"))
|
||||
|
||||
(method :Void hidePrefixMap [] (throw "TODO Not implemented!"))
|
||||
(method :Null<PlaygroundSystem> playgroundSystem [] (throw "TODO Not implemented!"))
|
||||
|
||||
(method :Null<PlaygroundSystem<Dynamic>> playgroundSystem [] pgSystem)
|
||||
|
||||
(method :Void enterText [:String prompt :String->Void resolve :Float maxLength] (throw "TODO Not implemented!"))
|
||||
|
||||
(method :Void enterNumber [:String prompt :Float->Void resolve :Float min :Float max &opt :Null<Float> inStepsOf &opt :Null<Bool> allowNaN] (throw "TODO Not implemented!"))
|
||||
|
||||
(method :Void chooseEntry [:String prompt :Archive archive :Entry->Void resolve] (throw "TODO Not implemented!"))
|
||||
|
||||
(method :Void chooseEntries [:String prompt :Archive archive :Array<Entry>->Void resolve :Int min :Float max] (throw "TODO Not implemented!"))
|
||||
|
||||
(method :Void handleChanges [:Archive archive :ChangeSet changeSet] (throw "TODO Not implemented!"))
|
||||
|
||||
(method :Void displayMessage [:String message] (throw "TODO Not implemented!"))
|
||||
|
||||
(method :Void reportError [:String error] (throw "TODO Not implemented!"))
|
||||
|
||||
(method :Void onSelectionChanged [:Array<Entry> selectedEntries :Array<Entry> lastSelectedEntries] (throw "TODO Not implemented!"))
|
||||
|
||||
(method :Void choosePosition [:String prompt :Position->Void resolve] (throw "TODO Not implemented!"))
|
||||
(method :Option<Position> cursorPosition [] (throw "TODO Not implemented!"))(method :Void chooseBetweenStrings [:String prompt :Array<String> choices :String->Void resolve] (throw "TODO Not implemented!"))
|
||||
|
||||
(method :Option<Position> cursorPosition [] (throw "TODO Not implemented!"))
|
||||
|
||||
(method :Void chooseBetweenStrings [:String prompt :Array<String> choices :String->Void resolve] (throw "TODO Not implemented!"))
|
||||
|
||||
(defNew [&prop :Archive archive
|
||||
&prop :Node rootNode])
|
||||
&prop :Node 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))))
|
||||
Reference in New Issue
Block a user