Fix setColor range for love 11+
parent
6c14716222
commit
dfa3f53a03
|
@ -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
|
||||
|
|
2
main.lua
2
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)
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue