summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPiotr Dobrowolski <admin@tastycode.pl>2022-07-07 00:42:59 +0200
committerPiotr Dobrowolski <admin@tastycode.pl>2022-07-07 00:42:59 +0200
commitdfa3f53a03250414a5a78351b9d41aecd1cf5a69 (patch)
treea13b3172b93ebc0c4a467dfd2bd20d54d1f3695b
parent6c14716222e28b004861b3926560bf21d519fb00 (diff)
downloadlove2d-signage-dfa3f53a03250414a5a78351b9d41aecd1cf5a69.tar.gz
love2d-signage-dfa3f53a03250414a5a78351b9d41aecd1cf5a69.tar.bz2
love2d-signage-dfa3f53a03250414a5a78351b9d41aecd1cf5a69.tar.xz
love2d-signage-dfa3f53a03250414a5a78351b9d41aecd1cf5a69.zip
Fix setColor range for love 11+
-rw-r--r--core/node-manager.lua5
-rw-r--r--main.lua2
-rw-r--r--nodes/at.lua6
-rw-r--r--nodes/countdown.lua2
-rw-r--r--nodes/cube.lua2
-rw-r--r--nodes/currency.lua12
-rw-r--r--nodes/misery.lua6
-rw-r--r--nodes/newdash.lua16
-rw-r--r--nodes/screen1.lua2
-rw-r--r--nodes/slideshow.lua4
-rw-r--r--nodes/time.lua2
-rw-r--r--nodes/weather.lua4
-rw-r--r--vendor/push.lua2
13 files changed, 33 insertions, 32 deletions
diff --git a/core/node-manager.lua b/core/node-manager.lua
index d8e6213..20ef8d4 100644
--- a/core/node-manager.lua
+++ b/core/node-manager.lua
@@ -71,11 +71,12 @@ function NodeManager:render()
self.secondaryCanvas:renderTo(function()
self.nextNode:render()
end)
- love.graphics.setColor(255, 255, 255, 255 * (self.stateTime / self.config.transitionTime))
+ print("Transitioning!", 1.0 * (self.stateTime / self.config.transitionTime))
+ love.graphics.setColor(1.0, 1.0, 1.0, 1.0 * (self.stateTime / self.config.transitionTime))
love.graphics.draw(self.secondaryCanvas, 0, 0)
end
- love.graphics.setColor(255, 255, 255, 100)
+ love.graphics.setColor(1.0, 1.0, 1.0, 0.3)
if self.config.showProgress and self.state == 'running' then
local stateTime
diff --git a/main.lua b/main.lua
index 92d828d..e2c1bbc 100644
--- a/main.lua
+++ b/main.lua
@@ -64,7 +64,7 @@ function love.draw()
manager:render()
-- Draw graphs
- love.graphics.setColor(255, 255, 255, 128)
+ love.graphics.setColor(1.0, 1.0, 1.0, 0.5)
-- love.graphics.setNewFont(10)
-- love.graphics.print(inspect(state), 0, 60, 0)
diff --git a/nodes/at.lua b/nodes/at.lua
index e1f2ee9..9adf98c 100644
--- a/nodes/at.lua
+++ b/nodes/at.lua
@@ -14,7 +14,7 @@ function node:render()
love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
if self.state then
- love.graphics.setColor( 255, 255, 255, 100 )
+ love.graphics.setColor( 1.0, 1.0, 1.0, 0.4 )
love.graphics.setFont(bigFont)
love.graphics.printf('Currently at hackerspace:', 50, 100, love.graphics.getWidth() - 100, 'center')
@@ -32,11 +32,11 @@ function node:render()
usersList = usersList .. '\n...and ' .. tostring(self.state.esps) .. ' ESPs'
end
- love.graphics.setColor( 255, 255, 255 )
+ love.graphics.setColor( 1.0, 1.0, 1.0 )
love.graphics.setFont(textFont)
love.graphics.printf(usersList, 50, 220, love.graphics.getWidth() - 100, 'center')
else
- love.graphics.setColor( 255, 255, 255, 80 )
+ love.graphics.setColor( 1.0, 1.0, 1.0, 0.4 )
love.graphics.setFont(smallFont)
love.graphics.printf("Loading at...", 0, love.graphics.getHeight() - 200, love.graphics.getWidth(), 'center')
diff --git a/nodes/countdown.lua b/nodes/countdown.lua
index 19cc965..c5f9530 100644
--- a/nodes/countdown.lua
+++ b/nodes/countdown.lua
@@ -43,7 +43,7 @@ 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.setColor( 1.0, 1.0, 1.0 )
love.graphics.setFont(textFont);
love.graphics.printf(timefmt(math.abs(self.target - os.time()), self.precision), 0, 0.3*love.graphics.getHeight(), love.graphics.getWidth(), 'center');
diff --git a/nodes/cube.lua b/nodes/cube.lua
index 0961ca8..ab9570b 100644
--- a/nodes/cube.lua
+++ b/nodes/cube.lua
@@ -35,7 +35,7 @@ function to2d(p) return p[1] * E / (p[3]+E), p[2] * E / (p[3]+E) end
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.setColor( 1.0, 1.0, 1.0 )
local w = love.graphics.getWidth() / 2
local h = love.graphics.getHeight() / 2
local scl = 6
diff --git a/nodes/currency.lua b/nodes/currency.lua
index e9b4167..a0444d5 100644
--- a/nodes/currency.lua
+++ b/nodes/currency.lua
@@ -21,26 +21,26 @@ function node:render()
if self.state.values and self.state.values[2] then
local pad = 20
- love.graphics.setColor( 255, 255, 255 )
+ love.graphics.setColor( 1.0, 1.0, 1.0 )
love.graphics.setFont(headFont)
love.graphics.printf("BTCPLN", 0, 180, love.graphics.getWidth()/2, 'right')
love.graphics.printf("TRYIDR", 0, 350, love.graphics.getWidth()/2, 'right')
love.graphics.setFont(textFont)
if self.state.changes[1] then
- love.graphics.setColor( 0, 255, 0 )
+ love.graphics.setColor( 0, 1.0, 0 )
else
- love.graphics.setColor( 255, 0, 0 )
+ love.graphics.setColor( 1.0, 0, 0 )
end
love.graphics.printf(self.state.values[1], love.graphics.getWidth()/2 + 2*pad, 180, love.graphics.getWidth()/2 - 2*pad, 'left')
if self.state.changes[2] then
- love.graphics.setColor( 0, 255, 0 )
+ love.graphics.setColor( 0, 1.0, 0 )
else
- love.graphics.setColor( 255, 0, 0 )
+ love.graphics.setColor( 1.0, 0, 0 )
end
love.graphics.printf(self.state.values[2], love.graphics.getWidth()/2 + 2*pad, 350, love.graphics.getWidth()/2 - 2*pad, 'left')
else
- love.graphics.setColor( 255, 255, 255, 80 )
+ love.graphics.setColor( 1.0, 1.0, 1.0, 0.4 )
love.graphics.setFont(smallFont)
love.graphics.printf("Loading currency...", 0, love.graphics.getHeight() - 200, love.graphics.getWidth(), 'center')
diff --git a/nodes/misery.lua b/nodes/misery.lua
index 714cef4..c20ec1a 100644
--- a/nodes/misery.lua
+++ b/nodes/misery.lua
@@ -15,16 +15,16 @@ function node:render()
love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
if self.state then
- love.graphics.setColor( 255, 255, 255 )
+ 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( 255, 255, 255, 200 )
+ 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( 255, 255, 255, 80 )
+ 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')
diff --git a/nodes/newdash.lua b/nodes/newdash.lua
index d9e6d91..2e0f651 100644
--- a/nodes/newdash.lua
+++ b/nodes/newdash.lua
@@ -33,16 +33,16 @@ end
function node:renderIOTState(node_id, endpoint, parameter, x, y)
local rawValue = self:spejsiotData(node_id, endpoint, parameter)
if rawValue == true then
- love.graphics.setColor( 0, 255, 0 )
+ love.graphics.setColor( 0, 1.0, 0 )
love.graphics.printf("ON", x, y, 400, 'left')
elseif rawValue == false then
- love.graphics.setColor( 255, 0, 0 )
+ love.graphics.setColor( 1.0, 0, 0 )
love.graphics.printf("OFF", x, y, 400, 'left')
elseif rawValue == nil then
- love.graphics.setColor( 255, 0, 0 )
+ love.graphics.setColor( 1.0, 0, 0 )
love.graphics.printf("OFFLINE", x, y, 400, 'left')
else
- love.graphics.setColor( 255, 255, 255 )
+ love.graphics.setColor( 1.0, 1.0, 1.0 )
love.graphics.printf(rawValue, x, y, 400, 'left')
end
end
@@ -52,7 +52,7 @@ function node:render()
love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
if self.state then
- love.graphics.setColor( 255, 255, 255 )
+ love.graphics.setColor( 1.0, 1.0, 1.0 )
if weatherGlyphs[self.state.weather] then
love.graphics.setFont(weatherFont)
@@ -85,7 +85,7 @@ function node:render()
self:renderIOTState("c0dbe7", "relay", "on", 900, 438)
self:renderIOTState("0eac42", "spin and blink", "on", 900, 498)
- love.graphics.setColor( 255, 255, 255 )
+ love.graphics.setColor( 1.0, 1.0, 1.0 )
love.graphics.setFont(headerFont)
love.graphics.printf("at hackerspace:", 50, 593, 300, 'left')
love.graphics.setFont(atFont)
@@ -107,12 +107,12 @@ function node:render()
love.graphics.printf(usersList, 350, 598, 900, 'left')
else
- love.graphics.setColor(255, 255, 255, 150)
+ love.graphics.setColor(1.0, 1.0, 1.0, 0.5)
love.graphics.setFont(valueFont)
love.graphics.printf("Loading...", 0, 530, love.graphics.getWidth(), "center")
end
- love.graphics.setColor( 255, 255, 255 )
+ love.graphics.setColor( 1.0, 1.0, 1.0 )
love.graphics.setFont(timeFont)
love.graphics.printf(os.date("%H:%M"), 50, -10, 850, 'center')
love.graphics.setFont(dateFont)
diff --git a/nodes/screen1.lua b/nodes/screen1.lua
index 2df115e..e9b1ffb 100644
--- a/nodes/screen1.lua
+++ b/nodes/screen1.lua
@@ -7,7 +7,7 @@ function node:render()
for x = 0, love.graphics.getWidth() / 50, 1 do
for y = 0, love.graphics.getHeight() / 50, 1 do
local r = math.sin(x + love.timer.getTime() * 2) + math.cos(y + love.timer.getTime() * math.sin(x));
- love.graphics.setColor(255, 255, 255, (r + 2) * 255)
+ love.graphics.setColor(1.0, 1.0, 1.0, (r + 2) * 1.0)
love.graphics.circle("line", x * 50, y * 50, r * 10)
end
end
diff --git a/nodes/slideshow.lua b/nodes/slideshow.lua
index 7abf0fe..d455ebc 100644
--- a/nodes/slideshow.lua
+++ b/nodes/slideshow.lua
@@ -56,10 +56,10 @@ function node:render()
love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
if self.image == nil then
love.graphics.setFont(smallFont);
- love.graphics.setColor( 255, 255, 255, 120 )
+ love.graphics.setColor( 1.0, 1.0, 1.0, 0.5 )
love.graphics.printf('File not found:\n' .. tostring(self.fileName), 0, love.graphics.getHeight()*0.7 , love.graphics.getWidth(), 'center');
else
- love.graphics.setColor( 255, 255, 255 )
+ love.graphics.setColor( 1.0, 1.0, 1.0 )
love.graphics.draw( self.image, love.graphics.getWidth()/2, love.graphics.getHeight()/2, 0, 1, 1, self.image:getWidth()/2, self.image:getHeight()/2 )
end
diff --git a/nodes/time.lua b/nodes/time.lua
index 1e0968b..48b5110 100644
--- a/nodes/time.lua
+++ b/nodes/time.lua
@@ -13,7 +13,7 @@ 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.setColor( 1.0, 1.0, 1.0 )
love.graphics.setFont(textFont);
love.graphics.printf(os.date(self.timeFormat), 0, 0.14*love.graphics.getHeight(), love.graphics.getWidth(), 'center');
diff --git a/nodes/weather.lua b/nodes/weather.lua
index f5bf82c..b29b96e 100644
--- a/nodes/weather.lua
+++ b/nodes/weather.lua
@@ -59,7 +59,7 @@ function node:render()
love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
if self.state then
- love.graphics.setColor( 255, 255, 255 )
+ love.graphics.setColor( 1.0, 1.0, 1.0 )
if weatherGlyphs[self.state.weather] then
love.graphics.setFont(weatherFont)
@@ -78,7 +78,7 @@ function node:render()
love.graphics.printf("Room: " .. tostring(self.state.insideTemperature) .. "° / " .. tostring(self.state.insideHumidity) .. "%RH", 0, love.graphics.getHeight() - 100, love.graphics.getWidth(), 'center')
end
else
- love.graphics.setColor( 255, 255, 255, 80 )
+ love.graphics.setColor( 1.0, 1.0, 1.0, 0.4 )
love.graphics.setFont(smallFont)
love.graphics.printf("Loading weather...", 0, love.graphics.getHeight() - 200, love.graphics.getWidth(), 'center')
diff --git a/vendor/push.lua b/vendor/push.lua
index 321ddca..cb1a947 100644
--- a/vendor/push.lua
+++ b/vendor/push.lua
@@ -74,7 +74,7 @@ function push:finish(shader)
love.graphics.setCanvas()
love.graphics.translate(self._OFFSET.x, self._OFFSET.y)
- love.graphics.setColor(255, 255, 255)
+ love.graphics.setColor(1.0, 1.0, 1.0)
love.graphics.setShader(shader or self._shader)
love.graphics.draw(self._canvas, 0, 0, 0, self._SCALE, self._SCALE)
love.graphics.setCanvas(self._canvas)