A downloadable extension

Download NowName your own price

Quick links: 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

Import the GifHx script into your GMS≥2.3 project.

Notes

  • As a pure-GML extension, it isn't super fast.
    Doing LZW decompression in GML hurts! (though slightly better with YYC)
    Probably don't use this to load multi-megabyte GIFs.
    It may be possible to optimize the code a little.
  • As of beta runtime 23.1.1.190, doesn't work on HTML5 due to a code generation bug.
    This will probably get fixed sometime soon.
  • 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 36 kB
sprite_add_gif.zip 39 kB
sprite_add_gif_gms1.gmz 399 kB

Development log

Comments

Log in with itch.io to leave a comment.

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.