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
- Hold down the down and left arrow keys and keep them pressed down
- 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 )
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.