Author Topic: What's the hierarchy of keyboard input speeds with QB64?  (Read 2510 times)

0 Members and 1 Guest are viewing this topic.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
What's the hierarchy of keyboard input speeds with QB64?
« on: January 24, 2021, 03:03:06 pm »
It was simple with QBasic. INKEY$ - INP(). INP() might still be the fastest, but where does _KEYHIT and _KEYDOWN /UP fall in the way of speed hierarchy?

Pete

 
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

FellippeHeitor

  • Guest
Re: What's the hierarchy of keyboard input speeds with QB64?
« Reply #1 on: January 24, 2021, 03:38:46 pm »
Nowadays it's more about personal preference, as it's all coming from the same source - your OS. There's no direct hardware polling anyway.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: What's the hierarchy of keyboard input speeds with QB64?
« Reply #2 on: January 24, 2021, 03:59:55 pm »
Nice. I thought I might be missing something by not trying out _KEYDOWN, but with no speed difference, I'll stick with INKEY$ and _KEYHIT. I mixed the two for two different input processes in one program, and they seem to play nicely together. I can still recall INP(96) working at an insane repeat rate in QuickBASIC. I haven't used it in QB64.

My practical concern is this. As I add more conditional statements in my WP program, I risk the repeat rate slowing down, possibly too much; so if there was a faster alternative for keyboard input, I'd switch to it if necessary. I am aware about adjusting _LIMIT in the loop, too.

Thanks for the info,

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

FellippeHeitor

  • Guest
Re: What's the hierarchy of keyboard input speeds with QB64?
« Reply #3 on: January 24, 2021, 04:02:22 pm »
_KEYDOWN is a completely different beast in that it gives you -1/0 if the key is pressed or not - there's no buffer. It's a live-state thing. If you're writing a game, you'll want to use _KEYDOWN for movement, for example.