generated from sage/tiny-ecs-love-template
86 lines
1.7 KiB
Lua
86 lines
1.7 KiB
Lua
require("tiny-debug")
|
|
require("utils")
|
|
require("generated/filter-types")
|
|
require("generated/assets")
|
|
require("generated/all-systems")
|
|
|
|
UiZIndex = math.huge
|
|
|
|
local smallFont = EtBt7001Z0xa(12)
|
|
|
|
local scenarios = require("scenarios")
|
|
|
|
local world = require("world")
|
|
|
|
local currentScenario = scenarios.default
|
|
local freeze = false
|
|
local delta
|
|
|
|
local playerBus
|
|
|
|
function love.load()
|
|
playerBus = currentScenario(world)
|
|
love.graphics.setBackgroundColor(0, 0, 0)
|
|
love.graphics.setFont(EtBt7001Z0xa(32))
|
|
end
|
|
|
|
local nth = 1
|
|
|
|
world:addEntity({
|
|
triggerDiceRoll = "",
|
|
})
|
|
|
|
function love.update(dt)
|
|
delta = dt
|
|
|
|
if love.keyboard.isDown("r") then
|
|
world:clearEntities()
|
|
playerBus = currentScenario(world)
|
|
freeze = false
|
|
end
|
|
|
|
if love.keyboard.isDown("f") then
|
|
freeze = not freeze
|
|
end
|
|
|
|
if freeze then
|
|
return
|
|
end
|
|
|
|
-- if nth == 3 then
|
|
-- world:addEntity({
|
|
-- scoringTrigger = {
|
|
-- mask = 1,
|
|
-- target = playerBus,
|
|
-- },
|
|
-- })
|
|
-- nth = 1
|
|
-- else
|
|
-- nth = nth + 1
|
|
-- end
|
|
|
|
world:update(delta, function(_, system)
|
|
if system.deferToEnd then
|
|
return false
|
|
end
|
|
return not system.isDrawSystem
|
|
end)
|
|
end
|
|
|
|
function love.draw()
|
|
love.graphics.setColor(1, 1, 1)
|
|
love.graphics.setFont(smallFont)
|
|
love.graphics.print("FPS: "..tostring(love.timer.getFPS( )), 10, 10)
|
|
|
|
world:update(delta, function(_, system)
|
|
if system.deferToEnd then
|
|
return false
|
|
end
|
|
return system.isDrawSystem
|
|
end)
|
|
|
|
world:update(delta, function(_, system)
|
|
return system.deferToEnd
|
|
end)
|
|
end
|