draw_lit_sprite(3)
β¨ draw_lit_sprite β¨
okay bestie, gather round, because this one is from the Allegro game programming library (manual section 3, if you're keeping track π ) and it is literally the glow-up function for your sprites.
πΈ NAME πΈ
draw_lit_sprite β draws a sprite tinted with a specific color. Allegro game programming library, no cap. π
π¦ SYNOPSIS π¦
#include <allegro.h>
void draw_lit_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y, int color);
π DESCRIPTION π
Okay so here's the tea, and it's different depending on your color depth, so pay attention. π
In 256-color modes, it uses the global color_map table to tint the sprite image to the specified color, or to light it to the level specified by (create_trans_table or create_light_table) β and then it draws the resulting image to the destination bitmap.
In truecolor modes, it uses the blender functions to light the sprite image using the alpha level specified by color. and this is the part that gets people: the alpha level which was passed to the blender functions is ignored. yep, ignored. then it draws the resulting image to the destination bitmap.
The color parameter must be in the range [0-255] whatever its actual meaning is. periodt. π«Ά
β οΈ This must only be used after you have set up the color mapping table (for 256-color modes) or the blender functions (for truecolor modes). like, do the setup first, bestie, don't skip it. π
Example, because a vibe check needs receipts:
/* Some one time initialisation code. */
COLOR_MAP global_light_table;
create_light_table(&global_trans_table, my_palette,
10, 10, 60, NULL);
...
if (get_color_depth() == 8)
color_map = &global_light_table;
else
set_trans_blender(40, 40, 255, 255);
/* Lit the cape with a blueish light. */
draw_lit_sprite(buffer, colored_cape, x, y, 64);
π₯ SEE ALSO π₯
the whole friend group, fr fr:
draw_sprite(3)draw_trans_sprite(3)draw_gouraud_sprite(3)draw_lit_rle_sprite(3)color_map(3)set_trans_blender(3)bitmap_mask_color(3)exblend(3)
mwah π that's the whole page, you ate it, go tint something gorgeous. this came to you from Allegro version 4.4.3 β draw_lit_sprite(3), iconic, no notes. β¨ππ
π¦ where this page comes from
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms