QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: Pete on January 24, 2021, 03:03:06 pm

Title: What's the hierarchy of keyboard input speeds with QB64?
Post by: Pete 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

 
Title: Re: What's the hierarchy of keyboard input speeds with QB64?
Post by: FellippeHeitor 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.
Title: Re: What's the hierarchy of keyboard input speeds with QB64?
Post by: Pete 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
Title: Re: What's the hierarchy of keyboard input speeds with QB64?
Post by: FellippeHeitor 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.