   virtual keys from scancode in non windows systems
  I can translate scancodes to ascii characters just fine in Windows based systems. However, since the code I am writing is fully cross platform except for this part, I want to figure out how to accomplish the same in non-windows systems: namely Linux, Mac, and Unix.Since all of these operating systems traditionally are built on X11 for window management and event handling, I am wondering if xlib is the place I should be looking for this? In general, I need some pointers and advice since doing some rudimentary google searches has not helped me much thus far. I would greatly appreciate any help. If it helps anyone, below is the way I do this in Windows.//Event.key.keysym.scancode is retrieved from an SDL event structure during a poll//This WinAPI code translates the scancode into an ascii character which is stored in zKeyBYTE keyboardState[256];BYTE zKey;GetKeyboardState( keyboardState );int virtKey = MapVirtualKey( Event.key.keysym.scancode, MAPVK_VSC_TO_VK_EX );ToAscii( virtKey, Event.key.keysym.scancode, keyboardState, (LPWORD) &zKey, 0 );char ch = zKey;
  If you're code is fully cross platform, what library are you using for window creation, etc.? It could be that it already has functionality to do what you need.Edit: obviously I need to learn to read better. Try using SDL_EnableUNICODE() and just reading the translated character from the event.   ;  That is a good suggestion, but I am writing a cross platform windowing/graphics/input API independent interface library. For things like this where I must resort to some platform dependent code, I want to utilize the lower level APIs that are usually guaranteed to be available (I say usually because X11 is optional, but I am assuming its presence in this case.)To sum it up, I basically want to implement this such that the client user supplies a hardware scancode with whatever input or windowing API he/she is using and my interface library takes care of virtualizing it.   ;  For X11, try X11_TranslateKeycode(). For OS X/darwin I believe it's KeyTranslate(); I've no clue for Mac classic.   ;  Sorry to revive this topic so long after it was spawned, but X11_TranslateKeycode does not seem to be part of the xlib library,it seems to be part of sdl. If nothing else, I suppose I could use the sdl source as a reference for how I would do this without sdl. Might kbd be what I want to use?   ;  You could also look at the source inside GLFW, it has its own keymapping across many platforms.   