home *** CD-ROM | disk | FTP | other *** search
- <!-- manual page source format generated by PolyglotMan v3.0.8+X.Org, -->
- <!-- available at http://polyglotman.sourceforge.net/ -->
-
- <html>
- <head>
- <title>"SDL_keysym"("3") manual page</title>
- </head>
- <body bgcolor='#efefef' text='black' link='blue' vlink='#551A8B' alink='red'>
- <a href='#toc'>Table of Contents</a><p>
-
- <h2><a name='sect0' href='#toc0'>Name</a></h2>
- SDL_keysym- Keysym structure
- <h2><a name='sect1' href='#toc1'>Structure Definition</a></h2>
- <p>
- <br>
- <pre>CWtypedef struct{
- Uint8 scancode;
- SDLKey sym;
- SDLMod mod;
- Uint16 unicode;
- } SDL_keysym;
- </pre><p>
-
- <h2><a name='sect2' href='#toc2'>Structure Data</a></h2>
-
- <dl>
-
- <dt><b>scancode</b> </dt>
- <dd>Hardware specific scancode </dd>
-
- <dt><b>sym</b> </dt>
- <dd>SDL virtual keysym
- </dd>
-
- <dt><b>mod</b> </dt>
- <dd>Current key modifiers </dd>
-
- <dt><b>unicode</b> </dt>
- <dd>Translated character </dd>
- </dl>
-
- <h2><a name='sect3' href='#toc3'>Description</a></h2>
- <p>
- The <b>SDL_keysym</b>
- structure is used by reporting key presses and releases since it is a part
- of the <i><b>SDL_KeyboardEvent</b></i>. <p>
- The <b>scancode</b> field should generally be left alone,
- it is the hardware dependent scancode returned by the keyboard. The <b>sym</b>
- field is extremely useful. It is the SDL-defined value of the key (see <i>SDL
- Key Syms</i>. This field is very useful when you are checking for certain key
- presses, like so: <p>
- <br>
- <pre>CW.
- .
- while(SDL_PollEvent(&event)){
- switch(event.type){
- case SDL_KEYDOWN:
- if(event.key.keysym.sym==SDLK_LEFT)
- move_left();
- break;
- .
- .
- .
- }
- }
- .
- .
- </pre><p>
- <b>mod</b> stores the current state of the keyboard modifiers as explained in
- <i><b>SDL_GetModState</b></i>. The <b>unicode</b> is only used when UNICODE translation is enabled
- with <i><b>SDL_EnableUNICODE</b></i>. If <b>unicode</b> 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: <br>
- <p>
- <br>
- <pre>CWchar ch;
- if ( (keysym.unicode & 0xFF80) == 0 ) {
- ch = keysym.unicode & 0x7F;
- }
- else {
- printf("An International Character.
- ");
- }
- </pre><p>
- UNICODE translation does have a slight overhead so don't enable it unless
- its needed.<br>
-
- <h2><a name='sect4' href='#toc4'>See Also</a></h2>
- <p>
- <i><b>SDLKey</b></i>
- <!--
-
- <p>
-
- <hr><p>
- <a name='toc'><b>Table of Contents</b></a><p>
- <ul>
- <li><a name='toc0' href='#sect0'>Name</a></li>
- <li><a name='toc1' href='#sect1'>Structure Definition</a></li>
- <li><a name='toc2' href='#sect2'>Structure Data</a></li>
- <li><a name='toc3' href='#sect3'>Description</a></li>
- <li><a name='toc4' href='#sect4'>See Also</a></li>
- </ul>
- </body>
- </html>
-