2017-01-08 12:54:01 +00:00
|
|
|
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)
|
2017-01-08 18:16:30 +00:00
|
|
|
if lastUpdate < love.timer.getTime() - updateInterval or
|
|
|
|
(not state and lastUpdate < love.timer.getTime() - 5) then
|
2017-01-08 12:54:01 +00:00
|
|
|
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
|