summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPiotr Dobrowolski <admin@tastycode.pl>2017-01-17 17:51:48 +0100
committerPiotr Dobrowolski <admin@tastycode.pl>2017-01-17 17:51:48 +0100
commitffccb380f7c12e20251c8c291c93c86e7f4999ad (patch)
treeeede7180abc8f4d67980830ad5f9e45e5e6c1b86
parentc41bb6c1ddf4cadc0841346312c40871436183f1 (diff)
downloadlove2d-signage-ffccb380f7c12e20251c8c291c93c86e7f4999ad.tar.gz
love2d-signage-ffccb380f7c12e20251c8c291c93c86e7f4999ad.tar.bz2
love2d-signage-ffccb380f7c12e20251c8c291c93c86e7f4999ad.tar.xz
love2d-signage-ffccb380f7c12e20251c8c291c93c86e7f4999ad.zip
Add display time progress bar
-rw-r--r--config.lua1
-rw-r--r--core/node-manager.lua10
2 files changed, 11 insertions, 0 deletions
diff --git a/config.lua b/config.lua
index 98106c7..b2bd7fe 100644
--- a/config.lua
+++ b/config.lua
@@ -1,6 +1,7 @@
return {
displayTime = 2,
transitionTime = 0.5,
+ showProgress = true,
nodes = {
{'nodes.at'},
{'nodes.cube'},
diff --git a/core/node-manager.lua b/core/node-manager.lua
index 5ec45a9..adc9fb5 100644
--- a/core/node-manager.lua
+++ b/core/node-manager.lua
@@ -74,6 +74,16 @@ function NodeManager:render()
love.graphics.setColor(255, 255, 255, 255 * (self.stateTime / self.config.transitionTime))
love.graphics.draw(self.secondaryCanvas, 0, 0)
end
+
+ love.graphics.setColor(255, 255, 255, 100)
+
+ if self.config.showProgress and self.state == 'running' then
+ local stateTime
+ stateTime = self.currentNode.displayTime or self.config.displayTime
+ local h = 5
+ love.graphics.rectangle("fill", 0, love.graphics.getHeight() - h, (self.stateTime / stateTime) * love.graphics.getWidth(), h)
+ end
+
end
function NodeManager:update(dt)