| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- 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_windows = {
- Console = Console:new(),
- Graphs = Graphs:new(),
- Watch = Watch:new(),
- ECS = ECSDebug:new(),
- }
- self.console = self.debug_windows.Console
- self.watch = self.debug_windows.Watch
- end
- function Debug:render()
- self.debug_windows.Graphs:update()
- -- Menu
- 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()
- end
- end
- imgui.EndMenu()
- end
- imgui.EndMainMenuBar()
- end
- for k,v in pairs(self.debug_windows) do
- if v.visible then
- v:render()
- 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()
- end
- end
- end
- return Debug
|