|
|
@@ -1,4 +1,47 @@
|
|
|
+--[[
|
|
|
+ Debug Overlay module
|
|
|
+ @author : Eiyeron Fulmincendii
|
|
|
|
|
|
+ The debug overlay is targeting to be a relatively agnositc debug framework for Love2D based on love-imgui.
|
|
|
+ Requiring for now a custom class implementation and love-imgui.
|
|
|
+
|
|
|
+ It is very suggested to use imgui-love module as this module has been designed with it in mind.
|
|
|
+
|
|
|
+
|
|
|
+ Modulable, th overlay create a menubar on the top of the game screen containing the different debug menus registered to
|
|
|
+ the system. One being already registered containing
|
|
|
+ - FPS and CPU/MEM usage graphs
|
|
|
+ - an interactive console à-la Quake
|
|
|
+ - a variable watch.
|
|
|
+
|
|
|
+ Usage
|
|
|
+ -----
|
|
|
+
|
|
|
+ Create an instance like this:
|
|
|
+ debug_overlay = require("debug_overlay"):new()
|
|
|
+
|
|
|
+ In love.draw, before imgui.Render(), call your instance's render function:
|
|
|
+ function love.draw()
|
|
|
+ <snip>
|
|
|
+ debug_overlay:render()
|
|
|
+ imgui.Render();
|
|
|
+ end
|
|
|
+
|
|
|
+ To register a new window, create a class derived from DebugWindow (check debugwindow.lua and debug_overlay/graphs/init.lua for an example)
|
|
|
+ local MyDebugWindow = class(DebugWindow)
|
|
|
+ Note : to add a shortcut to the window in the menubar, add this line in your window's init function:
|
|
|
+ function MyDebugWindow:init()
|
|
|
+ <snip>
|
|
|
+ self.shortcut = "f4"
|
|
|
+ <snip>
|
|
|
+ end
|
|
|
+
|
|
|
+ And to register your debug windows in a menu:
|
|
|
+ debug_overlay:register_menu("Menu button name", {WindowName=MyDebugWindow_Instance})
|
|
|
+ (I use somemthing like this : )
|
|
|
+ debug_overlay:register_menu("Menu button name", require("mydebugwindow"):new())
|
|
|
+
|
|
|
+]]--
|
|
|
-- If not debug then returning a blank class.
|
|
|
if not _G.ENABLE_DEBUG_OVERLAY then
|
|
|
local void = {}
|
|
|
@@ -9,7 +52,6 @@ if not _G.ENABLE_DEBUG_OVERLAY then
|
|
|
__call = function() return void end
|
|
|
}
|
|
|
setmetatable(void, mt)
|
|
|
- print(void)
|
|
|
return void
|
|
|
end
|
|
|
|