screen man page

screen — Global pointer to the screen hardware video memory. Allegro game programming library.


#include <allegro.h>

extern BITMAP *screen;


Global pointer to a bitmap, sized VIRTUAL_W x VIRTUAL_H. This is created  by set_gfx_mode(), and represents the hardware video memory. Only a part  of this bitmap will actually be visible, sized SCREEN_W x SCREEN_H.  Normally this is the top left corner of the larger virtual screen, so you  can ignore the extra invisible virtual size of the bitmap if you aren't  interested in hardware scrolling or page flipping. To move the visible  window to other parts of the screen bitmap, call scroll_screen().  Initially the clipping rectangle will be limited to the physical screen  size, so if you want to draw onto a larger virtual screen space outside  this rectangle, you will need to adjust the clipping.

For example, to draw a pixel onto the screen you would write:

   putpixel(screen, x, y, color);

Or to implement a double-buffered system:

   /* Make a bitmap in RAM. */
   BITMAP *bmp = create_bitmap(320, 200);
   /* Clean the memory bitmap. */
   /* 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: be very careful when using this pointer at the same time as any bitmaps created by the create_video_bitmap() function (see the description of this function for more detailed information). And never try to destroy it with destroy_bitmap().

See Also

set_gfx_mode(3), is_screen_bitmap(3), create_video_bitmap(3), scroll_screen(3)

Referenced By

create_video_bitmap(3), ex12bit(3), ex3buf(3), ex3d(3), exaccel(3), exalpha(3), exbitmap(3), exblend(3), excamera(3), excolmap(3), exconfig(3), excustom(3), exdata(3), exdbuf(3), exexedat(3), exflame(3), exflip(3), exfont(3), exgui(3), exhello(3), exjoy(3), exkeys(3), exlights(3), exmem(3), exmidi(3), exmouse(3), expackf(3), expal(3), expat(3), exquat(3), exrgbhsv(3), exrotscl(3), exsample(3), exscale(3), exscn3d(3), exscroll(3), exshade(3), exspline(3), exsprite(3), exstars(3), exstream(3), exswitch(3), exsyscur(3), extimer(3), extrans(3), extrans2(3), extruec(3), exunicod(3), exupdate(3), exxfade(3), exzbuf(3), gfx_capabilities(3), is_screen_bitmap(3), is_video_bitmap(3), SCREEN_W(3), set_gfx_mode(3), VIRTUAL_W(3).

version 4.4.2 Allegro manual