Legacy GM [SOLVED]Q:Surface_save

Z

zendraw

Guest
where does game maker save the surface using this function? the manual doesnt tell.

is this code going to work anyway?
for now nothing is saved in the working_directory. if thats where it supposed to save then somthing is probably wrong with the code
Code:
if (keyboard_check_pressed(vk_printscreen))
{
    if (surface_exists(surf))
    {
        surface_set_target(surf);
       
        if (ds_exists(global.grid, ds_type_grid))
        {
            var i=0;
            var j=0;
           
            repeat (ds_grid_width(global.grid))
            {
                j=0;
                repeat (ds_grid_height(global.grid))
                {
                    draw_sprite_part(global.grid[# i, j], -1, 0, 0, 1, 1, i, j);
                    j++;
                }
                i++;
            }
        }
       
        surface_save(surf, 'test.png');
       
        surface_reset_target();
       
        surface_free(surf);
    }
}
its supposed to save the topleft pixel of the sprites
 
Last edited by a moderator:
Z

zendraw

Guest
by local storage you mean where it usually saves the ini files? well i know that dir and theres nothing there, only when i create an ini file it creates a folder for the game. otherwise nothing. theres somthing wrong with the code then?
 

TsukaYuriko

☄️
Forum Staff
Moderator
That code is isolated and has an external dependency (the grid), so there is no way for us to tell. I suggest setting a breakpoint and using the debugger to trace the code's execution to find out which lines of code are actually executing, and which ones may not be.
 
Z

zendraw

Guest
hah, so the code works, the problem was that i use vk_printscreen to trigger it and for some reason it doesnt trigger. now i use f11 and it works fine.

PS: tryed to save an image with original size of the room and it crashed the game, just so any1 who uses it to know.
 
Top