SFML community forums
Help => General => Topic started by: Bizarreofnature on October 28, 2017, 11:54:43 pm
-
Hello!
And again I have to annoy you guys.
I got a very weird bug and I have NO idea.
Basically my ship can move in all directions and shooting at the same time is no problem, except for one direction. If i move my ship upwards and to the left at the same time, for some reason i cant shoot anymore.
It is only this direction, all the other 7 work fine. And the weird thing is my code is all clean. Just what is going on?
Thanks in advance,
Bizarreofnature!
-
Alright, I figured it. It was indeed an sfml bug. It seems sfml doesnt respond to certain keys when there are a few events at the same time.
Thanks anyways!
-
Sounds more like you have a cheap keyboard which causes "key jamming" (https://en.wikipedia.org/wiki/Rollover_(key)#Key_jamming_and_ghosting) very quickly. Not really anything SFML can do when your hardware is limiting the key inputs. ;)
-
This is very common keyboard problem.
Not all keyboards' keys can be registered at once; certain combinations are impossible. Which combinations are valid or invalid depend on the keyboard. There exist some keyboards that have slightly better-than-standard independant recognition of keys, usually ones used commonly in games (qwerasdfzxcv... etc.)
This does mean, though, that it isn't an SFML bug as such; it's a keyboard technical error. For example, try the program with a different keyboard or you could try the exact same code replacing which keys are used and probably end up with a differing result.
You could also test this effect of your keyboard in a text editor. For example, if the keys you are using in your program are W for up, A for left and SPACE for shoot, try pressing those keys together in a simple text editor and see if the SPACE still works while W and A are still pressed...
Note: although eXpl0it3r posted first, I started mine first (was too long ;D) so I'm posting it anyway since it explains how you might test it or how to improve it by getting a new keyboard ;)
-
Wow you guys were right. It is indeed NOT an sfml bug.
Thanks for your answers!