[SDL] Japanese input

Jonathan Dearborn grimfang4 at hotmail.com
Sun Nov 19 16:49:42 PST 2006


Hey,
 
I would look into SDL_EnableUNICODE(int enable);
With SDL_EnableUNICODE(true) and probably SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL), you can test your SDL_Event keypress (assuming you already know how that works) with something like (event.key.keysym.unicode > minJapCharValue && event.key.keysym.unicode < maxJapCharValue) and then take the value with char input = (char)event.key.keysym.unicode;
You'll probably want to use SDL_EnableUNICODE(false) when you're done getting keyboard input.
 
This is fully cross-platform, but your user of course needs to be using a Japanese keyboard layout.  An example for the value min and max for english/roman characters is 0 - 0x80.  Japanese characters are probably up there in the mid-range of the unicode set.  Google for a unicode map/table.
 
Jonny D



> Date: Sun, 19 Nov 2006 18:27:48 +0100> From: kuon at goyman.com> To: sdl at libsdl.org> Subject: [SDL] Japanese input> > Hello,> > I use SDL for an application and I was wondering how I could implement > japanese input.> > I need a cross platform solution for linux, macosx and windows.> > Regards> -- > Kuon> CEO - Goyman.com SA> http://www.goyman.com/> > "Computers should not stop working when the users' brain does."
_________________________________________________________________
Express yourself with gadgets on Windows Live Spaces
http://discoverspaces.live.com?source=hmtag1&loc=us
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20061119/5a1387c8/attachment.htm 


More information about the SDL mailing list