Mercurial > sdl-ios-xcode
annotate docs/html/sdllistmodes.html @ 172:37e3ca9254c7
Date: Sat, 8 Sep 2001 04:42:23 +0200
From: Max Horn <max@quendi.de>
Subject: SDL/OSX: Joystick; Better key handling
I just finished implementing improved keyhandling for OS X (in fact
the code should be easily ported to the "normal" MacOS part of SDL, I
just had no chance yet). Works like this:
First init the mapping table statically like before. Them, it queries
the OS for the "official" key table, then iterates over all 127
scancode and gets the associates ascii code. It ignores everythng
below 32 (has to, as it would lead to many problems if we did not...
e.g. both ESC and NUM LOCk produce an ascii code 27 on my keyboard),
and all stuff above 127 is mapped to SDLK_WORLD_* simply in the order
it is encountered.
In addition, caps lock is now working, too.
The code work flawless for me, but since I only have one keyboard, I
may have not encountered some serious problem... but I am pretty
confident that it is better than the old code in most cases.
The joystick driver works fine for me, too. I think it can be added
to CVS already. It would simply be helpful if more people would test
it. Hm, I wonder if Maelstrom or GLTron has Joystick support? That
would be a wonderful test application :)
I also took the liberty of modifying some text files like BUGS,
README.CVS, README.MacOSX (which now contains the OS X docs I long
promised)
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 11 Sep 2001 19:00:18 +0000 |
parents | 55f1f1b3e27d |
children | e5bc29de3f0a |
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 | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
76 NAME="AEN754" |
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 | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
85 NAME="AEN757" |
0 | 86 ></A |
87 ><H2 | |
88 >Synopsis</H2 | |
89 ><DIV | |
90 CLASS="FUNCSYNOPSIS" | |
91 ><A | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
92 NAME="AEN758" |
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 | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
116 NAME="AEN764" |
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 | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
172 NAME="AEN779" |
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 | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
209 NAME="AEN782" |
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 > |