tune the preloads a bit
[sdl_omap.git] / docs / html / sdlsetvideomode.html
CommitLineData
e14743d1 1<HTML
2><HEAD
3><TITLE
4>SDL_SetVideoMode</TITLE
5><META
6NAME="GENERATOR"
7CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
8"><LINK
9REL="HOME"
10TITLE="SDL Library Documentation"
11HREF="index.html"><LINK
12REL="UP"
13TITLE="Video"
14HREF="video.html"><LINK
15REL="PREVIOUS"
16TITLE="SDL_VideoModeOK"
17HREF="sdlvideomodeok.html"><LINK
18REL="NEXT"
19TITLE="SDL_UpdateRect"
20HREF="sdlupdaterect.html"></HEAD
21><BODY
22CLASS="REFENTRY"
23BGCOLOR="#FFF8DC"
24TEXT="#000000"
25LINK="#0000ee"
26VLINK="#551a8b"
27ALINK="#ff0000"
28><DIV
29CLASS="NAVHEADER"
30><TABLE
31SUMMARY="Header navigation table"
32WIDTH="100%"
33BORDER="0"
34CELLPADDING="0"
35CELLSPACING="0"
36><TR
37><TH
38COLSPAN="3"
39ALIGN="center"
40>SDL Library Documentation</TH
41></TR
42><TR
43><TD
44WIDTH="10%"
45ALIGN="left"
46VALIGN="bottom"
47><A
48HREF="sdlvideomodeok.html"
49ACCESSKEY="P"
50>Prev</A
51></TD
52><TD
53WIDTH="80%"
54ALIGN="center"
55VALIGN="bottom"
56></TD
57><TD
58WIDTH="10%"
59ALIGN="right"
60VALIGN="bottom"
61><A
62HREF="sdlupdaterect.html"
63ACCESSKEY="N"
64>Next</A
65></TD
66></TR
67></TABLE
68><HR
69ALIGN="LEFT"
70WIDTH="100%"></DIV
71><H1
72><A
73NAME="SDLSETVIDEOMODE"
74></A
75>SDL_SetVideoMode</H1
76><DIV
77CLASS="REFNAMEDIV"
78><A
79NAME="AEN1239"
80></A
81><H2
82>Name</H2
83>SDL_SetVideoMode&nbsp;--&nbsp;Set up a video mode with the specified width, height and bits-per-pixel.</DIV
84><DIV
85CLASS="REFSYNOPSISDIV"
86><A
87NAME="AEN1242"
88></A
89><H2
90>Synopsis</H2
91><DIV
92CLASS="FUNCSYNOPSIS"
93><A
94NAME="AEN1243"
95></A
96><P
97></P
98><PRE
99CLASS="FUNCSYNOPSISINFO"
100>#include "SDL.h"</PRE
101><P
102><CODE
103><CODE
104CLASS="FUNCDEF"
105>SDL_Surface *<B
106CLASS="FSFUNC"
107>SDL_SetVideoMode</B
108></CODE
109>(int width, int height, int bpp, Uint32 flags);</CODE
110></P
111><P
112></P
113></DIV
114></DIV
115><DIV
116CLASS="REFSECT1"
117><A
118NAME="AEN1249"
119></A
120><H2
121>Description</H2
122><P
123>Set up a video mode with the specified width, height and bits-per-pixel.</P
124><P
125>If <TT
126CLASS="PARAMETER"
127><I
128>bpp</I
129></TT
130> is 0, it is treated as the
131current display bits per pixel.</P
132><P
133>The <TT
134CLASS="PARAMETER"
135><I
136>flags</I
137></TT
138> parameter is the same as the <TT
139CLASS="STRUCTFIELD"
140><I
141>flags</I
142></TT
143> field of the <A
144HREF="sdlsurface.html"
145><SPAN
146CLASS="STRUCTNAME"
147>SDL_Surface</SPAN
148></A
149> structure. OR'd combinations of the following values are valid.</P
150><DIV
151CLASS="INFORMALTABLE"
152><A
153NAME="AEN1259"
154></A
155><P
156></P
157><TABLE
158BORDER="1"
159CLASS="CALSTABLE"
160><TBODY
161><TR
162><TD
163ALIGN="LEFT"
164VALIGN="TOP"
165><TT
166CLASS="LITERAL"
167>SDL_SWSURFACE</TT
168></TD
169><TD
170ALIGN="LEFT"
171VALIGN="TOP"
172>Create the video surface in system memory</TD
173></TR
174><TR
175><TD
176ALIGN="LEFT"
177VALIGN="TOP"
178><TT
179CLASS="LITERAL"
180>SDL_HWSURFACE</TT
181></TD
182><TD
183ALIGN="LEFT"
184VALIGN="TOP"
185>Create the video surface in video memory</TD
186></TR
187><TR
188><TD
189ALIGN="LEFT"
190VALIGN="TOP"
191><TT
192CLASS="LITERAL"
193>SDL_ASYNCBLIT</TT
194></TD
195><TD
196ALIGN="LEFT"
197VALIGN="TOP"
198>Enables the use of asynchronous updates of the display surface. This will
199usually slow down blitting on single CPU machines, but may provide a speed
200increase on SMP systems.</TD
201></TR
202><TR
203><TD
204ALIGN="LEFT"
205VALIGN="TOP"
206><TT
207CLASS="LITERAL"
208>SDL_ANYFORMAT</TT
209></TD
210><TD
211ALIGN="LEFT"
212VALIGN="TOP"
213>Normally, if a video surface of the requested bits-per-pixel (<TT
214CLASS="PARAMETER"
215><I
216>bpp</I
217></TT
218>) is not available, SDL will emulate one with a shadow surface. Passing <TT
219CLASS="LITERAL"
220>SDL_ANYFORMAT</TT
221> prevents this and causes SDL to use the video surface, regardless of its pixel depth.</TD
222></TR
223><TR
224><TD
225ALIGN="LEFT"
226VALIGN="TOP"
227><TT
228CLASS="LITERAL"
229>SDL_HWPALETTE</TT
230></TD
231><TD
232ALIGN="LEFT"
233VALIGN="TOP"
234>Give SDL exclusive palette access. Without this flag you may not always get the the colors you request with <A
235HREF="sdlsetcolors.html"
236><TT
237CLASS="FUNCTION"
238>SDL_SetColors</TT
239></A
240> or <A
241HREF="sdlsetpalette.html"
242><TT
243CLASS="FUNCTION"
244>SDL_SetPalette</TT
245></A
246>.</TD
247></TR
248><TR
249><TD
250ALIGN="LEFT"
251VALIGN="TOP"
252><TT
253CLASS="LITERAL"
254>SDL_DOUBLEBUF</TT
255></TD
256><TD
257ALIGN="LEFT"
258VALIGN="TOP"
259>Enable hardware double buffering; only valid with SDL_HWSURFACE. Calling
260<A
261HREF="sdlflip.html"
262><TT
263CLASS="FUNCTION"
264>SDL_Flip</TT
265></A
266> will flip the
267buffers and update the screen. All drawing will take place on the surface
268that is not displayed at the moment. If double buffering could not be enabled
269then <TT
270CLASS="FUNCTION"
271>SDL_Flip</TT
272> will just perform a
273<A
274HREF="sdlupdaterect.html"
275><TT
276CLASS="FUNCTION"
277>SDL_UpdateRect</TT
278></A
279>
280on the entire screen.</TD
281></TR
282><TR
283><TD
284ALIGN="LEFT"
285VALIGN="TOP"
286><TT
287CLASS="LITERAL"
288>SDL_FULLSCREEN</TT
289></TD
290><TD
291ALIGN="LEFT"
292VALIGN="TOP"
293>SDL will attempt to use a fullscreen mode. If a hardware resolution change is
294not possible (for whatever reason), the next higher resolution will be used and
295the display window centered on a black background.</TD
296></TR
297><TR
298><TD
299ALIGN="LEFT"
300VALIGN="TOP"
301><TT
302CLASS="LITERAL"
303>SDL_OPENGL</TT
304></TD
305><TD
306ALIGN="LEFT"
307VALIGN="TOP"
308>Create an OpenGL rendering context. You should have previously set OpenGL video attributes with <A
309HREF="sdlglsetattribute.html"
310><TT
311CLASS="FUNCTION"
312>SDL_GL_SetAttribute</TT
313></A
314>.</TD
315></TR
316><TR
317><TD
318ALIGN="LEFT"
319VALIGN="TOP"
320><TT
321CLASS="LITERAL"
322>SDL_OPENGLBLIT</TT
323></TD
324><TD
325ALIGN="LEFT"
326VALIGN="TOP"
327>Create an OpenGL rendering context, like above, but allow normal blitting
328operations. The screen (2D) surface may have an alpha channel, and
329<A
330HREF="sdlupdaterects.html"
331><TT
332CLASS="FUNCTION"
333>SDL_UpdateRects</TT
334></A
335>
336must be used for updating changes to the screen surface. NOTE: This option
337is kept for compatibility only, and is <SPAN
338CLASS="emphasis"
339><I
340CLASS="EMPHASIS"
341>not</I
342></SPAN
343> recommended for
344new code.</TD
345></TR
346><TR
347><TD
348ALIGN="LEFT"
349VALIGN="TOP"
350><TT
351CLASS="LITERAL"
352>SDL_RESIZABLE</TT
353></TD
354><TD
355ALIGN="LEFT"
356VALIGN="TOP"
357>Create a resizable window. When the window is resized by the user a <A
358HREF="sdlresizeevent.html"
359><TT
360CLASS="LITERAL"
361>SDL_VIDEORESIZE</TT
362></A
363> event is generated and <TT
364CLASS="FUNCTION"
365>SDL_SetVideoMode</TT
366> can be called again with the new size.</TD
367></TR
368><TR
369><TD
370ALIGN="LEFT"
371VALIGN="TOP"
372><TT
373CLASS="LITERAL"
374>SDL_NOFRAME</TT
375></TD
376><TD
377ALIGN="LEFT"
378VALIGN="TOP"
379>If possible, <TT
380CLASS="LITERAL"
381>SDL_NOFRAME</TT
382> causes SDL to create a window with no title bar or frame decoration. Fullscreen modes automatically have this flag set.</TD
383></TR
384></TBODY
385></TABLE
386><P
387></P
388></DIV
389><DIV
390CLASS="NOTE"
391><BLOCKQUOTE
392CLASS="NOTE"
393><P
394><B
395>Note: </B
396>Whatever <TT
397CLASS="PARAMETER"
398><I
399>flags</I
400></TT
401> <TT
402CLASS="FUNCTION"
403>SDL_SetVideoMode</TT
404> could satisfy are set in the <TT
405CLASS="STRUCTFIELD"
406><I
407>flags</I
408></TT
409> member of the returned surface.</P
410></BLOCKQUOTE
411></DIV
412><DIV
413CLASS="NOTE"
414><BLOCKQUOTE
415CLASS="NOTE"
416><P
417><B
418>Note: </B
419>The <TT
420CLASS="PARAMETER"
421><I
422>bpp</I
423></TT
424> parameter is the number of bits per pixel,
425so a <TT
426CLASS="PARAMETER"
427><I
428>bpp</I
429></TT
430> of 24 uses the packed representation of
4313 bytes/pixel. For the more common 4 bytes/pixel mode, use a
432<TT
433CLASS="PARAMETER"
434><I
435>bpp</I
436></TT
437> of 32. Somewhat oddly, both 15 and 16 will
438request a 2 bytes/pixel mode, but different pixel formats.</P
439></BLOCKQUOTE
440></DIV
441></DIV
442><DIV
443CLASS="REFSECT1"
444><A
445NAME="AEN1336"
446></A
447><H2
448>Return Value</H2
449><P
450>The framebuffer surface, or <SPAN
451CLASS="RETURNVALUE"
452>NULL</SPAN
453> if it fails.
454The surface returned is freed by SDL_Quit() and should nt be freed by
455the caller.</P
456></DIV
457><DIV
458CLASS="REFSECT1"
459><A
460NAME="AEN1340"
461></A
462><H2
463>See Also</H2
464><P
465><A
466HREF="sdllocksurface.html"
467><TT
468CLASS="FUNCTION"
469>SDL_LockSurface</TT
470></A
471>,
472<A
473HREF="sdlsetcolors.html"
474><TT
475CLASS="FUNCTION"
476>SDL_SetColors</TT
477></A
478>,
479<A
480HREF="sdlflip.html"
481><TT
482CLASS="FUNCTION"
483>SDL_Flip</TT
484></A
485>,
486<A
487HREF="sdlsurface.html"
488><SPAN
489CLASS="STRUCTNAME"
490>SDL_Surface</SPAN
491></A
492></P
493></DIV
494><DIV
495CLASS="NAVFOOTER"
496><HR
497ALIGN="LEFT"
498WIDTH="100%"><TABLE
499SUMMARY="Footer navigation table"
500WIDTH="100%"
501BORDER="0"
502CELLPADDING="0"
503CELLSPACING="0"
504><TR
505><TD
506WIDTH="33%"
507ALIGN="left"
508VALIGN="top"
509><A
510HREF="sdlvideomodeok.html"
511ACCESSKEY="P"
512>Prev</A
513></TD
514><TD
515WIDTH="34%"
516ALIGN="center"
517VALIGN="top"
518><A
519HREF="index.html"
520ACCESSKEY="H"
521>Home</A
522></TD
523><TD
524WIDTH="33%"
525ALIGN="right"
526VALIGN="top"
527><A
528HREF="sdlupdaterect.html"
529ACCESSKEY="N"
530>Next</A
531></TD
532></TR
533><TR
534><TD
535WIDTH="33%"
536ALIGN="left"
537VALIGN="top"
538>SDL_VideoModeOK</TD
539><TD
540WIDTH="34%"
541ALIGN="center"
542VALIGN="top"
543><A
544HREF="video.html"
545ACCESSKEY="U"
546>Up</A
547></TD
548><TD
549WIDTH="33%"
550ALIGN="right"
551VALIGN="top"
552>SDL_UpdateRect</TD
553></TR
554></TABLE
555></DIV
556></BODY
557></HTML
558>