[GD-General] Key handling revisited
Brought to you by:
vexxed72
From: Brian H. <bri...@py...> - 2002-02-10 02:39:07
|
After thinking about my key handling situation for a day, I think I finally stumbled upon the obvious solution. Fundamentally I wasn't differentiating between ASCII characters and raw key codes, so I ended up just having a jumble of logic both on the key reading side (my platform driver) and on the application side. My HEvent structure only had a keyCode member, which mapped to my system virtual key constants (directly taken from the VK_ constants in WINUSER.H so that there was a one-to-one mapping). To simplify my life, I just added another field, evChar, which is the ASCII representation of the virtual key code. So I can differentiate between top row "0", keypad "0", or just read an ASCII "0" depending on the needs of the calling routine. Yeah, kinda duh, but for some reason I was just focused on having a single key code and doing the appropriate thing with it at all times. Of course, this doesn't address the issue of international keyboards. I have no idea what to do about that, other than just hope and pray it's not a problem. And if it is, I guess I'll deal with it then. Brian |