Author Topic: Keyboard jamming issue only happening in QB64  (Read 5831 times)

0 Members and 1 Guest are viewing this topic.

Offline johannhowitzer

  • Forum Regular
  • Posts: 118
    • View Profile
Re: Keyboard jamming issue only happening in QB64
« Reply #15 on: July 12, 2020, 05:59:12 am »
Fellipe, it sounds like you're talking about reply #5... please go back and read reply #6, where I describe in detail what happened when I tried Steve's "simpler solution."

In fact, here.  I'll make it as simple as possible.  Go compile this program, and follow these steps when it's running:

1. Start holding Z
2. Start holding Shift
3. Stop holding Z
4. Stop holding Shift

See what happens?  No "jumping through the hoops of functions and arrays," same result.

Code: QB64: [Select]
  1.    _limit 60
  2.    cls
  3.    if _keydown(90) then print "uppercase"
  4.    if _keydown(122) then print "lowercase"
  5.  
« Last Edit: July 12, 2020, 06:06:41 am by johannhowitzer »

FellippeHeitor

  • Guest
Re: Keyboard jamming issue only happening in QB64
« Reply #16 on: July 12, 2020, 08:59:24 am »
I was talking about reply #12, but now that you've provided a minimal reproducible example I can confirm it's actually a bug.

Thanks for reporting, we'll begin investigating the issue.

FellippeHeitor

  • Guest
Re: Keyboard jamming issue only happening in QB64
« Reply #17 on: July 12, 2020, 09:11:29 am »
In the meantime, here's a workaround for your game:

Code: QB64: [Select]
  1.     _LIMIT 60
  2.     CLS
  3.     k& = _KEYHIT
  4.     SELECT CASE k&
  5.         CASE 122, 90: zIsDown = -1
  6.         CASE -122, -90: zIsDown = 0
  7.     END SELECT
  8.  
  9.     PRINT "Left shift: "; _KEYDOWN(100304)
  10.     PRINT "Right shift: "; _KEYDOWN(100303)
  11.     PRINT "Z/z: "; zIsDown
  12.     _DISPLAY
  13.  

Offline johannhowitzer

  • Forum Regular
  • Posts: 118
    • View Profile
Re: Keyboard jamming issue only happening in QB64
« Reply #18 on: July 12, 2020, 09:19:49 am »
Nice!  Ran that immediately and it works perfectly.  Seems _keyhit indeed lacks the issue in _keydown; I still don't have my mind around how _keyhit is supposed to capture multiple keys pressed at the same time, but that's the first code I've seen in which the issue vanished.  I'll have to do some messing around and testing to educate myself on how _keyhit works under various circumstances.

This did have a good side-effect, too.  In experimenting with other default keybinding setups, I found that Lctrl-Z-X-C is in fact a bit more comfortable than Lctrl-Lshift-Z-X.  In the latter, whenever hitting shift, I realized I felt a bit like my ring finger was having to reach over my pinky finger a bit.  Which is not good, as Lctrl+Lshift is the combination that would produce a blink-teleport.

Thanks for the help.

Offline johannhowitzer

  • Forum Regular
  • Posts: 118
    • View Profile
Re: Keyboard jamming issue only happening in QB64
« Reply #19 on: July 12, 2020, 09:35:54 am »
As an aside, I found Steve's reply 12 to be very strange, didn't seem like it was even coming from the same person as reply 5, since all it did was take the false positives and slap an OR between them - which does nothing to remove a false positive.  That's why I had assumed you couldn't be talking about reply 12, reply 12 doesn't make any sense after 5.