SgtMoose151996
Member
I have implemented an object for recording and saving GIFs during gameplay (with the help of Shaun Spalding's tutorial). The code in the
The Goal
Currently, the player has to press
The Idea
_________________________________________________
I would appreciate feedback on this hypothetical approach. The GIF functions are relatively new, so any additional guidance on the coding front would be appreciated as well.
Post Draw
event is shown below.
GML:
/// @description Record GIF
key_record = keyboard_check_pressed(vk_tab) ||
gamepad_button_check_pressed(0,gp_select) ||
gamepad_button_check_pressed(4,gp_select);
// Toggle GIF
if (key_record)
{
gifRecord = !gifRecord;
// Start recording GIF
if (gifRecord)
gif = gif_open(320, 180);
// Save GIF
else
gif_save(gif, "capture.gif");
}
// Record GIF
if (gifRecord) gif_add_surface(gif, application_surface, 2, 0, 0, 2);
Currently, the player has to press
key_record
once to begin recording and one again to save the recording as a GIF. I would like to extend this so that the player only has to press one button to save a GIF recording.The Idea
- My current idea is to store the appropriate amount of frames (labeled N frames) to create a 5-second GIF in memory
- A queue data structure would work in theory to store the N frames
- The frame from more than 5 seconds ago would be removed from the head of the queue and the current frame would be added to the tail
- When the record button is pressed, all of the frames currently in the queue would be added to an open GIF and saved.
_________________________________________________
I would appreciate feedback on this hypothetical approach. The GIF functions are relatively new, so any additional guidance on the coding front would be appreciated as well.