First off that’s wicked cool! And I love you used Defold for something utilitarian. I’ll check out the source. I basically just want to load say a 1000 x 1000 image into a box that is say 500 x 500 and not have it stretch/shrink to fit but instead be panable inside that defined window. Then surround it with gui, etc.
I’m making progress but stumbled on a different issue as I try to just get a hackable prototype going. I’m trying to load two images from disk and set each to a new texture and populate their corresponding gui.node box.
filename = "scroll-room-examp"
filename = "/main/bundled_resources/common/scene-backgrounds/"..filename..".png"
local data, error = sys.load_resource(filename)
if not data then
print("error: "..error)
return
end
local png = image.load(data)
gui.new_texture("placeimage", png.width, png.height, "rgb", png.buffer)
gui.set_texture(imagery, "placeimage")
filename = "women"
filename = "/main/bundled_resources/common/scene-objects/"..filename..".png"
local data2, error = sys.load_resource(filename)
if not data2 then
print("error: "..error)
return
end
newpng = image.load(data2)
gui.new_texture("objecttoload", newpng.width, newpng.height, "rgb", newpng.buffer)
gui.set_texture(object1, "objecttoload")
But on the last line it’s triggering
Texture ‘objecttoload’ is not specified in scene
I renamed some of the variables on the second block of loading code just to see if there was some issue there… I’m sure this isn’t the way to load multiple objects from disk to display in-game but again I’m just trying to get a quick and dirty version of this idea up and running first.
Going to look back at some older code that didn’t have this problem in meantime.
This call is likely failing for some reason. Check the return value (true/false). Do you see any errors in the console?
Note: In the next release (beta on Monday) we have improved gui.new_texture() so that you get more info about why it is failing (out of resources, data format error etc).
So… I was tracking down other ideas and ended up here: Loading image from file (SOLVED) (hahahahah)
and I flipped it from Rgb to Rgba (the opposite of the previous problem) and it worked. Is RGBA vs. RGB a transparency issue? This image has transparency.
Ok, great! You found it. It does log “Invalid image buffer size” which is an indication that there was something wrong with the data. In the next version of Defold you’ll be able to catch this specific problem.