stretch_sprite(3alleg4)

πŸ’– stretch_sprite πŸ’–

okay bestie, so this one is from the Allegro manual β€” it's a lil page about stretching sprites, and it lives in the Allegro game programming library. pull up a chair, we're gonna get into it 🫢


✨ NAME ✨

stretch_sprite β€” stretches a sprite to the destination bitmap. Allegro game programming library. πŸ‘‘


🌸 SYNOPSIS 🌸

#include <allegro.h>

void stretch_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y, int w,
int h);

πŸ¦‹ DESCRIPTION πŸ¦‹

so it's literally draw_sprite() energy, except β€” plot twist β€” it can stretch the sprite image to whatever width and height you tell it. main character behavior fr fr πŸ’…

but okay, there's some conditions, no cap:

  • the sprite image and the destination bitmap have to be the same color depth. non-negotiable bestie 😭
  • also the sprite image must be a memory bitmap. like, it has to be.

and here's a lil example, a tunnel-like effect situation:

/* Create tunnel like effect. */
for (step = 1; step
   int width = SCREEN_W / step;
   int height = SCREEN_H / step;
   stretch_sprite(screen, image, SCREEN_W / 2 - width / 2,
                  SCREEN_H / 2 - height / 2, width, height);
}
🫢 real talk: that's the example exactly as it appears, so don't come for me about the for loop β€” I'm just the messenger.

πŸ‘€ SEE ALSO πŸ‘€


aaaand that's the whole page, bestie πŸ’– this was Allegro, version 4.4.3, and the page itself is stretch_sprite(3alleg4) β€” slay, go stretch something πŸŽ€βœ¨πŸ¦‹