02-10-2023, 02:16 PM
What you've got looks a whole lot like my keyhit library, except it's not quite as advanced. What you're tracking is a single button's up/down state, to see when it might be pressed, while the keyhit code here does that and applies key modifiers to it.
The difference in a nutshell?
You report Shift-A as two key presses -- "Shift" is down, "A" is down.
This library reports Shift-A as two modified key presses -- "Shift" is down (it doesn't modify), "A" might be down, or "a" might be down (depending on CapsLock state).
One thing for you to be careful of -- _DEVICES is glut bugged, just like the rest of the QB64 keyboard input commands. There are various keys and combos which *WILL NOT* register using _DEVICES. From memory, I *think* the ALT keys are two of the most obvious which _BUTTON doesn't read or recognize. It's this basic glut glitch which led to me creating this keyhit library for windows, as it relies on basic windows API commands to get our keyboard state for us, and bypasses glut completely.
Good news though! Matt is currently looking into our keyboard input routines and *thinks* he can fix them. No timeline for a patch date yet, except for soon(tm)... Just know the issue is one we're more than aware of, and it's one that we're constantly striving to fix. It's just not the simplest of things to sort out and correct, so it's still in our "pending correction" list and hasn't made it all the way into the "past bug" bin yet.
The difference in a nutshell?
You report Shift-A as two key presses -- "Shift" is down, "A" is down.
This library reports Shift-A as two modified key presses -- "Shift" is down (it doesn't modify), "A" might be down, or "a" might be down (depending on CapsLock state).
One thing for you to be careful of -- _DEVICES is glut bugged, just like the rest of the QB64 keyboard input commands. There are various keys and combos which *WILL NOT* register using _DEVICES. From memory, I *think* the ALT keys are two of the most obvious which _BUTTON doesn't read or recognize. It's this basic glut glitch which led to me creating this keyhit library for windows, as it relies on basic windows API commands to get our keyboard state for us, and bypasses glut completely.
Good news though! Matt is currently looking into our keyboard input routines and *thinks* he can fix them. No timeline for a patch date yet, except for soon(tm)... Just know the issue is one we're more than aware of, and it's one that we're constantly striving to fix. It's just not the simplest of things to sort out and correct, so it's still in our "pending correction" list and hasn't made it all the way into the "past bug" bin yet.