|
|
@@ -2,16 +2,22 @@ gl.setup(800,600)
|
|
|
|
|
|
local json = require "json"
|
|
|
local font = resource.load_font("silkscreen.ttf")
|
|
|
-local cur_image = resource.load_image("1.png")
|
|
|
+local cur_image = resource.load_image("/home/david/git/especificos-node/node/1.png")
|
|
|
+local state = "diapo"
|
|
|
+local cur_preg = ""
|
|
|
+local time = "0:0"
|
|
|
+local img_prog="0/0"
|
|
|
|
|
|
node.alias("eba")
|
|
|
|
|
|
function decode_command(line)
|
|
|
local cmd = json.decode(line)
|
|
|
print(line)
|
|
|
+ print(cmd.type)
|
|
|
if cmd.type == "diapo" then
|
|
|
cur_image:dispose()
|
|
|
- cur_image = resource.load_image(cmd.image)
|
|
|
+ cur_image = resource.load_image(cmd.value)
|
|
|
+ img_prog= cmd.progress
|
|
|
elseif cmd.type == "pregunta" then
|
|
|
cur_preg = cmd.preg
|
|
|
elseif cmd.type == "time" then
|
|
|
@@ -26,13 +32,11 @@ end
|
|
|
|
|
|
--node.event("input", decode_command) -- listen to TCP
|
|
|
node.event("data", decode_command) -- listen to UDP
|
|
|
-state = "diapo"
|
|
|
-cur_preg = ""
|
|
|
-time = "0:0"
|
|
|
function node.render()
|
|
|
if state == "diapo" then
|
|
|
cur_image:draw(0,0,WIDTH,HEIGHT)
|
|
|
font:write(730,580,time,20,1,1,1,1)
|
|
|
+ font:write(10,580,img_prog,20,1,1,1,1)
|
|
|
elseif state == "pregunta" then
|
|
|
preguntas:draw(0,0,WIDTH,HEIGHT)
|
|
|
font:write(120,320,cur_preg,20,1,1,1,1)
|