D
direstatus
Guest
While writing a image gallery/viewer application, I encountered a problem that is giving me a headache.
The problem: Can't load .gif files via sprite_add(...)
I attempted to add a .gif via sprite_add(...) but I encountered a "Stack overflow..." dialog with message: "gml_Object_object0_Draw_0" ...(object0 seems to reference the calling object).
Background: Documentation states that .gif files can be added via sprite_add(...) but that all arguments except for fname should be 0. Granted this I'm expecting a sprite of the first frame of the .gif to be loaded as long as I provide a valid fname. fname is confirmed via file_exists(...) or by manually checking the working_directory and %appdata%/local/game_name folder while ensuring originals are in projectfile/datafiles/.../ directory (as far as I know, this is as much as you can do to confirm files are where GM can find them). I expect to be able to display this .gif via the conventional method of draw_sprite(...). I cannot due to a stack overflow.
Attempted Solutions:
Made a blank project, with 1 room, 1 object, 1 included file. The object is persistently placed into the room and attempts to assign the included file ("img1.gif") to a sprite via sprite_add(...) using the following script...
I tried various combinations of arguments but that changed nothing. Since I can't even get a simple script like this to work, I don't know where else I can go from here. I must be missing something basic.
Additional Background Info:
Initially encountered when writing a image viewer application. Application handles .png and .jpg as expected, it reads filenames out of a .ini file and grabs the referenced files from project included files, and gracefully handles missing files/corrupted .ini files (I like to wreck-test my applications and data files). Everything performs fine until .gifs are introduced.
I've been stuck on this problem for a hour or so. I've made sure to reference the tutorials and the documentation to ensure I didn't make a obvious technical mistake so I'm assuming I've made a more general mistake I can't see because of my noobiness.
Initially I assumed I made a mistake in my for() loops somewhere because of the stack overflow, giving me a for loop that ran until memory ran out. I removed the for loops again and again until I found the source of the error to be a section of code that worked fine until now, but broke as soon as it tried to load a .gif. Unable to find a reasonable solution as to why this was I made a new project to try and load the problematic .gif directly, without any possibility of my other code interfering. Once that failed I tried other .gifs thinking that the original test .gif may have been problematic (should have done this sooner) but that ended up not mattering. Still failed. Turned out to fail no matter what size or type of .gif was loaded. Decided to make this forum post to find help.
The problem: Can't load .gif files via sprite_add(...)
I attempted to add a .gif via sprite_add(...) but I encountered a "Stack overflow..." dialog with message: "gml_Object_object0_Draw_0" ...(object0 seems to reference the calling object).
Background: Documentation states that .gif files can be added via sprite_add(...) but that all arguments except for fname should be 0. Granted this I'm expecting a sprite of the first frame of the .gif to be loaded as long as I provide a valid fname. fname is confirmed via file_exists(...) or by manually checking the working_directory and %appdata%/local/game_name folder while ensuring originals are in projectfile/datafiles/.../ directory (as far as I know, this is as much as you can do to confirm files are where GM can find them). I expect to be able to display this .gif via the conventional method of draw_sprite(...). I cannot due to a stack overflow.
Attempted Solutions:
Made a blank project, with 1 room, 1 object, 1 included file. The object is persistently placed into the room and attempts to assign the included file ("img1.gif") to a sprite via sprite_add(...) using the following script...
Code:
spr1 = sprite_add('img1.gif',0,0,0,0,0);
draw_sprite(spr1,0,0,0);
Additional Background Info:
Initially encountered when writing a image viewer application. Application handles .png and .jpg as expected, it reads filenames out of a .ini file and grabs the referenced files from project included files, and gracefully handles missing files/corrupted .ini files (I like to wreck-test my applications and data files). Everything performs fine until .gifs are introduced.
I've been stuck on this problem for a hour or so. I've made sure to reference the tutorials and the documentation to ensure I didn't make a obvious technical mistake so I'm assuming I've made a more general mistake I can't see because of my noobiness.
Initially I assumed I made a mistake in my for() loops somewhere because of the stack overflow, giving me a for loop that ran until memory ran out. I removed the for loops again and again until I found the source of the error to be a section of code that worked fine until now, but broke as soon as it tried to load a .gif. Unable to find a reasonable solution as to why this was I made a new project to try and load the problematic .gif directly, without any possibility of my other code interfering. Once that failed I tried other .gifs thinking that the original test .gif may have been problematic (should have done this sooner) but that ended up not mattering. Still failed. Turned out to fail no matter what size or type of .gif was loaded. Decided to make this forum post to find help.