summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBwa <b.was@infbud.pl>2017-01-15 23:03:16 +0000
committerBwa <b.was@infbud.pl>2017-01-15 23:03:16 +0000
commit9e505d14f288532afbe7e0ef0431e6e704ad892a (patch)
treea7e1216c8e68144da6e8e57495006cc085082fa2
parent30247ffb87bceca7a7fed8756fb1a1a9963c86a2 (diff)
downloadlove2d-signage-9e505d14f288532afbe7e0ef0431e6e704ad892a.tar.gz
love2d-signage-9e505d14f288532afbe7e0ef0431e6e704ad892a.tar.bz2
love2d-signage-9e505d14f288532afbe7e0ef0431e6e704ad892a.tar.xz
love2d-signage-9e505d14f288532afbe7e0ef0431e6e704ad892a.zip
New slideshow node
-rw-r--r--config.lua1
-rw-r--r--images/pig.pngbin0 -> 7144 bytes
-rw-r--r--nodes/cube.lua2
-rw-r--r--nodes/slideshow.lua28
4 files changed, 30 insertions, 1 deletions
diff --git a/config.lua b/config.lua
index 7325725..7ef5bac 100644
--- a/config.lua
+++ b/config.lua
@@ -8,6 +8,7 @@ return {
{'nodes.weather'},
{'nodes.misery', displayTime = 7},
{'nodes.screen1'},
+ {'nodes.slideshow', fileName='images/pig.png', displayTime=5},
},
environment = os.getenv('ENV') or 'prod',
}
diff --git a/images/pig.png b/images/pig.png
new file mode 100644
index 0000000..a886e69
--- /dev/null
+++ b/images/pig.png
Binary files differ
diff --git a/nodes/cube.lua b/nodes/cube.lua
index a0df716..0961ca8 100644
--- a/nodes/cube.lua
+++ b/nodes/cube.lua
@@ -1,6 +1,6 @@
local node = Node:extend('nodes.at', {
})
-local papa = love.graphics.newImage("papa.png")
+-- local papa = love.graphics.newImage("papa.png")
local h = 25.0
local v = {
{-h, -h, -h},
diff --git a/nodes/slideshow.lua b/nodes/slideshow.lua
new file mode 100644
index 0000000..f6c778b
--- /dev/null
+++ b/nodes/slideshow.lua
@@ -0,0 +1,28 @@
+local node = Node:extend('nodes.slideshow', {})
+
+local smallFont = love.graphics.newFont('fonts/Lato-Light.ttf', 60)
+
+function node:init(config)
+ self.super:init(config)
+ if (self.fileName ~= Nil) and (love.filesystem.exists( self.fileName )) then
+ self.image = love.graphics.newImage( self.fileName )
+ else
+ self.image = Nil
+ end
+end
+
+function node:render()
+ love.graphics.setColor( 0, 0, 0 )
+ 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 )
+ love.graphics.printf('File not found.', 0, love.graphics.getHeight()/2 , love.graphics.getWidth(), 'center');
+ else
+ love.graphics.setColor( 255, 255, 255 )
+ 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
+
+end
+
+return node