Serge Bazanski | 18c1a26 | 2022-07-07 14:24:53 +0200 | [diff] [blame] | 1 | local node = ThreadNode:extend('node.misery', { |
| 2 | threadFile = 'nodes/misery_thread.lua', |
| 3 | threadChannel = 'misery', |
| 4 | |
| 5 | updateInterval = 10, |
| 6 | }) |
| 7 | |
| 8 | local inspect = require('vendor.inspect') |
| 9 | |
| 10 | local textFont = love.graphics.newFont('fonts/Lato-Light.ttf', 50) |
| 11 | local smallFont = love.graphics.newFont('fonts/Lato-Light.ttf', 30) |
| 12 | |
| 13 | function 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 |
| 32 | end |
| 33 | |
| 34 | return node |