get_compiled_sprite(3) Creates a compiled sprite using a bitmap as source. Allegro game programming library.


#include <allegro.h>

COMPILED_SPRITE *get_compiled_sprite(BITMAP *bitmap, int planar);


Creates a compiled sprite based on the specified bitmap (which must be a memory bitmap). Compiled sprites are device-dependent, so you have to specify whether to compile it into a linear or planar format. Pass FALSE as the second parameter if you are going to be drawing it onto memory bitmaps or mode 13h and SVGA screen bitmaps, and pass TRUE if you are going to draw it onto mode-X or Xtended mode screen bitmaps. Example:

   BITMAP *bmp;
   /* Create compiled sprite from an existent bitmap. */
   cspr = get_compiled_sprite(bmp, 0);
   if (!cspr)
      abort_on_error("Couldn't create compiled sprite!");
   /* We don't need the bitmap any more.*/
   /* Use the compiled sprite. */
   /* Destroy it when we don't need it any more. */
Returns a pointer to the created compiled sprite, or NULL if the compiled sprite could not be created. Remember to free this compiled sprite later to avoid memory leaks.