Mercurial > sdl-ios-xcode
annotate docs/html/sdllistmodes.html @ 641:df178851293b
Date: 28 Jun 2003 22:42:52 +0100
From: Alan Swanson
Subject: Re: [SDL] New XFree 4.3 Video Mode Patch
I have a wee amendment that moves the qsort in set_best_resolution
to only occur after failing to find an exact match only. This would
make absolutely sure we get a user set mode.
While I've never had any problems for my normal resolutions (1280x1024,
1024x768, 800x600 & 640,480) while closely examining the output from
qsort I've noticed it doesn't seem to sort the modes fully. These is
one definite wrong at 1152x768 and a few that just look wrong to me.
From a program (attached) I made to examine this more easily. X has
sorted its mode list using the same method as ours (plus frequency),
and our user modes get inserted without any other movement.
On the patch I've made I've also changed cmpmodes to sort on vertical
resolution and then horizontal. Ie vertical is now most significant
bit.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 28 Jun 2003 21:52:26 +0000 |
parents | e5bc29de3f0a |
children | 355632dca928 |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_ListModes</TITLE | |
5 ><META | |
6 NAME="GENERATOR" | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.64 |
0 | 8 "><LINK |
9 REL="HOME" | |
10 TITLE="SDL Library Documentation" | |
11 HREF="index.html"><LINK | |
12 REL="UP" | |
13 TITLE="Video" | |
14 HREF="video.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_VideoDriverName" | |
17 HREF="sdlvideodrivername.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_VideoModeOK" | |
20 HREF="sdlvideomodeok.html"></HEAD | |
21 ><BODY | |
22 CLASS="REFENTRY" | |
23 BGCOLOR="#FFF8DC" | |
24 TEXT="#000000" | |
25 LINK="#0000ee" | |
26 VLINK="#551a8b" | |
27 ALINK="#ff0000" | |
28 ><DIV | |
29 CLASS="NAVHEADER" | |
30 ><TABLE | |
31 WIDTH="100%" | |
32 BORDER="0" | |
33 CELLPADDING="0" | |
34 CELLSPACING="0" | |
35 ><TR | |
36 ><TH | |
37 COLSPAN="3" | |
38 ALIGN="center" | |
39 >SDL Library Documentation</TH | |
40 ></TR | |
41 ><TR | |
42 ><TD | |
43 WIDTH="10%" | |
44 ALIGN="left" | |
45 VALIGN="bottom" | |
46 ><A | |
47 HREF="sdlvideodrivername.html" | |
48 >Prev</A | |
49 ></TD | |
50 ><TD | |
51 WIDTH="80%" | |
52 ALIGN="center" | |
53 VALIGN="bottom" | |
54 ></TD | |
55 ><TD | |
56 WIDTH="10%" | |
57 ALIGN="right" | |
58 VALIGN="bottom" | |
59 ><A | |
60 HREF="sdlvideomodeok.html" | |
61 >Next</A | |
62 ></TD | |
63 ></TR | |
64 ></TABLE | |
65 ><HR | |
66 ALIGN="LEFT" | |
67 WIDTH="100%"></DIV | |
68 ><H1 | |
69 ><A | |
70 NAME="SDLLISTMODES" | |
71 >SDL_ListModes</A | |
72 ></H1 | |
73 ><DIV | |
74 CLASS="REFNAMEDIV" | |
75 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
76 NAME="AEN776" |
0 | 77 ></A |
78 ><H2 | |
79 >Name</H2 | |
80 >SDL_ListModes -- Returns a pointer to an array of available screen dimensions for | |
81 the given format and video flags</DIV | |
82 ><DIV | |
83 CLASS="REFSYNOPSISDIV" | |
84 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
85 NAME="AEN779" |
0 | 86 ></A |
87 ><H2 | |
88 >Synopsis</H2 | |
89 ><DIV | |
90 CLASS="FUNCSYNOPSIS" | |
91 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
92 NAME="AEN780" |
0 | 93 ></A |
94 ><P | |
95 ></P | |
96 ><PRE | |
97 CLASS="FUNCSYNOPSISINFO" | |
98 >#include "SDL.h"</PRE | |
99 ><P | |
100 ><CODE | |
101 ><CODE | |
102 CLASS="FUNCDEF" | |
103 >SDL_Rect **<B | |
104 CLASS="FSFUNC" | |
105 >SDL_ListModes</B | |
106 ></CODE | |
107 >(SDL_PixelFormat *format, Uint32 flags);</CODE | |
108 ></P | |
109 ><P | |
110 ></P | |
111 ></DIV | |
112 ></DIV | |
113 ><DIV | |
114 CLASS="REFSECT1" | |
115 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
116 NAME="AEN786" |
0 | 117 ></A |
118 ><H2 | |
119 >Description</H2 | |
120 ><P | |
121 >Return a pointer to an array of available screen dimensions for the given | |
122 format and video flags, sorted largest to smallest. Returns | |
123 <TT | |
124 CLASS="LITERAL" | |
125 >NULL</TT | |
126 > if there are no dimensions available for a particular | |
127 format, or <SPAN | |
128 CLASS="RETURNVALUE" | |
129 >-1</SPAN | |
130 > if any dimension is okay for | |
131 the given format.</P | |
132 ><P | |
133 >If <TT | |
134 CLASS="PARAMETER" | |
135 ><I | |
136 >format</I | |
137 ></TT | |
138 > is <TT | |
139 CLASS="LITERAL" | |
140 >NULL</TT | |
141 >, the mode list | |
142 will be for the format returned by <A | |
143 HREF="sdlgetvideoinfo.html" | |
144 >SDL_GetVideoInfo()</A | |
145 >-><TT | |
146 CLASS="STRUCTFIELD" | |
147 ><I | |
148 >vfmt</I | |
149 ></TT | |
150 >. The <TT | |
151 CLASS="PARAMETER" | |
152 ><I | |
153 >flag</I | |
154 ></TT | |
155 > parameter is an OR'd combination of <A | |
156 HREF="sdlsurface.html" | |
157 >surface</A | |
158 > flags. The flags are the same as those used <A | |
159 HREF="sdlsetvideomode.html" | |
160 ><TT | |
161 CLASS="FUNCTION" | |
162 >SDL_SetVideoMode</TT | |
163 ></A | |
164 > and they play a strong role in deciding what modes are valid. For instance, if you pass <TT | |
165 CLASS="LITERAL" | |
166 >SDL_HWSURFACE</TT | |
167 > as a flag only modes that support hardware video surfaces will be returned.</P | |
168 ></DIV | |
169 ><DIV | |
170 CLASS="REFSECT1" | |
171 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
172 NAME="AEN801" |
0 | 173 ></A |
174 ><H2 | |
175 >Example</H2 | |
176 ><PRE | |
177 CLASS="PROGRAMLISTING" | |
178 >SDL_Rect **modes; | |
179 int i; | |
180 . | |
181 . | |
182 . | |
183 | |
184 /* Get available fullscreen/hardware modes */ | |
185 modes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE); | |
186 | |
187 /* Check is there are any modes available */ | |
188 if(modes == (SDL_Rect **)0){ | |
189 printf("No modes available!\n"); | |
190 exit(-1); | |
191 } | |
192 | |
193 /* Check if or resolution is restricted */ | |
194 if(modes == (SDL_Rect **)-1){ | |
195 printf("All resolutions available.\n"); | |
196 } | |
197 else{ | |
198 /* Print valid modes */ | |
199 printf("Available Modes\n"); | |
200 for(i=0;modes[i];++i) | |
201 printf(" %d x %d\n", modes[i]->w, modes[i]->h); | |
202 } | |
203 . | |
204 .</PRE | |
205 ></DIV | |
206 ><DIV | |
207 CLASS="REFSECT1" | |
208 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
209 NAME="AEN804" |
0 | 210 ></A |
211 ><H2 | |
212 >See Also</H2 | |
213 ><P | |
214 ><A | |
215 HREF="sdlsetvideomode.html" | |
216 ><TT | |
217 CLASS="FUNCTION" | |
218 >SDL_SetVideoMode</TT | |
219 ></A | |
220 >, | |
221 <A | |
222 HREF="sdlgetvideoinfo.html" | |
223 ><TT | |
224 CLASS="FUNCTION" | |
225 >SDL_GetVideoInfo</TT | |
226 ></A | |
227 >, | |
228 <A | |
229 HREF="sdlrect.html" | |
230 ><SPAN | |
231 CLASS="STRUCTNAME" | |
232 >SDL_Rect</SPAN | |
233 ></A | |
234 >, | |
235 <A | |
236 HREF="sdlpixelformat.html" | |
237 ><SPAN | |
238 CLASS="STRUCTNAME" | |
239 >SDL_PixelFormat</SPAN | |
240 ></A | |
241 ></P | |
242 ></DIV | |
243 ><DIV | |
244 CLASS="NAVFOOTER" | |
245 ><HR | |
246 ALIGN="LEFT" | |
247 WIDTH="100%"><TABLE | |
248 WIDTH="100%" | |
249 BORDER="0" | |
250 CELLPADDING="0" | |
251 CELLSPACING="0" | |
252 ><TR | |
253 ><TD | |
254 WIDTH="33%" | |
255 ALIGN="left" | |
256 VALIGN="top" | |
257 ><A | |
258 HREF="sdlvideodrivername.html" | |
259 >Prev</A | |
260 ></TD | |
261 ><TD | |
262 WIDTH="34%" | |
263 ALIGN="center" | |
264 VALIGN="top" | |
265 ><A | |
266 HREF="index.html" | |
267 >Home</A | |
268 ></TD | |
269 ><TD | |
270 WIDTH="33%" | |
271 ALIGN="right" | |
272 VALIGN="top" | |
273 ><A | |
274 HREF="sdlvideomodeok.html" | |
275 >Next</A | |
276 ></TD | |
277 ></TR | |
278 ><TR | |
279 ><TD | |
280 WIDTH="33%" | |
281 ALIGN="left" | |
282 VALIGN="top" | |
283 >SDL_VideoDriverName</TD | |
284 ><TD | |
285 WIDTH="34%" | |
286 ALIGN="center" | |
287 VALIGN="top" | |
288 ><A | |
289 HREF="video.html" | |
290 >Up</A | |
291 ></TD | |
292 ><TD | |
293 WIDTH="33%" | |
294 ALIGN="right" | |
295 VALIGN="top" | |
296 >SDL_VideoModeOK</TD | |
297 ></TR | |
298 ></TABLE | |
299 ></DIV | |
300 ></BODY | |
301 ></HTML | |
302 > |