1set_gfx_mode(3) Allegro manual set_gfx_mode(3)
2
3
4
6 set_gfx_mode - Sets a graphic video mode. Allegro game programming
7 library.
8
10 #include <allegro.h>
11
12
13 int set_gfx_mode(int card, int w, int h, int v_w, int v_h);
14
16 Switches into graphics mode. The card parameter should usually be one
17 of the Allegro magic drivers (read introduction of chapter "Graphics
18 modes") or see the platform specific documentation for a list of the
19 available drivers. The w and h parameters specify what screen resolu‐
20 tion you want. The color depth of the graphic mode has to be specified
21 before calling this function with set_color_depth().
22
23 The v_w and v_h parameters specify the minimum virtual screen size, in
24 case you need a large virtual screen for hardware scrolling or page
25 flipping. You should set them to zero if you don't care about the vir‐
26 tual screen size.
27
28 When you call set_gfx_mode(), the v_w and v_h parameters represent the
29 minimum size of virtual screen that is acceptable for your program. The
30 range of possible sizes is usually very restricted, and Allegro may end
31 up creating a virtual screen much larger than the one you request.
32 Allowed sizes are driver dependent and some drivers do not allow vir‐
33 tual screens that are larger than the visible screen at all: don't
34 assume that whatever you pass will always work.
35
36 In mode-X the virtual width can be any multiple of eight greater than
37 or equal to the physical screen width, and the virtual height will be
38 set accordingly (the VGA has 256k of vram, so the virtual height will
39 be 256*1024/virtual_width).
40
41 Currently, using a big virtual screen for page flipping is considered
42 bad practice. There are platforms which don't support virtual screens
43 bigger than the physical screen but can create different video pages to
44 flip back and forth. This means that, if you want page flipping and
45 aren't going to use hardware scrolling, you should call set_gfx_mode()
46 with (0,0) as the virtual screen size and later create the different
47 video pages with create_video_bitmap(). Otherwise your program will be
48 limited to the platforms supporting hardware scrolling.
49
50 After you select a graphics mode, the physical and virtual screen sizes
51 can be checked with the macros SCREEN_W, SCREEN_H, VIRTUAL_W, and VIR‐
52 TUAL_H.
53
55 Returns zero on success. On failure returns a negative number and
56 stores a description of the problem in allegro_error.
57
58
60 set_color_depth(3), request_refresh_rate(3), screen(3), gfx_capabili‐
61 ties(3), allegro_error(3), create_video_bitmap(3), get_desktop_resolu‐
62 tion(3), SCREEN_W(3), SCREEN_H(3), VIRTUAL_W(3), VIRTUAL_H(3)
63
64
65
66Allegro version 4.4.2 set_gfx_mode(3)