# Pressing 3 keys at once sometimes works

**URL:** https://discourse.libcinder.org/t/pressing-3-keys-at-once-sometimes-works/385
**Category:** Using Cinder
**Created:** [November 9, 2016, 6:53pm UTC](https://discourse.libcinder.org/t/pressing-3-keys-at-once-sometimes-works/385 "2016-11-09T18:53:11Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![SuperRockG](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@SuperRockG](https://discourse.libcinder.org/u/SuperRockG)
#### Post date: [November 9, 2016, 6:53pm UTC](https://discourse.libcinder.org/t/pressing-3-keys-at-once-sometimes-works/385/1 "2016-11-09T18:53:11Z")

</div>

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 )
```

---

<div class="post-metadata">

### Author: ![paul.houx](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/paul.houx/32/31_2.png) [@paul.houx](https://discourse.libcinder.org/u/paul.houx)
#### Post date: [November 9, 2016, 9:53pm UTC](https://discourse.libcinder.org/t/pressing-3-keys-at-once-sometimes-works/385/2 "2016-11-09T21:53:57Z")

</div>

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](https://www.ultimarc.com/minipac.html) do not have a limit.

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

-Paul

---

<div class="post-metadata">

### Author: ![SuperRockG](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@SuperRockG](https://discourse.libcinder.org/u/SuperRockG)
#### Post date: [November 9, 2016, 10:40pm UTC](https://discourse.libcinder.org/t/pressing-3-keys-at-once-sometimes-works/385/3 "2016-11-09T22:40:49Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![lithium](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/lithium/32/38_2.png) [@lithium](https://discourse.libcinder.org/u/lithium)
#### Post date: [November 9, 2016, 11:26pm UTC](https://discourse.libcinder.org/t/pressing-3-keys-at-once-sometimes-works/385/4 "2016-11-09T23:26:17Z")

</div>

> **[Rollover (key)](https://en.wikipedia.org/wiki/Rollover_(key))**
>
> Rollover is the ability of a computer keyboard to correctly handle several simultaneous keystrokes. During normal typing on a conventional computer keyboard, only one key is usually pressed at any given time, then released before the next key is pressed.\[citation needed\] However, this is not always the case. When using modifier keys such as Shift or Control, the user intentionally holds the modifier key(s) while pressing and releasing another key. Rapid typists may also sometimes inadvertently ...

---

<div class="post-metadata">

### Author: ![SuperRockG](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@SuperRockG](https://discourse.libcinder.org/u/SuperRockG)
#### Post date: [November 10, 2016, 10:35am UTC](https://discourse.libcinder.org/t/pressing-3-keys-at-once-sometimes-works/385/5 "2016-11-10T10:35:07Z")

</div>

It was rollover. How weird, never heard of it before 🙂 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.

---

<div class="post-metadata">

### Author: ![lithium](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/lithium/32/38_2.png) [@lithium](https://discourse.libcinder.org/u/lithium)
#### Post date: [November 10, 2016, 10:50am UTC](https://discourse.libcinder.org/t/pressing-3-keys-at-once-sometimes-works/385/6 "2016-11-10T10:50:25Z")

</div>

Yet another reason i love my [loud-as-shit das](http://www.daskeyboard.com/daskeyboard-4-professional-for-mac/) : n-key rollover. 🙂

---

<div class="post-metadata">

### Author: ![SuperRockG](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@SuperRockG](https://discourse.libcinder.org/u/SuperRockG)
#### Post date: [November 10, 2016, 10:53am UTC](https://discourse.libcinder.org/t/pressing-3-keys-at-once-sometimes-works/385/7 "2016-11-10T10:53:52Z")

</div>

Looks awesome. $175 though!! [quote=“lithium.snepo, post:6, topic:385, full:true”]  
Yet another reason i love my [loud-as-shit das](http://www.daskeyboard.com/daskeyboard-4-professional-for-mac/) : n-key rollover. 🙂  
[/quote]

---

<div class="post-metadata">

### Author: ![lithium](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/lithium/32/38_2.png) [@lithium](https://discourse.libcinder.org/u/lithium)
#### Post date: [November 10, 2016, 10:56am UTC](https://discourse.libcinder.org/t/pressing-3-keys-at-once-sometimes-works/385/8 "2016-11-10T10:56:12Z")

</div>

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