Use string.format in newdash, fix slideshow when no files provided
parent
615c9e5dee
commit
862d977fce
|
@ -13,7 +13,6 @@ local headerFont = love.graphics.newFont('fonts/Lato-Regular.ttf', 40)
|
|||
local valueFont = love.graphics.newFont('fonts/Lato-Light.ttf', 45)
|
||||
local atFont = love.graphics.newFont('fonts/Lato-Light.ttf', 35)
|
||||
|
||||
|
||||
local weatherGlyphs = {
|
||||
snow = "",
|
||||
mist = "",
|
||||
|
@ -39,7 +38,7 @@ function node:render()
|
|||
end
|
||||
|
||||
love.graphics.setFont(tempFont)
|
||||
love.graphics.printf(tostring(self.state.temperature) .. "°", 350, 390, 270, 'center')
|
||||
love.graphics.printf(string.format("%d°", self.state.temperature), 350, 390, 270, 'center')
|
||||
|
||||
love.graphics.setFont(headerFont)
|
||||
love.graphics.printf("Ambient:", 720, 380, 160, 'right')
|
||||
|
@ -48,30 +47,25 @@ function node:render()
|
|||
|
||||
love.graphics.setFont(valueFont)
|
||||
if self.state.insideTemperature then
|
||||
love.graphics.printf(tostring(self.state.insideTemperature) .. "° / " .. tostring(self.state.insideHumidity) .. "%RH", 900, 378, 400, 'left')
|
||||
love.graphics.printf(string.format("%d° / %d%%RH", self.state.insideTemperature, self.state.insideHumidity), 900, 378, 400, 'left')
|
||||
else
|
||||
love.graphics.printf("?!", 900, 378, 400, 'left')
|
||||
end
|
||||
love.graphics.printf("ON or OFF?", 900, 438, 400, 'left')
|
||||
love.graphics.printf("ON or OFF?", 900, 498, 400, 'left')
|
||||
--love.graphics.setFont(atFont)
|
||||
--love.graphics.printf(os.date("Last update: %Y/%m/%d %H:%M", self.state.lastUpdate), 0, love.graphics.getHeight() - 60, love.graphics.getWidth(), 'center')
|
||||
--if self.state.insideTemperature then
|
||||
-- love.graphics.printf("Room: " .. tostring(self.state.insideTemperature) .. "° / " .. tostring(self.state.insideHumidity) .. "%RH", 0, love.graphics.getHeight() - 100, love.graphics.getWidth(), 'center')
|
||||
--end
|
||||
love.graphics.setFont(headerFont)
|
||||
love.graphics.printf("at hackerspace:", 50, 593, 300, 'left')
|
||||
love.graphics.setFont(atFont)
|
||||
if self.state.at then
|
||||
users = lume.map(self.state.at.users, function(v) return v.login end)
|
||||
if self.state.at.unknown > 0 then
|
||||
users[#users + 1] = tostring(self.state.at.unknown) .. " unknown creatures"
|
||||
users[#users + 1] = string.format("%d unknown creatures", self.state.at.unknown)
|
||||
end
|
||||
if self.state.at.kektops > 0 then
|
||||
users[#users + 1] = tostring(self.state.at.kektops) .. " kektops"
|
||||
users[#users + 1] = string.format("%d kektops", self.state.at.kektops)
|
||||
end
|
||||
if self.state.at.esps > 0 then
|
||||
users[#users + 1] = tostring(self.state.at.esps) .. " ESPs"
|
||||
users[#users + 1] = string.format("%d ESPs", self.state.at.esps)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -8,12 +8,14 @@ function node:init(config)
|
|||
end
|
||||
|
||||
function node:loadImage()
|
||||
local files = self:processFiles(self.files)
|
||||
if files ~= nil then
|
||||
if self.fileName then
|
||||
self.fileName = files[(lume.find(files, self.fileName) or 1) % #files + 1]
|
||||
else
|
||||
self.fileName = files[1]
|
||||
if self.files then
|
||||
local files = self:processFiles(self.files)
|
||||
if files ~= nil then
|
||||
if self.fileName then
|
||||
self.fileName = files[(lume.find(files, self.fileName) or 1) % #files + 1]
|
||||
else
|
||||
self.fileName = files[1]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue