Mercurial > sdl-ios-xcode
annotate docs/html/sdlflip.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_Flip</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_UpdateRects" | |
17 HREF="sdlupdaterects.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_SetColors" | |
20 HREF="sdlsetcolors.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="sdlupdaterects.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="sdlsetcolors.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="SDLFLIP" | |
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_Flip</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="AEN1426" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_Flip -- Swaps screen buffers</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="AEN1429" |
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="AEN1430" |
0 | 95 ></A |
96 ><P | |
97 ></P | |
98 ><PRE | |
99 CLASS="FUNCSYNOPSISINFO" | |
100 >#include "SDL.h"</PRE | |
101 ><P | |
102 ><CODE | |
103 ><CODE | |
104 CLASS="FUNCDEF" | |
105 >int <B | |
106 CLASS="FSFUNC" | |
107 >SDL_Flip</B | |
108 ></CODE | |
109 >(SDL_Surface *screen);</CODE | |
110 ></P | |
111 ><P | |
112 ></P | |
113 ></DIV | |
114 ></DIV | |
115 ><DIV | |
116 CLASS="REFSECT1" | |
117 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
118 NAME="AEN1436" |
0 | 119 ></A |
120 ><H2 | |
121 >Description</H2 | |
122 ><P | |
123 >On hardware that supports double-buffering, this function sets up a flip | |
124 and returns. The hardware will wait for vertical retrace, and then swap | |
125 video buffers before the next video surface blit or lock will return. | |
126 On hardware that doesn't support double-buffering, this is equivalent | |
127 to calling <A | |
128 HREF="sdlupdaterect.html" | |
129 >SDL_UpdateRect</A | |
130 ><TT | |
131 CLASS="PARAMETER" | |
132 ><I | |
133 >(screen, 0, 0, 0, 0)</I | |
134 ></TT | |
135 ></P | |
136 ><P | |
137 >The <TT | |
138 CLASS="LITERAL" | |
139 >SDL_DOUBLEBUF</TT | |
140 > flag must have been passed to | |
141 <A | |
142 HREF="sdlsetvideomode.html" | |
143 >SDL_SetVideoMode</A | |
144 >, | |
145 when | |
146 setting the video mode for this function to perform hardware flipping.</P | |
147 ></DIV | |
148 ><DIV | |
149 CLASS="REFSECT1" | |
150 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
151 NAME="AEN1444" |
0 | 152 ></A |
153 ><H2 | |
154 >Return Value</H2 | |
155 ><P | |
156 >This function returns <SPAN | |
157 CLASS="RETURNVALUE" | |
158 >0</SPAN | |
159 > if successful, or | |
160 <SPAN | |
161 CLASS="RETURNVALUE" | |
162 >-1</SPAN | |
163 > if there was an error.</P | |
164 ></DIV | |
165 ><DIV | |
166 CLASS="REFSECT1" | |
167 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
168 NAME="AEN1449" |
0 | 169 ></A |
170 ><H2 | |
171 >See Also</H2 | |
172 ><P | |
173 ><A | |
174 HREF="sdlsetvideomode.html" | |
175 ><TT | |
176 CLASS="FUNCTION" | |
177 >SDL_SetVideoMode</TT | |
178 ></A | |
179 >, | |
180 <A | |
181 HREF="sdlupdaterect.html" | |
182 ><TT | |
183 CLASS="FUNCTION" | |
184 >SDL_UpdateRect</TT | |
185 ></A | |
186 >, | |
187 <A | |
188 HREF="sdlsurface.html" | |
189 ><SPAN | |
190 CLASS="STRUCTNAME" | |
191 >SDL_Surface</SPAN | |
192 ></A | |
193 ></P | |
194 ></DIV | |
195 ><DIV | |
196 CLASS="NAVFOOTER" | |
197 ><HR | |
198 ALIGN="LEFT" | |
199 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
200 SUMMARY="Footer navigation table" |
0 | 201 WIDTH="100%" |
202 BORDER="0" | |
203 CELLPADDING="0" | |
204 CELLSPACING="0" | |
205 ><TR | |
206 ><TD | |
207 WIDTH="33%" | |
208 ALIGN="left" | |
209 VALIGN="top" | |
210 ><A | |
211 HREF="sdlupdaterects.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
212 ACCESSKEY="P" |
0 | 213 >Prev</A |
214 ></TD | |
215 ><TD | |
216 WIDTH="34%" | |
217 ALIGN="center" | |
218 VALIGN="top" | |
219 ><A | |
220 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
221 ACCESSKEY="H" |
0 | 222 >Home</A |
223 ></TD | |
224 ><TD | |
225 WIDTH="33%" | |
226 ALIGN="right" | |
227 VALIGN="top" | |
228 ><A | |
229 HREF="sdlsetcolors.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
230 ACCESSKEY="N" |
0 | 231 >Next</A |
232 ></TD | |
233 ></TR | |
234 ><TR | |
235 ><TD | |
236 WIDTH="33%" | |
237 ALIGN="left" | |
238 VALIGN="top" | |
239 >SDL_UpdateRects</TD | |
240 ><TD | |
241 WIDTH="34%" | |
242 ALIGN="center" | |
243 VALIGN="top" | |
244 ><A | |
245 HREF="video.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
246 ACCESSKEY="U" |
0 | 247 >Up</A |
248 ></TD | |
249 ><TD | |
250 WIDTH="33%" | |
251 ALIGN="right" | |
252 VALIGN="top" | |
253 >SDL_SetColors</TD | |
254 ></TR | |
255 ></TABLE | |
256 ></DIV | |
257 ></BODY | |
258 ></HTML | |
259 > |