blob: c20ec1ab0c912af9e52ae3c78cd101a3fea4c6ab [file] [log] [blame]
Serge Bazanski18c1a262022-07-07 14:24:53 +02001local node = ThreadNode:extend('node.misery', {
2 threadFile = 'nodes/misery_thread.lua',
3 threadChannel = 'misery',
4
5 updateInterval = 10,
6})
7
8local inspect = require('vendor.inspect')
9
10local textFont = love.graphics.newFont('fonts/Lato-Light.ttf', 50)
11local smallFont = love.graphics.newFont('fonts/Lato-Light.ttf', 30)
12
13function node:render()
14 love.graphics.setColor( 0, 0, 0 )
15 love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
16
17 if self.state then
18 love.graphics.setColor( 1.0, 1.0, 1.0 )
19 love.graphics.setFont(textFont)
20 love.graphics.printf(self.state.entry, 50, 180, love.graphics.getWidth() - 100, 'center')
21
22 love.graphics.setColor( 1.0, 1.0, 1.0, 0.8 )
23 love.graphics.setFont(smallFont)
24 local description = 'added by ' .. self.state.author .. ' on ' .. os.date('%Y/%m/%d %X', self.state.added)
25 love.graphics.printf(description, 200, love.graphics.getHeight() - 100, love.graphics.getWidth() - 400, 'center')
26 else
27 love.graphics.setColor( 1.0, 1.0, 1.0, 0.4 )
28
29 love.graphics.setFont(smallFont)
30 love.graphics.printf("Loading misery...", 0, love.graphics.getHeight() - 200, love.graphics.getWidth(), 'center')
31 end
32end
33
34return node