draw_sprite_ex(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

✨ draw_sprite_ex(3) ✨

okay bestie, welcome to the Allegro manual πŸ’– this one lives in section 3, and it's about drawing a sprite that can be flipped, blended or tinted β€” all in one gloriously extra little function. no cap.


🌸 NAME 🌸

draw_sprite_ex β€” draws an optionally flipped / blended / tinted sprite onto the bitmap. it's part of the Allegro game programming library, and yes it ate. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <allegro.h>

void draw_sprite_ex(BITMAP *bmp, BITMAP *sprite, int x, int y, int mode,
int flip);

look at her. five arguments. bmp is where it lands, sprite is what lands, x and y are where, and then mode and flip decide how β€” which is the whole point of this function existing, fr fr. 🌈


πŸ¦‹ DESCRIPTION πŸ¦‹

so the way this works is: she draws the sprite image onto the destination bitmap using whatever you put in the mode argument, and she optionally flips the sprite in the orientation you specify with the flip argument. two little dials, infinite vibes. ✨

first dial, the mode argument β€” this is the one that says how the sprite is gonna get drawn onto the destination bitmap:

  • DRAW_SPRITE_NORMAL β€” draws a masked sprite, exactly like draw_sprite() does πŸ‘‘
  • DRAW_SPRITE_LIT β€” draws a tinted sprite, like draw_lit_sprite() 🌞
  • DRAW_SPRITE_TRANS β€” draws a blended sprite, like draw_trans_sprite() 🫧

second dial, the flip argument β€” this one sets the flipping orientation:

  • DRAW_SPRITE_NO_FLIP = 0 β€” do not perform flipping. she stays exactly as she is, no notes πŸ’€
  • DRAW_SPRITE_H_FLIP β€” flip horizontally. mirror mode, main character energy πŸͺž
  • DRAW_SPRITE_V_FLIP β€” flip vertically. upside-down era, lowkey unhinged πŸ™ƒ
  • DRAW_SPRITE_VH_FLIP β€” flip both vertically and horizontally. chaos. iconic. both at once πŸ”₯
ngl the note that DRAW_SPRITE_NO_FLIP equals 0 is doing a lot of work here β€” that's your "default" vibe, so if you just pass 0 you get a regular un-flipped sprite. πŸ’–

πŸ‘‘ SEE ALSO πŸ‘‘

go read these next, bestie, they're the whole friend group:


and that's the page, babes πŸŽ€ this was Allegro version 4.4.3, draw_sprite_ex(3), signing off β€” go draw something gorgeous, you've got this πŸ«ΆπŸ’œ

πŸ“¦ where this page comes from