Mercurial > sdl-ios-xcode
annotate docs/html/sdlpalette.html @ 4167:a6f635e5eaa6 SDL-1.2
Fixed bug #611
From Tim Angus 2008-08-12 11:18:06
I'm one of the maintainers of ioquake3.org, an updated version of the
Quake 3 engine. Relatively recently, we moved ioq3 to use SDL as a
replacement for 95% of the platform specific code that was there. On the
whole it's doing a great job but unfortunately since the move we've been
getting complaints about the quality of the mouse input on the Windows
platform to the point where for many the game is unplayable. Put in
other terms, the current stable SDL 1.2 is basically not fit for purpose
if you need high quality mouse input as you do in a first person shooter.
Over the weekend I decided to pull my finger out and actually figure out
what's going on. There are basically two major problems. Firstly, when
using the "windib" driver, mouse input is gathered via the WM_MOUSEMOVE
message. Googling for this indicates that often this is known to result
in "spurious" and/or "missing" mouse movement events; this is the
primary cause of the poor mouse input. The second problem is that the
"directx" driver does not work at all in combination with OpenGL meaning
that you can't use DirectInput if your application also uses OpenGL. In
other words you're locked into using the "windib" driver and its poor
mouse input.
In order to address these problems I've done the following:
* Remove WM_MOUSEMOVE based motion event generation and replace with
calls to GetCursorPos which seems much more reliable. In order to
achieve this I've moved mouse motion out into a separate function that
is called once per DIB_PumpEvents.
* Remove the restriction on the "directx" driver being inoperable in
combination with OpenGL. There is a bug for this issues that I've
hijacked to a certain extent
(http://bugzilla.libsdl.org/show_bug.cgi?id=265). I'm the first to admit
I don't really understand why this restriction is there in the first
place. The commit message for the bug fix that introduced this
restriction (r581) isn't very elaborate and I couldn't see any other bug
tracking the issue. If anyone has more information on the bug that was
avoided by r581 it would be helpful as I/someone could then look into
addressing the problem without disabling the "directx" driver.
* I've also removed the restriction on not being allowed to use
DirectInput in windowed mode. I couldn't see any reason for this, at
least not from our perspective. I have my suspicions that it'll be
something like matching up the cursor with the mouse coordinates...
* I bumped up the DirectInput API used to version 7 in order to get
access to mouse buttons 4-7. I've had to inject a little bit of the DX7
headers into SDL there as the MinGW ones aren't up to date in this respect.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 02 Apr 2009 04:43:36 +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 > |