• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code How does gif_save_buffer actually work?

I've got a pretty decent gif record code setup so that I can press a button and it will record the next 5 seconds of gameplay and save a gif via the gif_save() function. That's all fine and dandy! :)

What I'd like to learn more about now is the gif_save_buffer() function. Are there any examples out there of how this works? The documentation shows I can save a completed gif to a buffer by doing something like:

Code:
global.capture_buff = gif_save_buffer(gif_image);
From there, I have no idea how to use that.

My next goal is to create a sort of always-recording "instant replay" system with the intention of being able to hit a button and then it would save the past 5 seconds, rather than the next 5 seconds. Will this buffer function allow me to do that sort of thing?

Thanks for reading, cheers!
 

gnysek

Member
Have you tried the whole example from docs ? Below saves 30 frames of game only if application surface is enabled.

Code:
if save_gif == true
{
if count == 0
    {
    gif_image = gif_open(room_width, room_height);
    }
else if count < 30
    {
    gif_add_surface(gif_image, application_surface, 6/100);
    }
else
    {
    global.capture_buff = gif_save_buffer(gif_image);
    count = 0;
    save_gif = false;
    }
count++;
}
 
Have you tried the whole example from docs ? Below saves 30 frames of game only if application surface is enabled.
Hi thanks! Yeah, I did read the full example, and was using it successfully with the regular gif_save() function variation. I just didn't (and still don't) understand how the gif_save_buffer() function worked specifically.

Anyway, I ended up finding a solution to my issue through Nocturnes fantastic marketplace asset "GIFCam". I very much recommend using this if you're doing anything similar. Tah dah!
https://marketplace.yoyogames.com/assets/7865/gifcam
 
Top