SDL_keysym(3) SDL API Reference SDL_keysym(3)NAME
SDL_keysym - Keysym structure
STRUCTURE DEFINITION
typedef struct{
Uint8 scancode;
SDLKey sym;
SDLMod mod;
Uint16 unicode;
} SDL_keysym;
STRUCTURE DATA
scancode Hardware specific scancode
sym SDL virtual keysym
mod Current key modifiers
unicode Translated character
DESCRIPTION
The SDL_keysym structure is used by reporting key presses and releases since it is a part of the SDL_KeyboardEvent.
The scancode field should generally be left alone, it is the hardware dependent scancode returned by the keyboard. The sym field is
extremely useful. It is the SDL-defined value of the key (see SDL Key Syms. This field is very useful when you are checking for certain key
presses, like so:
.
.
while(SDL_PollEvent(&event)){
switch(event.type){
case SDL_KEYDOWN:
if(event.key.keysym.sym==SDLK_LEFT)
move_left();
break;
.
.
.
}
}
.
.
mod stores the current state of the keyboard modifiers as explained in SDL_GetModState. The unicode is only used when UNICODE translation
is enabled with SDL_EnableUNICODE. If unicode 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:
char ch;
if ( (keysym.unicode & 0xFF80) == 0 ) {
ch = keysym.unicode & 0x7F;
}
else {
printf("An International Character.
");
}
UNICODE translation does have a slight overhead so don't enable it unless its needed.
SEE ALSO
SDLKey
SDL Tue 11 Sep 2001, 23:00 SDL_keysym(3)
Check Out this Related Man Page
keyboard_ucallback(3alleg4) Allegro manual keyboard_ucallback(3alleg4)NAME
keyboard_ucallback - User specified unicode keyboard callback handler. Allegro game programming library.
SYNOPSIS
#include <allegro.h>
extern int (*keyboard_ucallback)(int key, int *scancode);
DESCRIPTION
Unicode-aware version of keyboard_callback(). If set, this function is called by the keyboard handler in response to every keypress. It is
passed the character value and scancode that are about to be added into the input buffer, can modify the scancode value, and returns a new
or modified key code. If it both sets the scancode to zero and returns zero, the keypress will be ignored. This routine executes in an
interrupt context, so it must be in locked memory. Example:
int silence_g_key(int key, int *scancode)
{
if (key == 'g') {
*scancode = 0;
return 0;
}
return key;
} END_OF_FUNCTION(silence_g_key)
...
install_timer();
LOCK_FUNCTION(silence_g_key);
install_keyboard();
keyboard_ucallback = silence_g_key;
Note that this keyboard callback has priority over the non unicode callback. If you set both, only the unicode one will work.
SEE ALSO install_keyboard(3alleg4), readkey(3alleg4), ureadkey(3alleg4), keyboard_callback(3alleg4), keyboard_lowlevel_callback(3alleg4)Allegro version 4.4.2 keyboard_ucallback(3alleg4)
Hi,
I have some software I need to install on HP-UX 11iv1 64bit but it must not be set up in unicode mode. I know unicode/ ASCII etc. I don't know how to get unix to switch between these. Is there an environment setting for that? I use the Korn shell.
Thanks. (2 Replies)
Dear experts,
While developping a C UNICODE application under AIX 5.3, I encountered the following problem, and after days of investigations I still could not find any solution.
Please note that the application is full wchar_t based (not utf8) and that I could compile and run it without any... (4 Replies)
Hi Experts,
I have a 2 GB flat file which have unicode field, some of them are blanks and its size is 4000 character. In the existing system SED command removes the spaces. Because of this field itself....it is taking almost three days to complete the file processing. I removed sed and... (0 Replies)
I have a very large file in Unix that I would like to search for all instances of the unicode character 0x17. I need to remove these characters because the character is causing my SAX Parser to throw an exception. Does anyone know how to find a unicode character in a file?
Thank you for your... (1 Reply)
Hi. Im wondering if there is a way to output key presses using a script? Something like this:
key=down
key=down
key=up
So say if it was sent to Firefox it would make the window scroll down twice then up once. (1 Reply)
I have a file in my Unix ( SOLARIS ) with EBCDIC format...I want this file to read in ASCII OR unicode...Is it possible with UNIX to convert this file on ASCII OR UNICODE format from EBCDIC format?
I was searching through web and found only conversion table :(
Request Rejected
Below is... (16 Replies)