QB64 bug or exception? - Printable Version +- QB64 Phoenix Edition (https://staging.qb64phoenix.com) +-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://staging.qb64phoenix.com/forumdisplay.php?fid=3) +---- Forum: Help Me! (https://staging.qb64phoenix.com/forumdisplay.php?fid=10) +---- Thread: QB64 bug or exception? (/showthread.php?tid=944) Pages:
1
2
|
QB64 bug or exception? - Pete - 10-03-2022 This should detect a space bar press, when other keys are held down like arrow key combinations. It does, except in the code snippet below... If you hold down the ARROW UP and ARROW LEFT keys at the same time, and press the space bar, you won't hear the sound. Other combos like arrow up and arrow right held down while pressing the space bar will produce the sound. So what's up? I further tested noted in my QB64 version 2.1 Development Build that the software is blocking INKEY$, _KEYHIT, and _KEYDOWN from registering CHR$(32). the space bar, under some key combination conditions, but not others. Code: (Select All) DO Change CHR$(32) to CHR$(9), no problem. Code: (Select All) DO Change INKEY$ to _KEYHIT = 32 and it gets blocked again. Code: (Select All) DO Same issue with _KEYDOWN (I swapped out sound for print to avoid annoying build up of sound.) Code: (Select All) DO Any ideas as to why, or is this a bug that's been fixed in a newer version? Pete RE: QB64 bug or exception? - RhoSigma - 10-03-2022 (10-03-2022, 07:30 AM)Pete Wrote: This should detect the space bar pressed, even if other keys are held won,like arrow keys, but... IMHO they (Galleon/QB64Team?) totally screwed the entire keyboard input system with the transition from SDL to OpenGL. I don't know how often I complained about in the .net forum, because I wasn't able to type a simple file path into the IDE, as the german keyboards key sequence for a backslash (AltGr+?) wasn't recognized. This finally was the reason for my alternative input routine which another member extended for more languages (follow green "Best Answer") link. However, these will probably not solve your problem with recognizing multiple keys, but I bet its some of the same issue I had with the backslash. The whole keyboard input system should be ripped out and rebuild in a manner using the systems language/keyboard layout settings. RE: QB64 bug or exception? - Pete - 10-03-2022 So bug then. Nothing important to have it designed that way. Well, that's a shame, since the space bar is such a nice shooter key. There really isn't a good ergonomic substitute for it. Anything else would be like piloting the Enterprise, and discovering warp drive is a stick shift. Oh wait, that's kind of cool. Never mind. Pete RE: QB64 bug or exception? - James D Jarvis - 10-03-2022 Inkey$ seem to return the latest keypress in favor of the one you have been holding down for a while. It isn't just an issue with the space key. see code: Inkey$ seem to return the latest keypress in favor of the one you have been holding down for a while. It isn't just an issue with the space key. see code: Code: (Select All) _ControlChr Off hold down a button its 'asc code is reported. keep holding it down and press another key and the new key is reported and it will block reporting on the original key until it is released. RE: QB64 bug or exception? - Pete - 10-03-2022 Noted, but this is an issue about playing nice with _KEYDOWN(), which it does until you hold down the cursor key combo arrow up and arrow left. That's the combo that blocks it, _KEYHIT, or even _KEYDOWN(32) from being registered when those two arrow keys are held down. So, it's not really an INKEY$ issue. Also, if we change that CHR$(32) to something else like CHR$(9) then it works with all eight directional arrow keys (4 single and 4 double) combinations. I see no reason this same functioning shouldn't work with the space bar key since it does work with other third key presses like Tab. I'm with Rho on this one, bug! It's a shame, too, since QB64 added keyboard statements were the first breakthrough in detecting more than a two-key event. Maybe an alert should be placed in the Wiki to this regard, if it is not fixable in time? Pete RE: QB64 bug or exception? - James D Jarvis - 10-03-2022 _keyhit doesn't report the mashed key after it is interrupted with another key either (as noted) until after the original mashed key is released Code: (Select All) _ControlChr Off definitely in bug land. RE: QB64 bug or exception? - bplus - 10-03-2022 Yah I discovered a problem last night with this code: Code: (Select All) _Title "Use arrow keys to move our hero, spacebar to shoot." I can shoot (3 keypresses) Spacebar + Up and Right or Spacebar + Down and Left but not Spacebar + Up and Left Nor Spacebar + Down and Right. No problems if just Spacebar and one arrow key. Even tried this mod: If _KeyDown(32) And ((dx <> 0) Or (dy <> 0)) Then GoSub shoot no difference. RE: QB64 bug or exception? - TerryRitchie - 10-03-2022 Ok, this explains the strange results I was getting in my Mario particle fountain in the tutorial: https://www.qb64tutorial.com/lesson18#h.z8t9row5ze9h The space bar is used through _KEYHIT and the enter key is used through _KEYDOWN If you hold the space bar down the enter key will never be seen. If you hold the enter key down however the space bar will be seen. I thought this might have been a bug but was too busy working on the tutorial and forgot to mention it. RE: QB64 bug or exception? - Pete - 10-03-2022 I edited the above post to demonstrate a bit more of what I described. I included this snippet to show the keyboard output with the 5 keys in question, arrow key(s) and space bar... Code: (Select All) ' Hold down any two or three arrow keys at once then repeatedly press the space bar. Thanks for checking into this, guys. I think it should be reported as a bug and as Rho pointed out, there are apparently other issues that need to be addressed in the QB64 keyboard functions. Pete RE: QB64 bug or exception? - James D Jarvis - 10-03-2022 playing with key input because of other posts brought me to this horrible calamity.... the beeping doesn't stop if you press the spacebar/ Why? It stops if you uncomment the _limit command it behaves like I'd expect but otherwise it keeps playing.... I don't understand why this happens. Yes a _limit inside a loop is sensible .... but should this be expected? Code: (Select All) Do What is _limit actually doing? Why does it work (just reads each key press) with _limit uncommented? |