Skip to content

Commit

Permalink
GdsDemo: add topmost window
Browse files Browse the repository at this point in the history
  • Loading branch information
pkdawson committed Jul 6, 2024
1 parent 1c53061 commit 2824263
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions doc/examples/GdsDemo/demo.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var values := [2.0, 4.0, 0.0, 3.0, 1.0, 5.0]
var items := ["zero", "one", "two", "three"]
var current_item := [2]
var anim_counter := 0
var wc_topmost: ImGuiWindowClassPtr

func _ready():
var io := ImGui.GetIO()
Expand All @@ -15,7 +16,12 @@ func _ready():
style.Colors[ImGui.Col_PlotHistogram] = Color.REBECCA_PURPLE
style.Colors[ImGui.Col_PlotHistogramHovered] = Color.SLATE_BLUE

wc_topmost = ImGuiWindowClassPtr.new()
wc_topmost.ViewportFlagsOverrideSet = ImGui.ViewportFlags_TopMost

func _process(_delta: float) -> void:
ImGui.ShowDemoWindow()

ImGui.Begin("hello")
ImGui.Text("hello from GDScript")
ImGui.DragFloat("myfloat", myfloat)
Expand All @@ -30,6 +36,12 @@ func _process(_delta: float) -> void:
ImGui.Text("choice = %s" % items[current_item[0]])
ImGui.End()

ImGui.SetNextWindowClass(wc_topmost)
ImGui.SetNextWindowSize(Vector2(200, 200), ImGui.Cond_Once)
ImGui.Begin("topmost viewport window")
ImGui.TextWrapped("when this is a viewport window outside the main window, it will stay on top")
ImGui.End()

func _physics_process(_delta: float) -> void:
anim_counter += 1
if anim_counter >= 10:
Expand Down

0 comments on commit 2824263

Please sign in to comment.