| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- local class, object = require("class"), require("class.object")
- local Console = require("debug_overlay.console")
- local Graphs = require("debug_overlay.graphs")
- local Watch = require("debug_overlay.watch")
- local ECSDebug = require("debug_overlay.ecs")
- require("imgui")
- local Debug = class(object)
- function Debug:init()
- self.debug_menus = {
- Debug = {
- Console = Console:new(),
- Watch = Watch:new(),
- Graphs = Graphs:new(),
- },
- ECS = {
- ECS = ECSDebug:new()
- }
- }
- self.console = self.debug_menus.Debug.Console
- self.watch = self.debug_menus.Debug.Watch
- end
- function Debug:render()
- self.debug_menus.Debug.Graphs:update()
- if imgui.BeginMainMenuBar() then
- 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
- end
- imgui.EndMainMenuBar()
- 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 _, 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
- return Debug
|