A downloadable extension

Download NowName your own price

Quick links: documentation · source code
Supported platforms: All (see notes below)
Supported versions: GameMaker Studio≥2.3

This extension allows you to load animated GIFs as sprites into your GameMaker games!
It is based on Haxe "format" library implementation contributed by Yanrishatum.

Functions

  • sprite_add_gif(path, xorigin, yorigin, ?delays_array)➜sprite
    Equivalent of sprite_add. Path should point to a valid GIF file.
    If delays_array is provided (optional), per-frame delays (in centiseconds) will be pushed to it, allowing for accurate playback (see demo project).
  • sprite_add_gif_buffer(buffer, xorigin, yorigin, ?delays_array)➜sprite
    Same as above, but takes a buffer with GIF file inside.

Setting up

GameMaker Studio 2.3 and GM2022+
Import the GifHx script into your GMS≥2.3 project.

GameMaker: Studio and GameMaker Studio 2.2.x
Instructions

Notes

  • As a pure-GML extension, it isn't super fast.
    Doing LZW decompression in GML hurts! (though slightly better with YYC).
    It may be possible to optimize the code a little.
    For GIFs with a lot of frames, you'll want to use the "frame sprites" option.
  • Note that the example project is mostly intended for Windows because GM doesn't implement file dialogs on other platforms.
    The default sample GIF will still load though!

Download

Download NowName your own price

Click download now to get access to the following files:

GifHx.gml 41 kB
Version 2024-06-07a
sprite_add_gif.html 28 kB
Version 2024-06-07a
sprite_add_gif_demo.zip 2.5 MB
Version 2024-06-07a
sprite_add_gif_demo.yyz 48 kB
Version 2024-06-07a
sprite_add_gif_gms1.gmz 39 kB
Version 2024-06-07a

Development log

Comments

Log in with itch.io to leave a comment.

for some gifs theres quite a big freeze for a bit while loading the gifs, is there any possible way to have it load while not freezing the game, and just take a second to show up or is the game freezing the only option? thank you!

(2 edits)

If someone paid me, I think I could make the extension load one frame at a time, which would then let you load the GIF bit-by-bit instead of all at once.

If you know Haxe, you can try doing that yourself (see source code) - gotta split up the GifReader.read and Gif.read methods.

I'm willing to pay. How much?

$50 or so

sounds good, can I pay you through itch.io or some other method?

Itch works, or there’s a PayPal on my hotmail contact address.

I haven't started building my games yet. But this seems like a must-have. Thanks. 

(1 edit)

It might be perfect for an animated logo after the splash screen, if hopefully works on android build. I will try it sometime in the future when the game is almost finished

If a logo is pre-determined, you could very well add it as an actual sprite and assign it into a separate texture group so that it doesn't take up any space used by in-game imagery.

The extension should work fine on Android though.

Thank you for replying! 

I've already implemented on previous project the logo as you described. I am just looking for a neater way to do it.