Mercurial > sdl-ios-xcode
annotate docs/html/sdlblitsurface.html @ 1282:217f5d5a49e5
Date: Sat, 15 Jan 2005 02:01:51 +0000 (UTC)
From: jimrandomh
Subject: [SDL] Re: Modifier keys pressed during initialization stick
I wrote a simple test program which initializes SDL, prints the SDL
version number, then prints any keydown and keyup events with their
modifiers. (Source code below). Compilation was done using Visual
Studio 6, release mode.
My test sequence was:
Start a command prompt. Type the name of the test program.
shift down
enter down (program starts)
Wait for window to appear
enter up
shift up
spacebar down
spacebar up
Under Windows 98, the output was correct:
SDL 1.2.8
left shift down
shift-return down
shift-return up
left shift up
space down
space up
Under Windows 2000 and under Windows XP, the output was:
SDL 1.2.8
shift-space down
shift-space up
Since shift was not held at the time space was pressed, this is
incorrect. Similar results were observed with launching in different
ways (including double-clicking in Windows Explorer), so it does not
depend on the launching terminal.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 29 Jan 2006 07:57:13 +0000 |
parents | 355632dca928 |
children |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_BlitSurface</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_ConvertSurface" | |
17 HREF="sdlconvertsurface.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_FillRect" | |
20 HREF="sdlfillrect.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="sdlconvertsurface.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="sdlfillrect.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="SDLBLITSURFACE" | |
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_BlitSurface</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="AEN2299" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_BlitSurface -- This performs a fast blit from the source surface to the destination surface.</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="AEN2302" |
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="AEN2303" |
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_BlitSurface</B | |
108 ></CODE | |
109 >(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect);</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="AEN2309" |
0 | 119 ></A |
120 ><H2 | |
121 >Description</H2 | |
122 ><P | |
123 >This performs a fast blit from the source surface to the destination surface.</P | |
124 ><P | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
125 >The width and height in <TT |
0 | 126 CLASS="PARAMETER" |
127 ><I | |
128 >srcrect</I | |
129 ></TT | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
130 > determine the |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
131 size of the copied rectangle. Only the position is used in the |
0 | 132 <TT |
133 CLASS="PARAMETER" | |
134 ><I | |
135 >dstrect</I | |
136 ></TT | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
137 > (the width and height are ignored).</P |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
138 ><P |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
139 >If <TT |
0 | 140 CLASS="PARAMETER" |
141 ><I | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
142 >srcrect</I |
0 | 143 ></TT |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
144 > is <TT |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
145 CLASS="LITERAL" |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
146 >NULL</TT |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
147 >, the |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
148 entire surface is copied. If <TT |
0 | 149 CLASS="PARAMETER" |
150 ><I | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
151 >dstrect</I |
0 | 152 ></TT |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
153 > is |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
154 <TT |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
155 CLASS="LITERAL" |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
156 >NULL</TT |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
157 >, then the destination position (upper left |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
158 corner) is (0, 0).</P |
0 | 159 ><P |
160 >The final blit rectangle is saved in | |
161 <TT | |
162 CLASS="PARAMETER" | |
163 ><I | |
164 >dstrect</I | |
165 ></TT | |
166 > after all clipping is performed | |
167 (<TT | |
168 CLASS="PARAMETER" | |
169 ><I | |
170 >srcrect</I | |
171 ></TT | |
172 > is not modified).</P | |
173 ><P | |
174 >The blit function should not be called on a locked surface.</P | |
175 ><P | |
176 >The results of blitting operations vary greatly depending on whether <TT | |
177 CLASS="LITERAL" | |
178 >SDL_SRCAPLHA</TT | |
179 > is set or not. See <A | |
180 HREF="sdlsetalpha.html" | |
181 >SDL_SetAlpha</A | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
182 > for an explaination of how this affects your results. Colorkeying and alpha attributes also interact with surface blitting, as the following pseudo-code should hopefully explain. |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
183 <PRE |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
184 CLASS="PROGRAMLISTING" |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
185 >if (source surface has SDL_SRCALPHA set) { |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
186 if (source surface has alpha channel (that is, format->Amask != 0)) |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
187 blit using per-pixel alpha, ignoring any colour key |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
188 else { |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
189 if (source surface has SDL_SRCCOLORKEY set) |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
190 blit using the colour key AND the per-surface alpha value |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
191 else |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
192 blit using the per-surface alpha value |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
193 } |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
194 } else { |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
195 if (source surface has SDL_SRCCOLORKEY set) |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
196 blit using the colour key |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
197 else |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
198 ordinary opaque rectangular blit |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
199 }</PRE |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
200 ></P |
0 | 201 ></DIV |
202 ><DIV | |
203 CLASS="REFSECT1" | |
204 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
205 NAME="AEN2328" |
0 | 206 ></A |
207 ><H2 | |
208 >Return Value</H2 | |
209 ><P | |
210 >If the blit is successful, it returns <SPAN | |
211 CLASS="RETURNVALUE" | |
212 >0</SPAN | |
213 >, | |
214 otherwise it returns <SPAN | |
215 CLASS="RETURNVALUE" | |
216 >-1</SPAN | |
217 >.</P | |
218 ><P | |
219 >If either of the surfaces were in video memory, and the blit returns | |
220 <SPAN | |
221 CLASS="RETURNVALUE" | |
222 >-2</SPAN | |
223 >, the video memory was lost, so it should be | |
224 reloaded with artwork and re-blitted: | |
225 <PRE | |
226 CLASS="PROGRAMLISTING" | |
227 > while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) { | |
228 while ( SDL_LockSurface(image)) < 0 ) | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
229 SDL_Delay(10); |
0 | 230 -- Write image pixels to image->pixels -- |
231 SDL_UnlockSurface(image); | |
232 }</PRE | |
233 > | |
234 This happens under DirectX 5.0 when the system switches away from your | |
235 fullscreen application. Locking the surface will also fail until you | |
236 have access to the video memory again.</P | |
237 ></DIV | |
238 ><DIV | |
239 CLASS="REFSECT1" | |
240 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
241 NAME="AEN2336" |
0 | 242 ></A |
243 ><H2 | |
244 >See Also</H2 | |
245 ><P | |
246 ><A | |
247 HREF="sdllocksurface.html" | |
248 ><TT | |
249 CLASS="FUNCTION" | |
250 >SDL_LockSurface</TT | |
251 ></A | |
252 >, | |
253 <A | |
254 HREF="sdlfillrect.html" | |
255 ><TT | |
256 CLASS="FUNCTION" | |
257 >SDL_FillRect</TT | |
258 ></A | |
259 >, | |
260 <A | |
261 HREF="sdlsurface.html" | |
262 ><SPAN | |
263 CLASS="STRUCTNAME" | |
264 >SDL_Surface</SPAN | |
265 ></A | |
266 >, | |
267 <A | |
268 HREF="sdlrect.html" | |
269 ><SPAN | |
270 CLASS="STRUCTNAME" | |
271 >SDL_Rect</SPAN | |
272 ></A | |
273 ></P | |
274 ></DIV | |
275 ><DIV | |
276 CLASS="NAVFOOTER" | |
277 ><HR | |
278 ALIGN="LEFT" | |
279 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
280 SUMMARY="Footer navigation table" |
0 | 281 WIDTH="100%" |
282 BORDER="0" | |
283 CELLPADDING="0" | |
284 CELLSPACING="0" | |
285 ><TR | |
286 ><TD | |
287 WIDTH="33%" | |
288 ALIGN="left" | |
289 VALIGN="top" | |
290 ><A | |
291 HREF="sdlconvertsurface.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
292 ACCESSKEY="P" |
0 | 293 >Prev</A |
294 ></TD | |
295 ><TD | |
296 WIDTH="34%" | |
297 ALIGN="center" | |
298 VALIGN="top" | |
299 ><A | |
300 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
301 ACCESSKEY="H" |
0 | 302 >Home</A |
303 ></TD | |
304 ><TD | |
305 WIDTH="33%" | |
306 ALIGN="right" | |
307 VALIGN="top" | |
308 ><A | |
309 HREF="sdlfillrect.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
310 ACCESSKEY="N" |
0 | 311 >Next</A |
312 ></TD | |
313 ></TR | |
314 ><TR | |
315 ><TD | |
316 WIDTH="33%" | |
317 ALIGN="left" | |
318 VALIGN="top" | |
319 >SDL_ConvertSurface</TD | |
320 ><TD | |
321 WIDTH="34%" | |
322 ALIGN="center" | |
323 VALIGN="top" | |
324 ><A | |
325 HREF="video.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
326 ACCESSKEY="U" |
0 | 327 >Up</A |
328 ></TD | |
329 ><TD | |
330 WIDTH="33%" | |
331 ALIGN="right" | |
332 VALIGN="top" | |
333 >SDL_FillRect</TD | |
334 ></TR | |
335 ></TABLE | |
336 ></DIV | |
337 ></BODY | |
338 ></HTML | |
339 > |