Mercurial > sdl-ios-xcode
annotate docs/html/sdlkeysym.html @ 3335:b8d313de8a65
Adam Strzelecki to SDL
Since current DirectFB implementation is incomplete for YUV surfaces (actually causes segmentation faults when trying Lock and use YUV planar textures) I decided to fix it a bit.
Here's a patch that should make DirectFB properly support YUV both packed and planar (3 planes).
(1) Removed SDL_BYTESPERPIXEL at all in favor of DFB_BYTES_PER_PIXEL(SDLToDFBPixelFormat(fmt)) which does return always proper BPP for YUVs too, coz SDL_BYTESPERPIXEL returns incorrect values for FOURCCs
(2) Fixed data->pixels allocation for planar YUVs in CreateTexture, it should allocate 150% more space
(3) Copy other planes for planar YUVs in UpdateTexture
(4) Moved checking if format is supported at all with DirectFB on CreateTexture at the beginning of the code
Waiting for comments,
--
Adam Strzelecki | nanoant.com
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 04 Oct 2009 04:03:37 +0000 |
parents | 355632dca928 |
children |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_keysym</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="SDL Event Structures." | |
14 HREF="eventstructures.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_QuitEvent" | |
17 HREF="sdlquitevent.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDLKey" | |
20 HREF="sdlkey.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="sdlquitevent.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="sdlkey.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="SDLKEYSYM" | |
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_keysym</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="AEN4659" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_keysym -- Keysym structure</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="AEN4662" |
0 | 88 ></A |
89 ><H2 | |
90 >Structure Definition</H2 | |
91 ><PRE | |
92 CLASS="PROGRAMLISTING" | |
93 >typedef struct{ | |
94 Uint8 scancode; | |
95 SDLKey sym; | |
96 SDLMod mod; | |
97 Uint16 unicode; | |
98 } SDL_keysym;</PRE | |
99 ></DIV | |
100 ><DIV | |
101 CLASS="REFSECT1" | |
102 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
103 NAME="AEN4665" |
0 | 104 ></A |
105 ><H2 | |
106 >Structure Data</H2 | |
107 ><DIV | |
108 CLASS="INFORMALTABLE" | |
109 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
110 NAME="AEN4667" |
0 | 111 ></A |
112 ><P | |
113 ></P | |
114 ><TABLE | |
115 BORDER="0" | |
116 CLASS="CALSTABLE" | |
117 ><TBODY | |
118 ><TR | |
119 ><TD | |
120 ALIGN="LEFT" | |
121 VALIGN="TOP" | |
122 ><TT | |
123 CLASS="STRUCTFIELD" | |
124 ><I | |
125 >scancode</I | |
126 ></TT | |
127 ></TD | |
128 ><TD | |
129 ALIGN="LEFT" | |
130 VALIGN="TOP" | |
131 >Hardware specific scancode</TD | |
132 ></TR | |
133 ><TR | |
134 ><TD | |
135 ALIGN="LEFT" | |
136 VALIGN="TOP" | |
137 ><TT | |
138 CLASS="STRUCTFIELD" | |
139 ><I | |
140 >sym</I | |
141 ></TT | |
142 ></TD | |
143 ><TD | |
144 ALIGN="LEFT" | |
145 VALIGN="TOP" | |
146 >SDL virtual keysym</TD | |
147 ></TR | |
148 ><TR | |
149 ><TD | |
150 ALIGN="LEFT" | |
151 VALIGN="TOP" | |
152 ><TT | |
153 CLASS="STRUCTFIELD" | |
154 ><I | |
155 >mod</I | |
156 ></TT | |
157 ></TD | |
158 ><TD | |
159 ALIGN="LEFT" | |
160 VALIGN="TOP" | |
161 >Current key modifiers</TD | |
162 ></TR | |
163 ><TR | |
164 ><TD | |
165 ALIGN="LEFT" | |
166 VALIGN="TOP" | |
167 ><TT | |
168 CLASS="STRUCTFIELD" | |
169 ><I | |
170 >unicode</I | |
171 ></TT | |
172 ></TD | |
173 ><TD | |
174 ALIGN="LEFT" | |
175 VALIGN="TOP" | |
176 >Translated character</TD | |
177 ></TR | |
178 ></TBODY | |
179 ></TABLE | |
180 ><P | |
181 ></P | |
182 ></DIV | |
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="AEN4686" |
0 | 188 ></A |
189 ><H2 | |
190 >Description</H2 | |
191 ><P | |
192 >The <SPAN | |
193 CLASS="STRUCTNAME" | |
194 >SDL_keysym</SPAN | |
195 > structure is used by reporting key presses and releases since it is a part of the <A | |
196 HREF="sdlkeyboardevent.html" | |
197 ><SPAN | |
198 CLASS="STRUCTNAME" | |
199 >SDL_KeyboardEvent</SPAN | |
200 ></A | |
201 >.</P | |
202 ><P | |
203 >The <TT | |
204 CLASS="STRUCTFIELD" | |
205 ><I | |
206 >scancode</I | |
207 ></TT | |
208 > field should generally be left alone, it is the hardware dependent scancode returned by the keyboard. The <TT | |
209 CLASS="STRUCTFIELD" | |
210 ><I | |
211 >sym</I | |
212 ></TT | |
213 > field is extremely useful. It is the SDL-defined value of the key (see <A | |
214 HREF="sdlkey.html" | |
215 >SDL Key Syms</A | |
216 >. This field is very useful when you are checking for certain key presses, like so: | |
217 <PRE | |
218 CLASS="PROGRAMLISTING" | |
219 >. | |
220 . | |
221 while(SDL_PollEvent(&event)){ | |
222 switch(event.type){ | |
223 case SDL_KEYDOWN: | |
224 if(event.key.keysym.sym==SDLK_LEFT) | |
225 move_left(); | |
226 break; | |
227 . | |
228 . | |
229 . | |
230 } | |
231 } | |
232 . | |
233 .</PRE | |
234 > | |
235 <TT | |
236 CLASS="STRUCTFIELD" | |
237 ><I | |
238 >mod</I | |
239 ></TT | |
240 > stores the current state of the keyboard modifiers as explained in <A | |
241 HREF="sdlgetmodstate.html" | |
242 ><TT | |
243 CLASS="FUNCTION" | |
244 >SDL_GetModState</TT | |
245 ></A | |
246 >. The <TT | |
247 CLASS="STRUCTFIELD" | |
248 ><I | |
249 >unicode</I | |
250 ></TT | |
251 > is only used when UNICODE translation is enabled with <A | |
252 HREF="sdlenableunicode.html" | |
253 ><TT | |
254 CLASS="FUNCTION" | |
255 >SDL_EnableUNICODE</TT | |
256 ></A | |
257 >. If <TT | |
258 CLASS="STRUCTFIELD" | |
259 ><I | |
260 >unicode</I | |
261 ></TT | |
262 > is non-zero then this a the UNICODE character corresponding to the keypress. If the high 9 bits of the character are 0, then this maps to the equivalent ASCII character: | |
263 <PRE | |
264 CLASS="PROGRAMLISTING" | |
265 >char ch; | |
266 if ( (keysym.unicode & 0xFF80) == 0 ) { | |
267 ch = keysym.unicode & 0x7F; | |
268 } | |
269 else { | |
270 printf("An International Character.\n"); | |
271 }</PRE | |
272 > | |
273 UNICODE translation does have a slight overhead so don't enable it unless its needed.</P | |
274 ></DIV | |
275 ><DIV | |
276 CLASS="REFSECT1" | |
277 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
278 NAME="AEN4705" |
0 | 279 ></A |
280 ><H2 | |
281 >See Also</H2 | |
282 ><P | |
283 ><A | |
284 HREF="sdlkey.html" | |
285 ><SPAN | |
286 CLASS="STRUCTNAME" | |
287 >SDLKey</SPAN | |
288 ></A | |
289 ></P | |
290 ></DIV | |
291 ><DIV | |
292 CLASS="NAVFOOTER" | |
293 ><HR | |
294 ALIGN="LEFT" | |
295 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
296 SUMMARY="Footer navigation table" |
0 | 297 WIDTH="100%" |
298 BORDER="0" | |
299 CELLPADDING="0" | |
300 CELLSPACING="0" | |
301 ><TR | |
302 ><TD | |
303 WIDTH="33%" | |
304 ALIGN="left" | |
305 VALIGN="top" | |
306 ><A | |
307 HREF="sdlquitevent.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
308 ACCESSKEY="P" |
0 | 309 >Prev</A |
310 ></TD | |
311 ><TD | |
312 WIDTH="34%" | |
313 ALIGN="center" | |
314 VALIGN="top" | |
315 ><A | |
316 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
317 ACCESSKEY="H" |
0 | 318 >Home</A |
319 ></TD | |
320 ><TD | |
321 WIDTH="33%" | |
322 ALIGN="right" | |
323 VALIGN="top" | |
324 ><A | |
325 HREF="sdlkey.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
326 ACCESSKEY="N" |
0 | 327 >Next</A |
328 ></TD | |
329 ></TR | |
330 ><TR | |
331 ><TD | |
332 WIDTH="33%" | |
333 ALIGN="left" | |
334 VALIGN="top" | |
335 >SDL_QuitEvent</TD | |
336 ><TD | |
337 WIDTH="34%" | |
338 ALIGN="center" | |
339 VALIGN="top" | |
340 ><A | |
341 HREF="eventstructures.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
342 ACCESSKEY="U" |
0 | 343 >Up</A |
344 ></TD | |
345 ><TD | |
346 WIDTH="33%" | |
347 ALIGN="right" | |
348 VALIGN="top" | |
349 >SDLKey</TD | |
350 ></TR | |
351 ></TABLE | |
352 ></DIV | |
353 ></BODY | |
354 ></HTML | |
355 > |