Mercurial > sdl-ios-xcode
annotate docs/html/sdlsempost.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_SemPost</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="Multi-threaded Programming" | |
14 HREF="thread.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_SemWaitTimeout" | |
17 HREF="sdlsemwaittimeout.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_SemValue" | |
20 HREF="sdlsemvalue.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="sdlsemwaittimeout.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="sdlsemvalue.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="SDLSEMPOST" | |
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_SemPost</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="AEN8170" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_SemPost -- Unlock a semaphore.</DIV | |
84 ><DIV | |
85 CLASS="REFSYNOPSISDIV" | |
86 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
87 NAME="AEN8173" |
0 | 88 ></A |
89 ><H2 | |
90 >Synopsis</H2 | |
91 ><DIV | |
92 CLASS="FUNCSYNOPSIS" | |
93 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
94 NAME="AEN8174" |
0 | 95 ></A |
96 ><P | |
97 ></P | |
98 ><PRE | |
99 CLASS="FUNCSYNOPSISINFO" | |
100 >#include "SDL.h" | |
101 #include "SDL_thread.h"</PRE | |
102 ><P | |
103 ><CODE | |
104 ><CODE | |
105 CLASS="FUNCDEF" | |
106 >int <B | |
107 CLASS="FSFUNC" | |
108 >SDL_SemPost</B | |
109 ></CODE | |
110 >(SDL_sem *sem);</CODE | |
111 ></P | |
112 ><P | |
113 ></P | |
114 ></DIV | |
115 ></DIV | |
116 ><DIV | |
117 CLASS="REFSECT1" | |
118 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
119 NAME="AEN8180" |
0 | 120 ></A |
121 ><H2 | |
122 >Description</H2 | |
123 ><P | |
124 ><TT | |
125 CLASS="FUNCTION" | |
126 >SDL_SemPost</TT | |
127 > unlocks the semaphore pointed to by | |
128 <TT | |
129 CLASS="PARAMETER" | |
130 ><I | |
131 >sem</I | |
132 ></TT | |
133 > and atomically increments the semaphores value. | |
134 Threads that were blocking on the semaphore may be scheduled after this call | |
135 succeeds.</P | |
136 ><P | |
137 ><TT | |
138 CLASS="FUNCTION" | |
139 >SDL_SemPost</TT | |
140 > should be called after a semaphore is locked by a successful call to | |
141 <A | |
142 HREF="sdlsemwait.html" | |
143 >SDL_SemWait</A | |
144 >, | |
145 <A | |
146 HREF="sdlsemtrywait.html" | |
147 >SDL_SemTryWait</A | |
148 > or | |
149 <A | |
150 HREF="sdlsemwaittimeout.html" | |
151 >SDL_SemWaitTimeout</A | |
152 >.</P | |
153 ></DIV | |
154 ><DIV | |
155 CLASS="REFSECT1" | |
156 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
157 NAME="AEN8190" |
0 | 158 ></A |
159 ><H2 | |
160 >Return Value</H2 | |
161 ><P | |
162 >Returns <SPAN | |
163 CLASS="RETURNVALUE" | |
164 >0</SPAN | |
165 > if successful or | |
166 <SPAN | |
167 CLASS="RETURNVALUE" | |
168 >-1</SPAN | |
169 > if there was an error (leaving the semaphore unchanged).</P | |
170 ></DIV | |
171 ><DIV | |
172 CLASS="REFSECT1" | |
173 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
174 NAME="AEN8195" |
0 | 175 ></A |
176 ><H2 | |
177 >Examples</H2 | |
178 ><P | |
179 ><PRE | |
180 CLASS="PROGRAMLISTING" | |
181 >SDL_SemPost(my_sem);</PRE | |
182 ></P | |
183 ></DIV | |
184 ><DIV | |
185 CLASS="REFSECT1" | |
186 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
187 NAME="AEN8199" |
0 | 188 ></A |
189 ><H2 | |
190 >See Also</H2 | |
191 ><P | |
192 ><A | |
193 HREF="sdlcreatesemaphore.html" | |
194 ><TT | |
195 CLASS="FUNCTION" | |
196 >SDL_CreateSemaphore</TT | |
197 ></A | |
198 >, | |
199 <A | |
200 HREF="sdldestroysemaphore.html" | |
201 ><TT | |
202 CLASS="FUNCTION" | |
203 >SDL_DestroySemaphore</TT | |
204 ></A | |
205 >, | |
206 <A | |
207 HREF="sdlsemwait.html" | |
208 ><TT | |
209 CLASS="FUNCTION" | |
210 >SDL_SemWait</TT | |
211 ></A | |
212 >, | |
213 <A | |
214 HREF="sdlsemtrywait.html" | |
215 ><TT | |
216 CLASS="FUNCTION" | |
217 >SDL_SemTryWait</TT | |
218 ></A | |
219 >, | |
220 <A | |
221 HREF="sdlsemwaittimeout.html" | |
222 ><TT | |
223 CLASS="FUNCTION" | |
224 >SDL_SemWaitTimeout</TT | |
225 ></A | |
226 >, | |
227 <A | |
228 HREF="sdlsemvalue.html" | |
229 ><TT | |
230 CLASS="FUNCTION" | |
231 >SDL_SemValue</TT | |
232 ></A | |
233 ></P | |
234 ></DIV | |
235 ><DIV | |
236 CLASS="NAVFOOTER" | |
237 ><HR | |
238 ALIGN="LEFT" | |
239 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
240 SUMMARY="Footer navigation table" |
0 | 241 WIDTH="100%" |
242 BORDER="0" | |
243 CELLPADDING="0" | |
244 CELLSPACING="0" | |
245 ><TR | |
246 ><TD | |
247 WIDTH="33%" | |
248 ALIGN="left" | |
249 VALIGN="top" | |
250 ><A | |
251 HREF="sdlsemwaittimeout.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
252 ACCESSKEY="P" |
0 | 253 >Prev</A |
254 ></TD | |
255 ><TD | |
256 WIDTH="34%" | |
257 ALIGN="center" | |
258 VALIGN="top" | |
259 ><A | |
260 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
261 ACCESSKEY="H" |
0 | 262 >Home</A |
263 ></TD | |
264 ><TD | |
265 WIDTH="33%" | |
266 ALIGN="right" | |
267 VALIGN="top" | |
268 ><A | |
269 HREF="sdlsemvalue.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
270 ACCESSKEY="N" |
0 | 271 >Next</A |
272 ></TD | |
273 ></TR | |
274 ><TR | |
275 ><TD | |
276 WIDTH="33%" | |
277 ALIGN="left" | |
278 VALIGN="top" | |
279 >SDL_SemWaitTimeout</TD | |
280 ><TD | |
281 WIDTH="34%" | |
282 ALIGN="center" | |
283 VALIGN="top" | |
284 ><A | |
285 HREF="thread.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
286 ACCESSKEY="U" |
0 | 287 >Up</A |
288 ></TD | |
289 ><TD | |
290 WIDTH="33%" | |
291 ALIGN="right" | |
292 VALIGN="top" | |
293 >SDL_SemValue</TD | |
294 ></TR | |
295 ></TABLE | |
296 ></DIV | |
297 ></BODY | |
298 ></HTML | |
299 > |