summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPiotr Dobrowolski <admin@tastycode.pl>2017-01-16 21:51:04 +0100
committerPiotr Dobrowolski <admin@tastycode.pl>2017-01-16 21:51:04 +0100
commita287845bf622e2669c42ba5261b1c86a2229b741 (patch)
tree46479bc6212df9ee8321f443705e1ae3286850da
parent30247ffb87bceca7a7fed8756fb1a1a9963c86a2 (diff)
downloadlove2d-signage-a287845bf622e2669c42ba5261b1c86a2229b741.tar.gz
love2d-signage-a287845bf622e2669c42ba5261b1c86a2229b741.tar.bz2
love2d-signage-a287845bf622e2669c42ba5261b1c86a2229b741.tar.xz
love2d-signage-a287845bf622e2669c42ba5261b1c86a2229b741.zip
Move screen resolution to config, make time node solution-flexible
- move screen resolution to config file - time node is more resolution-flexible
-rw-r--r--config.lua2
-rw-r--r--main.lua2
-rw-r--r--nodes/time.lua4
3 files changed, 5 insertions, 3 deletions
diff --git a/config.lua b/config.lua
index 7325725..7aee5b3 100644
--- a/config.lua
+++ b/config.lua
@@ -10,4 +10,6 @@ return {
{'nodes.screen1'},
},
environment = os.getenv('ENV') or 'prod',
+ renderWidth = 1280,
+ renderHeight = 720,
}
diff --git a/main.lua b/main.lua
index 87fe2ee..844f0f3 100644
--- a/main.lua
+++ b/main.lua
@@ -14,7 +14,7 @@ local debugGraph = require('vendor.debugGraph')
local fpsGraph, memGraph;
-local gameWidth, gameHeight = 1280, 720
+local gameWidth, gameHeight = config.renderWidth, config.renderHeight
local windowWidth, windowHeight = love.window.getDesktopDimensions()
windowWidth, windowHeight = windowWidth*.5, windowHeight*.5 --make the window a bit smaller than the screen itself
diff --git a/nodes/time.lua b/nodes/time.lua
index 129fd4a..7f8befc 100644
--- a/nodes/time.lua
+++ b/nodes/time.lua
@@ -10,10 +10,10 @@ function node:render()
love.graphics.setColor( 255, 255, 255 )
love.graphics.setFont(textFont);
- love.graphics.printf(os.date('%H:%M'), 0, 100, love.graphics.getWidth(), 'center');
+ love.graphics.printf(os.date('%H:%M'), 0, 0.14*love.graphics.getHeight(), love.graphics.getWidth(), 'center');
love.graphics.setFont(smallFont);
- love.graphics.printf(os.date('%Y/%m/%d'), 0, 575, love.graphics.getWidth(), 'center');
+ love.graphics.printf(os.date('%Y/%m/%d'), 0, 0.8*love.graphics.getHeight(), love.graphics.getWidth(), 'center');
end
return node