require "imgui" local ECS = require("ecs.ECS") local Debug = require("debug_overlay") local inspect = require 'inspect' debug_overlay = Debug:new() local ecs = ECS:new() local a = {b = 42} local Position = ecs:create_component("Position", [[ int32_t x; int32_t y; ]]) local p = ecs:get_component("Position", 42) _G.debug_overlay = debug_overlay _G.ecs = ecs -- -- LOVE callbacks -- function love.load(arg) p = Position:new() p.x = 2 p.y = 5 debug_overlay.watch:add(p, "x") debug_overlay.watch:add(p, "y") end function love.update(dt) imgui.NewFrame() end function love.draw() debug_overlay:render() imgui.Render(); end function love.quit() imgui.ShutDown(); end -- -- User inputs -- function love.textinput(t) imgui.TextInput(t) if not imgui.GetWantCaptureKeyboard() then -- Pass event to the game end end function love.resize(width, height) pixel = shine.pixelate() crt = shine.crt() glow = shine.glowsimple() blur = shine.boxblur() scan = shine.scanlines() pe = scan:chain(glow):chain(crt) end function love.keypressed(key) imgui.KeyPressed(key) debug_overlay:keypressed(key) if not imgui.GetWantCaptureKeyboard() then -- Pass event to the game end end function love.keyreleased(key) imgui.KeyReleased(key) if not imgui.GetWantCaptureKeyboard() then -- Pass event to the game end a = nil end function love.mousemoved(x, y) imgui.MouseMoved(x, y) if not imgui.GetWantCaptureMouse() then -- Pass event to the game end end function love.mousepressed(x, y, button) imgui.MousePressed(button) if not imgui.GetWantCaptureMouse() then -- Pass event to the game end end function love.mousereleased(x, y, button) imgui.MouseReleased(button) if not imgui.GetWantCaptureMouse() then -- Pass event to the game end end function love.wheelmoved(x, y) imgui.WheelMoved(y) if not imgui.GetWantCaptureMouse() then -- Pass event to the game end end