Mercurial > sdl-ios-xcode
annotate docs/html/sdlpalette.html @ 937:1e6366bde299
Date: Tue, 27 Jul 2004 17:14:00 +0200
From: "Eckhard Stolberg"
Subject: Controller names in SDL for Windows
I'm working on an Atari 2600 emulator for different systems that uses
the SDL. Some time ago someone created an adaptor that lets you use
your old Atari controllers with your computer through the USB port.
Some of the Atari controllers require special handling by the emulator,
so it would be nice, if it would be possible to detect if any of the
controllers connected to the computer is this adaptor.
SDL would allow that with the SDL_JoystickName function, but unfortunately
it doesn't work properly on Windows. On Linux and MacOSX this function
returns the name of the controller, but on Windows you'll only get the
name of the joystick driver. Most joysticks nowadays use the generic
Microsoft driver, so they all return the same name.
In an old MSDN article
(http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnarinput/html/msdn_extdirect.asp)
Microsoft describes how to read out the OEM controller names from the registry.
I have implemented this for the SDL controller handler on Windows,
and now reading the joystick name works properly there too.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 21 Aug 2004 03:45:58 +0000 |
parents | 355632dca928 |
children |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_Palette</TITLE | |
5 ><META | |
6 NAME="GENERATOR" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ |
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_Color" | |
17 HREF="sdlcolor.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_PixelFormat" | |
20 HREF="sdlpixelformat.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 | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
31 SUMMARY="Header navigation table" |
0 | 32 WIDTH="100%" |
33 BORDER="0" | |
34 CELLPADDING="0" | |
35 CELLSPACING="0" | |
36 ><TR | |
37 ><TH | |
38 COLSPAN="3" | |
39 ALIGN="center" | |
40 >SDL Library Documentation</TH | |
41 ></TR | |
42 ><TR | |
43 ><TD | |
44 WIDTH="10%" | |
45 ALIGN="left" | |
46 VALIGN="bottom" | |
47 ><A | |
48 HREF="sdlcolor.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
49 ACCESSKEY="P" |
0 | 50 >Prev</A |
51 ></TD | |
52 ><TD | |
53 WIDTH="80%" | |
54 ALIGN="center" | |
55 VALIGN="bottom" | |
56 ></TD | |
57 ><TD | |
58 WIDTH="10%" | |
59 ALIGN="right" | |
60 VALIGN="bottom" | |
61 ><A | |
62 HREF="sdlpixelformat.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
63 ACCESSKEY="N" |
0 | 64 >Next</A |
65 ></TD | |
66 ></TR | |
67 ></TABLE | |
68 ><HR | |
69 ALIGN="LEFT" | |
70 WIDTH="100%"></DIV | |
71 ><H1 | |
72 ><A | |
73 NAME="SDLPALETTE" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
74 ></A |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
75 >SDL_Palette</H1 |
0 | 76 ><DIV |
77 CLASS="REFNAMEDIV" | |
78 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
79 NAME="AEN3129" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_Palette -- Color palette for 8-bit pixel formats</DIV | |
84 ><DIV | |
85 CLASS="REFSECT1" | |
86 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
87 NAME="AEN3132" |
0 | 88 ></A |
89 ><H2 | |
90 >Structure Definition</H2 | |
91 ><PRE | |
92 CLASS="PROGRAMLISTING" | |
93 >typedef struct{ | |
94 int ncolors; | |
95 SDL_Color *colors; | |
96 } SDL_Palette;</PRE | |
97 ></DIV | |
98 ><DIV | |
99 CLASS="REFSECT1" | |
100 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
101 NAME="AEN3135" |
0 | 102 ></A |
103 ><H2 | |
104 >Structure Data</H2 | |
105 ><DIV | |
106 CLASS="INFORMALTABLE" | |
107 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
108 NAME="AEN3137" |
0 | 109 ></A |
110 ><P | |
111 ></P | |
112 ><TABLE | |
113 BORDER="0" | |
114 CLASS="CALSTABLE" | |
115 ><TBODY | |
116 ><TR | |
117 ><TD | |
118 ALIGN="LEFT" | |
119 VALIGN="TOP" | |
120 ><TT | |
121 CLASS="STRUCTFIELD" | |
122 ><I | |
123 >ncolors</I | |
124 ></TT | |
125 ></TD | |
126 ><TD | |
127 ALIGN="LEFT" | |
128 VALIGN="TOP" | |
129 >Number of colors used in this palette</TD | |
130 ></TR | |
131 ><TR | |
132 ><TD | |
133 ALIGN="LEFT" | |
134 VALIGN="TOP" | |
135 ><TT | |
136 CLASS="STRUCTFIELD" | |
137 ><I | |
138 >colors</I | |
139 ></TT | |
140 ></TD | |
141 ><TD | |
142 ALIGN="LEFT" | |
143 VALIGN="TOP" | |
144 >Pointer to <A | |
145 HREF="sdlcolor.html" | |
146 ><SPAN | |
147 CLASS="STRUCTNAME" | |
148 >SDL_Color</SPAN | |
149 ></A | |
150 > structures that make up the palette.</TD | |
151 ></TR | |
152 ></TBODY | |
153 ></TABLE | |
154 ><P | |
155 ></P | |
156 ></DIV | |
157 ></DIV | |
158 ><DIV | |
159 CLASS="REFSECT1" | |
160 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
161 NAME="AEN3150" |
0 | 162 ></A |
163 ><H2 | |
164 >Description</H2 | |
165 ><P | |
166 >Each pixel in an 8-bit surface is an index into the <TT | |
167 CLASS="STRUCTFIELD" | |
168 ><I | |
169 >colors</I | |
170 ></TT | |
171 > field of the <SPAN | |
172 CLASS="STRUCTNAME" | |
173 >SDL_Palette</SPAN | |
174 > structure store in <A | |
175 HREF="sdlpixelformat.html" | |
176 ><SPAN | |
177 CLASS="STRUCTNAME" | |
178 >SDL_PixelFormat</SPAN | |
179 ></A | |
180 >. A <SPAN | |
181 CLASS="STRUCTNAME" | |
182 >SDL_Palette</SPAN | |
183 > should never need to be created manually. It is automatically created when SDL allocates a <SPAN | |
184 CLASS="STRUCTNAME" | |
185 >SDL_PixelFormat</SPAN | |
186 > for a surface. The colors values of a <A | |
187 HREF="sdlsurface.html" | |
188 ><SPAN | |
189 CLASS="STRUCTNAME" | |
190 >SDL_Surface</SPAN | |
191 ></A | |
192 >s palette can be set with the <A | |
193 HREF="sdlsetcolors.html" | |
194 ><TT | |
195 CLASS="FUNCTION" | |
196 >SDL_SetColors</TT | |
197 ></A | |
198 >.</P | |
199 ></DIV | |
200 ><DIV | |
201 CLASS="REFSECT1" | |
202 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
203 NAME="AEN3163" |
0 | 204 ></A |
205 ><H2 | |
206 >See Also</H2 | |
207 ><P | |
208 ><A | |
209 HREF="sdlcolor.html" | |
210 ><SPAN | |
211 CLASS="STRUCTNAME" | |
212 >SDL_Color</SPAN | |
213 ></A | |
214 >, | |
215 <A | |
216 HREF="sdlsurface.html" | |
217 ><SPAN | |
218 CLASS="STRUCTNAME" | |
219 >SDL_Surface</SPAN | |
220 ></A | |
221 >, | |
222 <A | |
223 HREF="sdlsetcolors.html" | |
224 ><TT | |
225 CLASS="FUNCTION" | |
226 >SDL_SetColors</TT | |
227 ></A | |
228 > | |
229 <A | |
230 HREF="sdlsetpalette.html" | |
231 ><TT | |
232 CLASS="FUNCTION" | |
233 >SDL_SetPalette</TT | |
234 ></A | |
235 ></P | |
236 ></DIV | |
237 ><DIV | |
238 CLASS="NAVFOOTER" | |
239 ><HR | |
240 ALIGN="LEFT" | |
241 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
242 SUMMARY="Footer navigation table" |
0 | 243 WIDTH="100%" |
244 BORDER="0" | |
245 CELLPADDING="0" | |
246 CELLSPACING="0" | |
247 ><TR | |
248 ><TD | |
249 WIDTH="33%" | |
250 ALIGN="left" | |
251 VALIGN="top" | |
252 ><A | |
253 HREF="sdlcolor.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
254 ACCESSKEY="P" |
0 | 255 >Prev</A |
256 ></TD | |
257 ><TD | |
258 WIDTH="34%" | |
259 ALIGN="center" | |
260 VALIGN="top" | |
261 ><A | |
262 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
263 ACCESSKEY="H" |
0 | 264 >Home</A |
265 ></TD | |
266 ><TD | |
267 WIDTH="33%" | |
268 ALIGN="right" | |
269 VALIGN="top" | |
270 ><A | |
271 HREF="sdlpixelformat.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
272 ACCESSKEY="N" |
0 | 273 >Next</A |
274 ></TD | |
275 ></TR | |
276 ><TR | |
277 ><TD | |
278 WIDTH="33%" | |
279 ALIGN="left" | |
280 VALIGN="top" | |
281 >SDL_Color</TD | |
282 ><TD | |
283 WIDTH="34%" | |
284 ALIGN="center" | |
285 VALIGN="top" | |
286 ><A | |
287 HREF="video.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
288 ACCESSKEY="U" |
0 | 289 >Up</A |
290 ></TD | |
291 ><TD | |
292 WIDTH="33%" | |
293 ALIGN="right" | |
294 VALIGN="top" | |
295 >SDL_PixelFormat</TD | |
296 ></TR | |
297 ></TABLE | |
298 ></DIV | |
299 ></BODY | |
300 ></HTML | |
301 > |