![]() |
KeyBoard Library - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Expanding Horizons (Libraries) (https://qb64phoenix.com/forum/forumdisplay.php?fid=21) +---- Forum: SMcNeill (https://qb64phoenix.com/forum/forumdisplay.php?fid=22) +---- Thread: KeyBoard Library (/showthread.php?tid=3674) |
KeyBoard Library - SMcNeill - 05-09-2025 This is basically Windows Only. You can plug it into your Linux/Mac systems, but it simply defaults back to _KEYHIT and does nothing else for you guys. This library has been around forever and ever now, and is my *most used* personal library of code. This is *ESSENTIAL* for me, and I could've sworn it was on the forums here, but somehow it doesn't seem to be. My apologies for anyone who might've made use of this and missed out on it for that oversight. So, what *is* this? It's my handy dandy, super dooper, personal replacement for _KEYHIT. To illustrate its usefulness, let me just pop out the world's simplest little set of code to run with it. Grab the library, extract it to your QB64PE folder, and copy/paste/compile/run this little code snippet. Code: (Select All)
Only 9 simple lines of code. How the heck could this showcase how useful something could possibly be? All this does is read keyboard input for us and then print the up and down codes related to that input... YAWWWNNN...... But, humor me and give it a test run. Press keys. See how the values match. Then get creative. Try some more advanced things, like combo keys. Try something simple like CTRL-1, or CTRL-2, or CTRL-(any number). Or CTRL-TAB... And then try some three keys combo like CTRL-SHIFT-(any number). So which is returning proper values for you, and which is missing key up or key down events, or mapping them to god only knows what... GLUT is screwy. It doesn't work with a BEEP with extended keypresses. So, to deal with that, I wrote my own custom keyboard input handling routines. ![]() Of course, I'm a Windows-Only type of programmer and this reverts back to system calls for us, so it's not Linux/Mac suitable. Just so basic code doesn't break if someone wants to cross-compile, this internally substitutes _KEYHIT for KeyHit (note my routine doesn't have any underscore associated with it), but you lose all the best features with this. This also has German, Western Europe, and Italian keyboard support provided so you can use it to read from each of those keyboards and not miss any key events. There's also an over-engineered enhanced INPUT routine packaged in this, but it's more than a little complicated for a new user to sort it. (But it's rather impressive on what it can do for us, in its own right.) Kick it around. Try it out. This might be what you never knew you needed. Then again, if you've never been disappointed with _KEYHIT before, then it might not be. Either way, it's back here on the forums for those who might need to make use of it for their own stuff. ![]() |