|
|
@@ -9,42 +9,51 @@ require("imgui")
|
|
|
local Debug = class(object)
|
|
|
|
|
|
function Debug:init()
|
|
|
- self.debug_windows = {
|
|
|
- Console = Console:new(),
|
|
|
- Graphs = Graphs:new(),
|
|
|
- Watch = Watch:new(),
|
|
|
- ECS = ECSDebug:new(),
|
|
|
+ self.debug_menus = {
|
|
|
+ Debug = {
|
|
|
+ Console = Console:new(),
|
|
|
+ Watch = Watch:new(),
|
|
|
+ Graphs = Graphs:new(),
|
|
|
+ },
|
|
|
+ ECS = {
|
|
|
+ ECS = ECSDebug:new()
|
|
|
+ }
|
|
|
}
|
|
|
- self.console = self.debug_windows.Console
|
|
|
- self.watch = self.debug_windows.Watch
|
|
|
+ self.console = self.debug_menus.Debug.Console
|
|
|
+ self.watch = self.debug_menus.Debug.Watch
|
|
|
end
|
|
|
|
|
|
function Debug:render()
|
|
|
- self.debug_windows.Graphs:update()
|
|
|
- -- Menu
|
|
|
+ self.debug_menus.Debug.Graphs:update()
|
|
|
if imgui.BeginMainMenuBar() then
|
|
|
- if imgui.BeginMenu("Debug") then
|
|
|
- for k,v in pairs(self.debug_windows) do
|
|
|
- if imgui.MenuItem(k, v.shortcut, v.visible) then
|
|
|
- v:toggle()
|
|
|
+ for menu,windows in pairs(self.debug_menus) do
|
|
|
+ -- Menu
|
|
|
+ if imgui.BeginMenu(menu) then
|
|
|
+ for k,v in pairs(windows) do
|
|
|
+ if imgui.MenuItem(k, v.shortcut, v.visible) then
|
|
|
+ v:toggle()
|
|
|
+ end
|
|
|
end
|
|
|
+ imgui.EndMenu()
|
|
|
end
|
|
|
- imgui.EndMenu()
|
|
|
end
|
|
|
imgui.EndMainMenuBar()
|
|
|
- end
|
|
|
- for k,v in pairs(self.debug_windows) do
|
|
|
- if v.visible then
|
|
|
- v:render()
|
|
|
+ for menu,windows in pairs(self.debug_menus) do
|
|
|
+ for k, window in pairs(windows) do
|
|
|
+ if window.visible then
|
|
|
+ window:render()
|
|
|
+ end
|
|
|
+ end
|
|
|
end
|
|
|
end
|
|
|
-
|
|
|
end
|
|
|
|
|
|
function Debug:keypressed(key)
|
|
|
- for k,v in pairs(self.debug_windows) do
|
|
|
- if v.shortcut and key == v.shortcut then
|
|
|
- v:toggle()
|
|
|
+ for _, windows in pairs(self.debug_menus) do
|
|
|
+ for __, window in pairs(windows) do
|
|
|
+ if window.shortcut and key == window.shortcut then
|
|
|
+ window:toggle()
|
|
|
+ end
|
|
|
end
|
|
|
end
|
|
|
end
|