Pressing 3 keys at once sometimes works

Hi,

I am making a a game where a character is controlled by using the arrow keys and the key “m”.
If you want to move in the down and left direction, you press the down and left arrow keys at the same time.
The problem i have is when holding down, the down arrow key and the left arrow key at the same time then pressing the “m” key. The “m” key does not seem to register. No KeyEvent get sent for the key “m”.

A KeyEvent for “m” gets sent when pressing “m” and holding down down/right, up/left, up/right, right, left, up, down arrow keys.

Code below.
To recreate

  1. Hold down the down and left arrow keys and keep them pressed down
  2. Press “m”

The debugBreak should trigger but does not.

#include "cinder/app/App.h"
#include "cinder/app/RendererGl.h"
#include "cinder/gl/gl.h"

using namespace ci;
using namespace ci::app;
using namespace std;

class KeyDownTestApp : public App {
  public:
	void setup() override;
	void mouseDown( MouseEvent event ) override;

#if ( defined CINDER_MSW || defined CINDER_MAC )
	void keyDown(ci::app::KeyEvent event);
#endif

	void update() override;
	void draw() override;
};

void KeyDownTestApp::setup()
{
}

void KeyDownTestApp::mouseDown( MouseEvent event )
{
}

#if ( defined CINDER_MSW || defined CINDER_MAC )
void KeyDownTestApp::keyDown(ci::app::KeyEvent event)
{
	if (event.getCode() == ci::app::KeyEvent::KEY_m) {
		__debugbreak();
	}
}
#endif

void KeyDownTestApp::update()
{
}

void KeyDownTestApp::draw()
{
	gl::clear( Color( 0, 0, 0 ) ); 
}

CINDER_APP( KeyDownTestApp, RendererGl )

Hi,

I am not 100% sure if this is a Cinder problem or a hardware problem, but if it is the latter: I know some keyboards can only detect a maximum number of simultaneously pressed keys. I’ve heard of 3 or 4 keys, depending on make and model. I also know that keyboard encoders like these do not have a limit.

Try a different keyboard make/model to see if this makes a difference.

-Paul

if it was, a maximum number of simultaneously pressed keys problem, pressing any 3 should not work, right?

This is an odd issue where holding down, down arrow key and left arrow key then pressing the m key does not register that m key has been pressed.

But say, holding down, down arrow key and right arrow key then pressing the m key DOES register that m key has been pressed.

It was rollover. How weird, never heard of it before :slight_smile: I have a controls mapper within my game so people can change keys themselves to ones that work. Its really only a problem when 2 players use the same keyboard. A bit old school as most people have gamepads nowadays for 2 player games. Thanks for the help.

Yet another reason i love my loud-as-shit das : n-key rollover. :slight_smile:

Looks awesome. $175 though!! [quote=“lithium.snepo, post:6, topic:385, full:true”]
Yet another reason i love my loud-as-shit das : n-key rollover. :slight_smile:
[/quote]

Using it 8-10 hours a day, 5 days a week, that thing has paid for itself immediately.

1 Like