1screen(3) Allegro manual screen(3)
2
3
4
6 screen - Global pointer to the screen hardware video memory. Allegro
7 game programming library.
8
10 #include <allegro.h>
11
12
13 extern BITMAP *screen;
14
16 Global pointer to a bitmap, sized VIRTUAL_W x VIRTUAL_H. This is cre‐
17 ated by set_gfx_mode(), and represents the hardware video memory. Only
18 a part of this bitmap will actually be visible, sized SCREEN_W x
19 SCREEN_H. Normally this is the top left corner of the larger virtual
20 screen, so you can ignore the extra invisible virtual size of the bit‐
21 map if you aren't interested in hardware scrolling or page flipping. To
22 move the visible window to other parts of the screen bitmap, call
23 scroll_screen(). Initially the clipping rectangle will be limited to
24 the physical screen size, so if you want to draw onto a larger virtual
25 screen space outside this rectangle, you will need to adjust the clip‐
26 ping.
27
28 For example, to draw a pixel onto the screen you would write:
29
30 putpixel(screen, x, y, color);
31
32 Or to implement a double-buffered system:
33
34 /* Make a bitmap in RAM. */
35 BITMAP *bmp = create_bitmap(320, 200);
36 /* Clean the memory bitmap. */
37 clear_bitmap(bmp);
38 /* Draw onto the memory bitmap. */
39 putpixel(bmp, x, y, color);
40 /* Copy it to the screen. */
41 blit(bmp, screen, 0, 0, 0, 0, 320, 200);
42
43 Warning: be very careful when using this pointer at the same time as
44 any bitmaps created by the create_video_bitmap() function (see the
45 description of this function for more detailed information). And never
46 try to destroy it with destroy_bitmap().
47
48
50 set_gfx_mode(3), is_screen_bitmap(3), create_video_bitmap(3),
51 scroll_screen(3)
52
53
54
55Allegro version 4.2.2 screen(3)