Been using al_draw_textf for drawing text to screen and it works perfect.. except text transparency. Wondering if anyone knows how to make al_draw_textf or another allegro function/(or maybe shaders) display text with functionality to fade opacity. Appreciate it
You can use al_map_rgba()
to set transparency with al_draw_textf
For example, al_draw_textf(font, al_map_rgba(0,0,0,100),0,0,0,"Transparent");
will draw the the text black, but semi transparent. The last argument in al_map_rgba()
is the alpha channel, which controls transparency (255 being opaque, 0 being transparent).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.