summaryrefslogtreecommitdiffstats
path: root/nodes/time.lua
blob: 7f8befc3bfdc89ca5a241a37e4d4bf32171d6091 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
local node = Node:extend('nodes.time', {})

local textFont = love.graphics.newFont('fonts/Lato-Thin.ttf', 400)
local smallFont = love.graphics.newFont('fonts/Lato-Light.ttf', 60)

function node:render()
  love.graphics.setColor( 0, 0, 0 )
  love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())

  love.graphics.setColor( 255, 255, 255 )

  love.graphics.setFont(textFont);
  love.graphics.printf(os.date('%H:%M'), 0, 0.14*love.graphics.getHeight(), love.graphics.getWidth(), 'center');

  love.graphics.setFont(smallFont);
  love.graphics.printf(os.date('%Y/%m/%d'), 0, 0.8*love.graphics.getHeight(), love.graphics.getWidth(), 'center');
end

return node