| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- gl.setup(800,600)
- local json = require "json"
- local font = resource.load_font("silkscreen.ttf")
- local cur_image = resource.load_image("../test/1.png")
- node.alias("eba")
- function decode_command(line)
- local cmd = json.decode(line)
- print(line)
- if cmd.type == "diapo" then
- cur_image:dispose()
- cur_image = resource.load_image(cmd.image)
- elseif cmd.type == "pregunta" then
- cur_preg = cmd.preg
- elseif cmd.type == "time" then
- time = cmd.time
- print(time)
- elseif cmd.type == "video" then
- -- ?
- elseif cmd.type == "switch" then
- state = cmd.new_state
- end
- 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)
- elseif state == "pregunta" then
- preguntas:draw(0,0,WIDTH,HEIGHT)
- font:write(120,320,cur_preg,20,1,1,1,1)
- end
- end
|