1SDL_SetVideoMode(3) SDL API Reference SDL_SetVideoMode(3)
2
3
4
6 SDL_SetVideoMode - Set up a video mode with the specified width, height
7 and bits-per-pixel.
8
10 #include "SDL.h"
11
12 SDL_Surface *SDL_SetVideoMode(int width, int height, int bpp, Uint32
13 flags);
14
16 Set up a video mode with the specified width, height and bits-per-
17 pixel.
18
19 If bpp is 0, it is treated as the current display bits per pixel.
20
21 The flags parameter is the same as the flags field of the SDL_Surface
22 structure. OR'd combinations of the following values are valid.
23
24 SDL_SWSURFACE Create the video surface in system memory
25
26 SDL_HWSURFACE Create the video surface in video memory
27
28 SDL_ASYNCBLIT Enables the use of asynchronous updates of the dis‐
29 play surface. This will usually slow down blitting
30 on single CPU machines, but may provide a speed
31 increase on SMP systems.
32
33 SDL_ANYFORMAT Normally, if a video surface of the requested bits-
34 per-pixel (bpp) is not available, SDL will emulate
35 one with a shadow surface. Passing SDL_ANYFORMAT
36 prevents this and causes SDL to use the video sur‐
37 face, regardless of its pixel depth.
38
39 SDL_HWPALETTE Give SDL exclusive palette access. Without this
40 flag you may not always get the the colors you
41 request with SDL_SetColors or SDL_SetPalette.
42
43 SDL_DOUBLEBUF Enable hardware double buffering; only valid with
44 SDL_HWSURFACE. Calling SDL_Flip will flip the buf‐
45 fers and update the screen. All drawing will take
46 place on the surface that is not displayed at the
47 moment. If double buffering could not be enabled
48 then SDL_Flip will just perform a SDL_UpdateRect on
49 the entire screen.
50
51 SDL_FULLSCREEN SDL will attempt to use a fullscreen mode. If a
52 hardware resolution change is not possible (for
53 whatever reason), the next higher resolution will
54 be used and the display window centered on a black
55 background.
56
57 SDL_OPENGL Create an OpenGL rendering context. You should have
58 previously set OpenGL video attributes with
59 SDL_GL_SetAttribute.
60
61 SDL_OPENGLBLIT Create an OpenGL rendering context, like above, but
62 allow normal blitting operations. The screen (2D)
63 surface may have an alpha channel, and
64 SDL_UpdateRects must be used for updating changes
65 to the screen surface.
66
67 SDL_RESIZABLE Create a resizable window. When the window is
68 resized by the user a SDL_VIDEORESIZE event is gen‐
69 erated and SDL_SetVideoMode can be called again
70 with the new size.
71
72 SDL_NOFRAME If possible, SDL_NOFRAME causes SDL to create a
73 window with no title bar or frame decoration.
74 Fullscreen modes automatically have this flag set.
75
76 Note:
77
78 Whatever flags SDL_SetVideoMode could satisfy are set in the
79 flags member of the returned surface.
80
81 Note:
82
83 The bpp parameter is the number of bits per pixel, so a bpp of
84 24 uses the packed representation of 3 bytes/pixel. For the more
85 common 4 bytes/pixel mode, use a bpp of 32. Somewhat oddly, both
86 15 and 16 will request a 2 bytes/pixel mode, but different pixel
87 formats.
88
90 The framebuffer surface, or NULL if it fails. The surface returned is
91 freed by SDL_Quit() and should nt be freed by the caller.
92
94 SDL_LockSurface, SDL_SetColors, SDL_Flip, SDL_Surface
95
96
97
98SDL Tue 11 Sep 2001, 23:01 SDL_SetVideoMode(3)