Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
_KEYHIT Riddle me this???
#4
I think this is fixed in the latest version, the `-19` is no longer reported. We upgrade FreeGLUT in 3.12.0 and I suspect that fixed it.

That said, the underlying issues with `_KeyHit` are both a GLUT and QB64 problem. _KeyHit is IMO a bad API because it's acts like it supports both text input and individual key state, but those things don't mix. If you look at the kinds of events Windows sends to programs you'll see it clearly separates keyboard physical key press/release events (`WM_KEYUP`, `WM_KEYDOWN`, etc.) from text input events (`WM_CHAR`). `WM_CHAR` does not have a concept of press/release because the value does not directly map to a physical key, think of it like `INKEY$`. `WM_KEYUP` and `WM_KEYDOWN` do report press/release, but they do not report ASCII/text values, so there's no difference between hitting 'a' and 'A' as it's the same physical key.

_KeyHit is basically both of those combined - It's designed to give you the text input capabilities like `INKEY$` but also the press/release events associated with physical keys. It gets messy because the inputted text does not really have press/release events in that fashion.

Unfortunately GLUT made the same mistake as QB64, it's fundamentally broken because its `glutKeyboardUpFunc` callback conflates inputted ASCII values with key release events. These do not map directly to physical keys and thus the release events do not always make sense (try the sequence of "Press shift, press a, release shift, release a").
Reply


Messages In This Thread
_KEYHIT Riddle me this??? - by Pete - 08-15-2024, 03:40 PM
RE: _KEYHIT Riddle me this??? - by SMcNeill - 08-16-2024, 07:43 AM
RE: _KEYHIT Riddle me this??? - by krovit - 08-16-2024, 07:50 AM
RE: _KEYHIT Riddle me this??? - by DSMan195276 - 08-16-2024, 03:08 PM
RE: _KEYHIT Riddle me this??? - by TerryRitchie - 08-16-2024, 04:37 PM
RE: _KEYHIT Riddle me this??? - by Pete - 08-16-2024, 09:47 PM



Users browsing this thread: 1 Guest(s)