forked from hswaw/hscloud
Serge Bazanski
18c1a263cf
This is b28e6f07aa48f1e2f01eb37bffa180f97a7b03bd from https://code.hackerspace.pl/q3k/love2d-signage/. We only keep code commited by inf and q3k, and we're both now licensing this code under the ISC license, as per COPYING in the root of hscloud. Change-Id: Ibeee2e6923605e4b1a17a1d295867c056863ef59 Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1335 Reviewed-by: informatic <informatic@hackerspace.pl> Reviewed-by: q3k <q3k@hackerspace.pl>
34 lines
1.2 KiB
Lua
34 lines
1.2 KiB
Lua
local node = ThreadNode:extend('node.misery', {
|
|
threadFile = 'nodes/misery_thread.lua',
|
|
threadChannel = 'misery',
|
|
|
|
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
|
|
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')
|
|
|
|
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)
|
|
love.graphics.printf(description, 200, love.graphics.getHeight() - 100, love.graphics.getWidth() - 400, 'center')
|
|
else
|
|
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
|