Browse Source

Separate functionefor the fixmebase design (and later functions), add logo

rorist 9 months ago
parent
commit
8b238abafd
4 changed files with 28 additions and 8 deletions
  1. BIN
      background.png
  2. 0 0
      font.ttf
  3. BIN
      logo.png
  4. 28 8
      node.lua

BIN
background.png


silkscreen.ttf → font.ttf


BIN
logo.png


+ 28 - 8
node.lua

@@ -1,9 +1,31 @@
 gl.setup(1366, 768)
 
-local font = resource.load_font("silkscreen.ttf")
+util.resource_loader{
+    "font.ttf";
+    "background.png";
+	"logo.png";
+}
 
 local json = require('json')
 
+function fixme()
+
+    function draw()
+		background:draw(0,0,WIDTH,HEIGHT)
+        logo:draw(WIDTH-250,5,WIDTH-35,185)
+        font:write(50, 0, "FIXME", 100, 1,1,1,1)
+        font:write(50, 90, "Hackerspace", 100, 1,1,1,1)
+        font:write(50, 720, "https://git.fixme.ch/FIXME/screen", 32, 1,1,1,1)
+   end
+
+   return {
+       draw = draw;
+   }
+
+end
+
+local fix = fixme()
+
 local events = {}
 util.file_watch("events.json", function(data)
     events = json.decode(data)
@@ -22,13 +44,13 @@ util.file_watch("bus.txt", function(content)
 end)
 
 function node.render()
-   font:write(50, 0, "FIXME", 100, 1,1,1,1)
-   font:write(50, 80, "Hackerspace", 100, 1,1,1,1)
 
-   font:write(50, 200, "Power: " .. power, 50, 1,1,1,1)
-   font:write(50, 280, "Next bus (Renens-Village) " .. bus, 50, 1,1,1,1)
+    fix:draw()
 
-   pos = 420
+   font:write(50, 220, "Power: " .. power, 50, 1,1,1,1)
+   font:write(50, 290, "Next bus (Renens-Village) " .. bus, 50, 1,1,1,1)
+
+   pos = 430
    font:write(50, pos-70, "Next Events:", 50, 1,1,1,1)
    for i, e in ipairs(events) do
        text = string.format("%s %s %s - %s", e.s_day, e.s_month, e.s_time, e.name)
@@ -36,6 +58,4 @@ function node.render()
        pos = pos + 40
    end
 
-   font:write(50, 720, "https://git.fixme.ch/FIXME/screen", 32, 1,1,1,1)
-
 end