Closed rocklyve closed 7 years ago
You can solve that like this:
gl.setup(NATIVE_WIDTH, NATIVE_HEIGHT)
local function parse_filename_from_filecontent(content)
-- parse content and get 3rd line
end
util.file_watch("text-file.txt", function(raw)
background = resource.load_image(parse_filename_from_filecontent(raw))
end
function node.render()
util.draw_correct(background, 0, 0, WIDTH, HEIGHT)
end
Don't use absolute paths or relative paths. Just use filenames to files in the current node directory. info-beamer can't (by default) load files outside of the node directory. This is by design.
Hey, in my project, I have a text file with 3 lines. In one line there is a path to an image file. I want to view the image in my node.lua. I'm not able to execute
local background = resource.load_image(IMGname)
outside of node.render() because I don't know the path before executing node.render() because I have to read the path from the nth line of the text field. Is there an opportunity to definelocal background
outside of node.render() and declare the variablebackground
insidenode.render()
withbackground = resource.load_image(path) background:draw(x,x,x,x)
Thepath
variable is the relative or absolute path (I tried both) to the image. I don't know if this should work like this... can you help me? Best regards