love2d-signage/nodes/misery.lua

35 lines
1.2 KiB
Lua
Raw Permalink Normal View History

local node = ThreadNode:extend('node.misery', {
threadFile = 'nodes/misery_thread.lua',
threadChannel = 'misery',
2022-07-05 17:26:00 +00:00
updateInterval = 10,
})
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)
function node:render()
love.graphics.setColor( 0, 0, 0 )
love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
if self.state then
2022-07-06 22:42:59 +00:00
love.graphics.setColor( 1.0, 1.0, 1.0 )
love.graphics.setFont(textFont)
love.graphics.printf(self.state.entry, 50, 180, love.graphics.getWidth() - 100, 'center')
2022-07-06 22:42:59 +00:00
love.graphics.setColor( 1.0, 1.0, 1.0, 0.8 )
love.graphics.setFont(smallFont)
local description = 'added by ' .. self.state.author .. ' on ' .. os.date('%Y/%m/%d %X', self.state.added)
2017-01-08 21:24:13 +00:00
love.graphics.printf(description, 200, love.graphics.getHeight() - 100, love.graphics.getWidth() - 400, 'center')
else
2022-07-06 22:42:59 +00:00
love.graphics.setColor( 1.0, 1.0, 1.0, 0.4 )
love.graphics.setFont(smallFont)
love.graphics.printf("Loading misery...", 0, love.graphics.getHeight() - 200, love.graphics.getWidth(), 'center')
end
end
return node