NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.64
REL="HOME"
TITLE="SDL Library Documentation"
REL="UP"
TITLE="SDL Event Structures."
HREF="eventstructures.html"><
LINK
REL="PREVIOUS"
TITLE="SDL_QuitEvent"
HREF="sdlquitevent.html"><
LINK
REL="NEXT"
TITLE="SDLKey"
HREF="sdlkey.html"><
/HEAD
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
CLASS="NAVHEADER"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation<
/TH
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
HREF="sdlquitevent.html"
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
HREF="sdlkey.html"
ALIGN="LEFT"
NAME="SDLKEYSYM"
CLASS="REFNAMEDIV"
NAME="AEN4191"
>SDL_keysym -- Keysym structure<
/DIV
CLASS="REFSECT1"
NAME="AEN4194"
>Structure Definition<
/H2
CLASS="PROGRAMLISTING"
>typedef struct{
Uint8 scancode;
SDLKey sym;
SDLMod mod;
Uint16 unicode;
CLASS="REFSECT1"
NAME="AEN4197"
CLASS="INFORMALTABLE"
NAME="AEN4199"
BORDER="0"
CLASS="CALSTABLE"
ALIGN="LEFT"
VALIGN="TOP"
CLASS="STRUCTFIELD"
ALIGN="LEFT"
VALIGN="TOP"
>Hardware specific scancode<
/TD
ALIGN="LEFT"
VALIGN="TOP"
CLASS="STRUCTFIELD"
ALIGN="LEFT"
VALIGN="TOP"
ALIGN="LEFT"
VALIGN="TOP"
CLASS="STRUCTFIELD"
ALIGN="LEFT"
VALIGN="TOP"
>Current key modifiers<
/TD
ALIGN="LEFT"
VALIGN="TOP"
CLASS="STRUCTFIELD"
ALIGN="LEFT"
VALIGN="TOP"
>Translated character<
/TD
CLASS="REFSECT1"
NAME="AEN4218"
CLASS="STRUCTNAME"
> structure is used by reporting key presses and releases since it is a part of the <
A
HREF="sdlkeyboardevent.html"
CLASS="STRUCTNAME"
CLASS="STRUCTFIELD"
> field should generally be left alone, it is the hardware dependent scancode returned by the keyboard. The <
TT
CLASS="STRUCTFIELD"
> field is extremely useful. It is the SDL-defined
value of the key
(see <
A
HREF="sdlkey.html"
>. This field is very useful when you are checking for certain key presses, like so:
CLASS="PROGRAMLISTING"
>.
.
while(SDL_PollEvent(&event)){
switch(event.type){
case SDL_KEYDOWN:
if(event.key.keysym.sym==SDLK_LEFT)
move_left();
break;
.
.
.
}
}
.
>
CLASS="STRUCTFIELD"
> stores the current state of the keyboard modifiers as explained in <
A
HREF="sdlgetmodstate.html"
CLASS="FUNCTION"
CLASS="STRUCTFIELD"
> is only used when UNICODE translation is enabled with <
A
HREF="sdlenableunicode.html"
CLASS="FUNCTION"
CLASS="STRUCTFIELD"
> 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:
CLASS="PROGRAMLISTING"
>char ch;
if ( (keysym.unicode & 0xFF80) == 0 ) {
ch = keysym.unicode & 0x7F;
}
else {
printf("An International Character.\n");
>
UNICODE translation does have a slight overhead so don't enable it unless its needed.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN4237"
></A
><H2
>See Also</H2
><P
><A
HREF="sdlkey.html"
><SPAN
CLASS="STRUCTNAME"
>SDLKey</SPAN
></A
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlquitevent.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlkey.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_QuitEvent</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="eventstructures.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDLKey</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>