| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- 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}
- _G.debug_overlay = debug_overlay
- _G.ecs = ecs
- --
- -- LOVE callbacks
- --
- function love.load(arg)
- for i=0,100-1 do
- ecs.entities[i] = false
- end
- ecs.entities[0] = true
- ecs.components.test_t[0]._alive = true
- 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
|