Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8946869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:36:27+00:00 2026-06-15T12:36:27+00:00

I came across an issue with SDL – having both w a s d

  • 0

I came across an issue with SDL – having both w a s d and arrow keys simultaneously pressed – there’s some kind of incompatibility whilst holding down s, d and left and down as well as w d and up and left keys. If i tend to use the combinations mentioned above, only 3 keys seem to work, otherwise, any other combination with more than 3 keys works rather well. Code below:
Event checking ( in class CEvent, calling child’s functions )

switch(Event->type) {
    case SDL_KEYDOWN: {//KEYBOARD_KEYDOWN
        onKeyDown(Event->key.keysym.sym,Event->key.keysym.mod,Event->key.keysym.unicode);
        break;

    }

    case SDL_KEYUP: {//KEYBOARD_KEYUP
        onKeyUp(Event->key.keysym.sym,Event->key.keysym.mod,Event->key.keysym.unicode);
        break;
    }
}

This calls two functions, overridden from parent class ( in class Core, child of CEvent ):

void Core::onKeyDown(SDLKey sym, SDLMod mod, Uint16 unicode) {
    switch(sym) {
      //pl1
        case SDLK_UP: pl1.pmu = true; break;
        case SDLK_RIGHT: pl1.pmr = true; break;
        case SDLK_DOWN: pl1.pmd = true; break;
        case SDLK_LEFT: pl1.pml = true; break;
      //pl2
        case 'w': pl2.pmu = true; break;
        case 'd': pl2.pmr = true; break;
        case 's': pl2.pmd = true; break;
        case 'a': pl2.pml = true; break;
      case SDLK_ESCAPE: onExit(); break;
  }
}

void Core::onKeyUp(SDLKey sym, SDLMod mod, Uint16 unicode) {
  switch(sym) {
    //pl1
    case SDLK_UP: pl1.pmu = false; break;
    case SDLK_RIGHT: pl1.pmd = false; break;
    case SDLK_DOWN: pl1.pml = false; break;
    case SDLK_LEFT: pl1.pmr = false; break;
    //pl2
    case 'w': pl2.pmu = false; break;
    case 'd': pl2.pmr = false; break;
    case 's': pl2.pmd = false; break;
    case 'a': pl2.pml = false; break;
  }
}

Here’s how this is called( in class Core, child of CEvent ):

while( Running ) {
  FPS_START = SDL_GetTicks();
  while( SDL_PollEvent( &Eventhn ) ) {
    onEvent( &Eventhn );
  }
  onLoop();
  onRender();
  regulateFPS();
}
onCleanup();

I just can’t figure what causes this as the program loops through this until there are no events remaining in the buffer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:36:28+00:00Added an answer on June 15, 2026 at 12:36 pm

    This could be the key blocking phenomenon described here: http://en.wikipedia.org/wiki/Rollover_(key)#Key_blocking_and_ghosting

    There’s nothing you can do about this. If you change keyboard, you may get lucky and find one that has problems with a different combination of keys (hopefully one that you’re not using).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When running some tests I came across the following issue. When using: private String
While debugging a crash, I came across this issue in some code: int func()
While writing some code i came across this issue: #include <iostream> class random {
I'm doing some data parsing and came across this issue. Say we want to
I am trying to do some web crawling and I came across an issue
I was doing some work today, and came across an issue where something looked
I came across an issue that makes me think there is bug in the
I came across this issue last night where my CSS would not affect the
Just came across an issue with my Wordpress template that I can't figure out.
I came across an issue where, just to try it out, I removed an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.