Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Holding down Lots of keys  (Read 4223 times)

0 Members and 1 Guest are viewing this topic.

Pwndja

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
Holding down Lots of keys
« on: April 02, 2010, 05:23:17 am »
I am currently using 6 different keys in my app: [W, S, D, A, Left, Right]

Now when I push them all down they should still all work. But the S key does not registar. I changed the S key to be the X key and then all the keys work. It is only when I us the S key that they all do not work... That is all except the S key works. With the X = S key they all Work and when S = S key they all work except the S key. It is like it just skips the S key statement.

Code example:
Code: [Select]

while(1)
{

if (App.GetInput().IsKeyDown(sf::Key::W)) //do something
if (App.GetInput().IsKeyDown(sf::Key::S)) //do something ** this does not execute **
if (App.GetInput().IsKeyDown(sf::Key::D)) //do something
if (App.GetInput().IsKeyDown(sf::Key::A)) //do something
if (App.GetInput().IsKeyDown(sf::Key::Left)) //do something
if (App.GetInput().IsKeyDown(sf::Key::Right)) //do something
}


In the above example when I press all the keys: W, S, D, A, Left, Right everything executes except the S key.

But when I do this:

Code: [Select]
while(1)
{
if (App.GetInput().IsKeyDown(sf::Key::W)) //do something
if (App.GetInput().IsKeyDown(sf::Key::X)) //do something ***X Key Now***
if (App.GetInput().IsKeyDown(sf::Key::D)) //do something
if (App.GetInput().IsKeyDown(sf::Key::A)) //do something
if (App.GetInput().IsKeyDown(sf::Key::Left)) //do something
if (App.GetInput().IsKeyDown(sf::Key::Right)) //do something
}


They all work.

Any Ideas why this might be?

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
Holding down Lots of keys
« Reply #1 on: April 02, 2010, 05:30:00 am »
Not a problem with SFML. It's how keyboards are designed. Certain keys combos will not work on certain keyboards.
I use the latest build of SFML2

Pwndja

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
Holding down Lots of keys
« Reply #2 on: April 02, 2010, 06:50:39 am »
Ok thanks. Is there any thing on the web that you might know of which discussions this issue more in-depth? like white pages or anything?

richardwb

  • Newbie
  • *
  • Posts: 3
    • View Profile
Holding down Lots of keys
« Reply #3 on: April 02, 2010, 07:48:17 pm »
Try a search for n-key rollover and take a look at this Wikipedia article.

Pwndja

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
Holding down Lots of keys
« Reply #4 on: April 04, 2010, 03:54:32 am »
Awesome! Thank you for all the help :D

 

anything