Skip to content

Commit 071b432

Browse files
committed
Use string for combined flags
1 parent 681f114 commit 071b432

File tree

27 files changed

+80
-112
lines changed

27 files changed

+80
-112
lines changed

pkg/ant.imgui/imgui_system.lua

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,11 @@ local m = ecs.system 'imgui_system'
1515
function m:init_system()
1616
ImGui.CreateContext()
1717
ImGuiBackend.Init()
18-
local ConfigFlags = {
19-
"NavEnableKeyboard",
20-
"DockingEnable",
21-
"NavNoCaptureKeyboard",
22-
"NoMouseCursorChange",
23-
}
18+
local ConfigFlags = ImGui.ConfigFlags "NavEnableKeyboard|DockingEnable|NavNoCaptureKeyboard|NoMouseCursorChange"
2419
if platform.os == "windows" then
25-
ConfigFlags[#ConfigFlags+1] = "DpiEnableScaleFonts"
20+
ConfigFlags = ConfigFlags | ImGui.ConfigFlags "DpiEnableScaleFonts"
2621
end
27-
ImGui.GetIO().ConfigFlags = ImGui.ConfigFlags(ConfigFlags)
22+
ImGui.GetIO().ConfigFlags = ConfigFlags
2823
ImGuiBackend.PlatformInit(rhwi.native_window())
2924

3025
local imgui_font = assetmgr.load_material "/pkg/ant.imgui/materials/font.material"

test/camera/pkg/ant.test.camera/camera_demo.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ function m:data_changed()
212212
move_object()
213213
end
214214
gameobject.flush(w)
215-
if ImGui.Begin("Camera", nil, ImGui.WindowFlags {"AlwaysAutoResize", "NoMove", "NoTitleBar"}) then
215+
if ImGui.Begin("Camera", nil, ImGui.WindowFlags "AlwaysAutoResize|NoMove|NoTitleBar" ) then
216216
ImGui.LabelText ("Press space to pause", "(%f,%f) R = %f", obj.x, obj.y, obj.r)
217217
ImGui.LabelText ("pan", "Press W A S D or Left button")
218218
ImGui.LabelText ("yaw", "Press Q E or Right button")

test/features/pkg/ant.test.features/imgui_system.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ local function select_test(name)
1919
end
2020

2121
function m:data_changed()
22-
if ImGui.Begin("test", nil, ImGui.WindowFlags {"AlwaysAutoResize", "NoMove", "NoTitleBar"}) then
22+
if ImGui.Begin("test", nil, ImGui.WindowFlags "AlwaysAutoResize|NoMove|NoTitleBar") then
2323
current_test = current_test or common.init_system
2424
if ImGui.BeginCombo("##test", current_test) then
2525
select_test "<none>"

test/imgui/pkg/imgui/init_system.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ function m:data_changed()
1919
for _, e in DropfilesEvent:unpack() do
2020
print("dropfiles:", e.files[1])
2121
end
22-
if ImGui.Begin("test", nil, ImGui.WindowFlags {'AlwaysAutoResize'}) then
23-
if ImGui.TreeNodeEx("Test", ImGui.TreeNodeFlags {"DefaultOpen"}) then
24-
if ImGui.InputText("TEST", text, ImGui.InputTextFlags { "EnterReturnsTrue" }) then
22+
if ImGui.Begin("test", nil, ImGui.WindowFlags 'AlwaysAutoResize') then
23+
if ImGui.TreeNodeEx("Test", ImGui.TreeNodeFlags "DefaultOpen") then
24+
if ImGui.InputText("TEST", text, ImGui.InputTextFlags "EnterReturnsTrue") then
2525
print(tostring(text))
2626
end
2727
ImGui.TreePop()

test/simple/pkg/ant.test.simple/widget.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function m.AnimationView(tags)
2626
for eid, list in pairs(names) do
2727
names[eid] = table.concat(list, "|")
2828
end
29-
if ImGui.Begin("entities", nil, ImGui.WindowFlags {"AlwaysAutoResize", "NoMove", "NoTitleBar"}) then
29+
if ImGui.Begin("entities", nil, ImGui.WindowFlags "AlwaysAutoResize|NoMove|NoTitleBar" ) then
3030
local animation_eid
3131
if ImGui.TreeNode "mesh" then
3232
for i = 1, #entities do
@@ -53,7 +53,7 @@ function m.AnimationView(tags)
5353
end
5454
end
5555

56-
if ImGui.TreeNodeEx("light", ImGui.TreeNodeFlags{"DefaultOpen"}) then
56+
if ImGui.TreeNodeEx("light", ImGui.TreeNodeFlags "DefaultOpen") then
5757
local dl = w:first "directional_light light:in"
5858
if dl and ImGui.TreeNode "directional" then
5959

@@ -75,7 +75,7 @@ function m.AnimationView(tags)
7575
ImGui.TreePop()
7676
end
7777

78-
if animation_eid and ImGui.TreeNodeEx("animation", ImGui.TreeNodeFlags {"DefaultOpen"}) then
78+
if animation_eid and ImGui.TreeNodeEx("animation", ImGui.TreeNodeFlags "DefaultOpen") then
7979
local e <close> = world:entity(animation_eid, "animation:in")
8080
local animation = e.animation
8181
for name, status in pairs(animation.status) do

test/simple_rt/pkg/ant.test.simple/widget.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function m.AnimationView(tags)
2525
for eid, list in pairs(names) do
2626
names[eid] = table.concat(list, "|")
2727
end
28-
if ImGui.Begin("entities", nil, ImGui.WindowFlags {"AlwaysAutoResize", "NoMove", "NoTitleBar"}) then
28+
if ImGui.Begin("entities", nil, ImGui.WindowFlags "AlwaysAutoResize|NoMove|NoTitleBar") then
2929
local animation_eid
3030
if ImGui.TreeNode "mesh" then
3131
for i = 1, #entities do
@@ -51,7 +51,7 @@ function m.AnimationView(tags)
5151
end
5252
end
5353
end
54-
if animation_eid and ImGui.TreeNodeEx("animation", ImGui.TreeNodeFlags {"DefaultOpen"}) then
54+
if animation_eid and ImGui.TreeNodeEx("animation", ImGui.TreeNodeFlags "DefaultOpen") then
5555
local e <close> = world:entity(animation_eid, "animation:in")
5656
local animation = e.animation
5757
for name, status in pairs(animation.status) do

tools/editor/launch/pkg/launch/init_system.lua

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,8 @@ function m:data_changed()
5757
ImGui.PushStyleVar(ImGui.StyleVar.WindowRounding, 0.0);
5858
ImGui.PushStyleVar(ImGui.StyleVar.WindowBorderSize, 0.0);
5959
ImGui.PushStyleVarImVec2(ImGui.StyleVar.WindowPadding, 0.0, 0.0);
60-
if ImGui.Begin("MainView", nil, ImGui.WindowFlags {
61-
"NoDocking",
62-
"NoTitleBar",
63-
"NoCollapse",
64-
"NoResize",
65-
"NoMove",
66-
"NoBringToFrontOnFocus",
67-
"NoNavFocus",
68-
"NoBackground",
69-
}) then
70-
ImGui.DockSpaceEx(ImGui.GetID "MainViewSpace", 0, 0, ImGui.DockNodeFlags {
71-
"NoDockingOverCentralNode",
72-
"PassthruCentralNode",
73-
})
60+
if ImGui.Begin("MainView", nil, ImGui.WindowFlags "NoDocking|NoTitleBar|NoCollapse|NoResize|NoMove|NoBringToFrontOnFocus|NoNavFocus|NoBackground") then
61+
ImGui.DockSpaceEx(ImGui.GetID "MainViewSpace", 0, 0, ImGui.DockNodeFlags "NoDockingOverCentralNode|PassthruCentralNode")
7462
end
7563
ImGui.PopStyleVarEx(3)
7664
ImGui.End()
@@ -80,7 +68,7 @@ function m:data_changed()
8068
ImGui.SetNextWindowSize(viewport.WorkSize.x, viewport.WorkSize.y, ImGui.Cond.FirstUseEver)
8169
-- ImGui.SetNextWindowDockID("MainViewSpace", ImGui.Cond.FirstUseEver)
8270
local exit = false
83-
if ImGui.Begin("##Choose project", true, ImGui.WindowFlags {"NoResize", "NoTitleBar", "NoCollapse" }) then
71+
if ImGui.Begin("##Choose project", true, ImGui.WindowFlags "NoResize|NoTitleBar|NoCollapse") then
8472
-- exit = choose_project()
8573
-- local wid = ImGui.GetID("Choose project")
8674
local selected_proj
@@ -116,7 +104,7 @@ function m:data_changed()
116104
ImGui.Separator()
117105
if lastprojs then
118106
for i, proj in ipairs(lastprojs) do
119-
if ImGui.SelectableEx(proj.name .. " : " .. proj.proj_path, selected_proj and selected_proj.proj_path == proj.proj_path, ImGui.SelectableFlags {"AllowDoubleClick"}) then
107+
if ImGui.SelectableEx(proj.name .. " : " .. proj.proj_path, selected_proj and selected_proj.proj_path == proj.proj_path, ImGui.SelectableFlags "AllowDoubleClick") then
120108
selected_proj = lastprojs[i]
121109
do_open_proj(selected_proj.proj_path)
122110
exit = true

tools/editor/pkg/tools.editor/prefab_manager.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ function m:choose_prefab()
458458
if not ImGui.IsPopupOpen(title) then
459459
ImGui.OpenPopup(title)
460460
end
461-
local change, opened = ImGui.BeginPopupModal(title, true, ImGui.WindowFlags {"AlwaysAutoResize"})
461+
local change, opened = ImGui.BeginPopupModal(title, true, ImGui.WindowFlags "AlwaysAutoResize")
462462
if change then
463463
if gd.is_opening then
464464

@@ -501,7 +501,7 @@ function m:choose_prefab()
501501
end
502502
ImGui.Separator()
503503
for _, prefab in ipairs(prefab_list) do
504-
if ImGui.SelectableEx(prefab, false, ImGui.SelectableFlags {"AllowDoubleClick"}) then
504+
if ImGui.SelectableEx(prefab, false, ImGui.SelectableFlags "AllowDoubleClick") then
505505
if gd.is_opening then
506506
self:open(gd.glb_filename.."/".. prefab, prefab, patch_template)
507507
else

tools/editor/pkg/tools.editor/widget/animation_view.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ function m.show()
621621
local viewport = ImGui.GetMainViewport()
622622
ImGui.SetNextWindowPos(viewport.WorkPos.x, viewport.WorkPos.y + viewport.WorkSize.y - uiconfig.BottomWidgetHeight, ImGui.Cond.FirstUseEver)
623623
ImGui.SetNextWindowSize(viewport.WorkSize.x, uiconfig.BottomWidgetHeight, ImGui.Cond.FirstUseEver)
624-
if ImGui.Begin("Animation", nil, ImGui.WindowFlags { "NoCollapse", "NoScrollbar" }) then
624+
if ImGui.Begin("Animation", nil, ImGui.WindowFlags "NoCollapse|NoScrollbar" ) then
625625
if (not current_anim or not anim_eid) and not edit_timeline then
626626
goto continue
627627
end
@@ -665,7 +665,7 @@ function m.show()
665665
anim_path_ui:Assgin ""
666666
ImGui.OpenPopup(title)
667667
end
668-
local change = ImGui.BeginPopupModal(title, nil, ImGui.WindowFlags {"AlwaysAutoResize"})
668+
local change = ImGui.BeginPopupModal(title, nil, ImGui.WindowFlags "AlwaysAutoResize")
669669
if change then
670670
ImGui.Text("Anim Name:")
671671
ImGui.SameLine()
@@ -807,12 +807,12 @@ function m.show()
807807
end
808808
ImGui.Separator()
809809
-- ImGui.GetIO().WantCaptureMouse = true
810-
if ImGui.BeginTable("EventColumns", edit_timeline and 2 or 3, ImGui.TableFlags {'Resizable', 'ScrollY'}) then
810+
if ImGui.BeginTable("EventColumns", edit_timeline and 2 or 3, ImGui.TableFlags 'Resizable|ScrollY') then
811811
if not edit_timeline then
812-
ImGui.TableSetupColumnEx("Bones", ImGui.TableColumnFlags {'WidthStretch'}, 1.0)
812+
ImGui.TableSetupColumnEx("Bones", ImGui.TableColumnFlags 'WidthStretch', 1.0)
813813
end
814-
ImGui.TableSetupColumnEx("Event", ImGui.TableColumnFlags {'WidthStretch'}, 1.0)
815-
ImGui.TableSetupColumnEx("Event(Detail)", ImGui.TableColumnFlags {'WidthStretch'}, 2.0)
814+
ImGui.TableSetupColumnEx("Event", ImGui.TableColumnFlags 'WidthStretch', 1.0)
815+
ImGui.TableSetupColumnEx("Event(Detail)", ImGui.TableColumnFlags 'WidthStretch', 2.0)
816816
ImGui.TableHeadersRow()
817817
local child_width, child_height
818818
if not edit_timeline then

tools/editor/pkg/tools.editor/widget/camera_setting_view.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ local function show_camera_setting(open)
1818
end
1919
end
2020

21-
local change = ImGui.BeginPopupModal(CAMERA_SETTING_NAME, nil, ImGui.WindowFlags {"AlwaysAutoResize"})
21+
local change = ImGui.BeginPopupModal(CAMERA_SETTING_NAME, nil, ImGui.WindowFlags "AlwaysAutoResize")
2222
if change then
2323
local mq = w:first "main_queue camera_ref:in"
2424
local e<close> = world:entity(mq.camera_ref, "camera:update scene:update")
2525

26-
if ImGui.TreeNodeEx("Camera", ImGui.TreeNodeFlags { "OpenOnArrow", "SpanFullWidth", "DefaultOpen" }) then
26+
if ImGui.TreeNodeEx("Camera", ImGui.TreeNodeFlags "OpenOnArrow|SpanFullWidth|DefaultOpen" ) then
2727

2828
local frustum = e.camera.frustum
29-
if ImGui.TreeNodeEx("Frustum", ImGui.TreeNodeFlags { "OpenOnArrow", "SpanFullWidth", "DefaultOpen" }) then
29+
if ImGui.TreeNodeEx("Frustum", ImGui.TreeNodeFlags "OpenOnArrow|SpanFullWidth|DefaultOpen") then
3030

3131
local changed
3232
local uiortho = {frustum.ortho}
@@ -72,7 +72,7 @@ local function show_camera_setting(open)
7272
ImGui.TreePop()
7373
end
7474

75-
if ImGui.TreeNodeEx("Scene", ImGui.TreeNodeFlags { "OpenOnArrow", "SpanFullWidth", "DefaultOpen" }) then
75+
if ImGui.TreeNodeEx("Scene", ImGui.TreeNodeFlags "OpenOnArrow|SpanFullWidth|DefaultOpen" ) then
7676

7777
local uis = math3d.tovalue(e.scene.s)
7878
if ImGui.DragFloat("Scale", uis) then

0 commit comments

Comments
 (0)