51 lines
1.4 KiB
Lua
51 lines
1.4 KiB
Lua
|
local node = {}
|
||
|
|
||
|
local inspect = require('vendor.inspect')
|
||
|
|
||
|
local textFont = love.graphics.newFont('fonts/Lato-Light.ttf', 50)
|
||
|
local smallFont = love.graphics.newFont('fonts/Lato-Light.ttf', 30)
|
||
|
|
||
|
local updateInterval = 2 * 60
|
||
|
local lastUpdate = 0
|
||
|
local state = nil
|
||
|
|
||
|
function node.load()
|
||
|
end
|
||
|
|
||
|
function node.unload()
|
||
|
end
|
||
|
|
||
|
function node.render()
|
||
|
love.graphics.setColor( 0, 0, 0 )
|
||
|
love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
|
||
|
|
||
|
if state then
|
||
|
love.graphics.setColor( 255, 255, 255 )
|
||
|
love.graphics.setFont(textFont)
|
||
|
love.graphics.printf(state.text, 50, 180, love.graphics.getWidth() - 100, 'center')
|
||
|
|
||
|
love.graphics.setColor( 255, 255, 255, 200 )
|
||
|
love.graphics.setFont(smallFont)
|
||
|
love.graphics.printf(state.description, 200, love.graphics.getHeight() - 100, love.graphics.getWidth() - 400, 'center')
|
||
|
else
|
||
|
love.graphics.setColor( 255, 255, 255, 80 )
|
||
|
|
||
|
love.graphics.setFont(smallFont)
|
||
|
love.graphics.printf("Loading misery...", 0, love.graphics.getHeight() - 200, love.graphics.getWidth(), 'center')
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function node.update(dt)
|
||
|
if lastUpdate < love.timer.getTime() - updateInterval then
|
||
|
lastUpdate = love.timer.getTime()
|
||
|
print("Updating...")
|
||
|
|
||
|
local updateThread = love.thread.newThread('screens/misery_thread.lua')
|
||
|
updateThread:start()
|
||
|
end
|
||
|
|
||
|
state = love.thread.getChannel('misery'):pop() or state
|
||
|
end
|
||
|
|
||
|
return node
|