screen(3)
β¨ screen(3) β¨
okay bestie, welcome to the Allegro manual π this one's short but it's load-bearing, so pay attention fr fr
πΈ NAME πΈ
screen β a global pointer to the screen hardware video memory, from the Allegro game programming library π
π¦ SYNOPSIS π¦
#include <allegro.h>
extern BITMAP *screen;
π DESCRIPTION π
So. screen is a global pointer to a bitmap, and it's sized VIRTUAL_W x VIRTUAL_H. It gets created by set_gfx_mode(), and it literally is the hardware video memory. main character energy, honestly π
Only a part of this bitmap is actually visible, and that part is sized SCREEN_W x SCREEN_H. Normally that visible part is just the top left corner of the bigger virtual screen β so if you're not into hardware scrolling or page flipping, you can completely ignore the extra invisible virtual size of the bitmap. no thoughts, head empty, it's fine π«Ά
Wanna move that visible window to other parts of the screen bitmap? Call scroll_screen(). β¨
Also important: at the start, the clipping rectangle is limited to the physical screen size. So if you wanna draw onto a larger virtual screen space outside that rectangle, you're gonna have to adjust the clipping yourself. yes really π
π Examples bestie, because examples eat every time π
Wanna draw a single pixel onto the screen? Boom:
putpixel(screen, x, y, color);
Wanna implement a double-buffered system? Say less:
/* Make a bitmap in RAM. */
BITMAP *bmp = create_bitmap(320, 200);
/* Clean the memory bitmap. */
clear_bitmap(bmp);
/* Draw onto the memory bitmap. */
putpixel(bmp, x, y, color);
/* Copy it to the screen. */
blit(bmp, screen, 0, 0, 0, 0, 320, 200);
β οΈ Warning, and I need you to actually read this one: be very careful when you use this pointer at the same time as any bitmaps made by thecreate_video_bitmap()function β check the description of that function for the detailed tea. And never try to destroy it withdestroy_bitmap(). not even once. not even a little. π
π SEE ALSO π
and that's the whole page, bestie β this was Allegro version 4.4.3, brought to you by the Allegro crew, from the screen(3) era. slay, go draw some pixels, ily πΈπβ¨
π¦ 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