cinder / Cinder

Cinder is a community-developed, free and open source library for professional-quality creative coding in C++.
http://libcinder.org
Other
5.32k stars 939 forks source link

Ubuntu - Weird KeyEvents #2226

Open OneBit74 opened 3 years ago

OneBit74 commented 3 years ago
#include "cinder/app/App.h"
#include "cinder/app/RendererGl.h"

using namespace ci::app;
using namespace std;

class MyApp : public App {
public:
    void keyUp( KeyEvent event ) override;
    void keyDown( KeyEvent event ) override;
};

void MyApp::keyUp( KeyEvent event ){
    cout << "Up: " << event.getCode() << endl;
}
void MyApp::keyDown( KeyEvent event ) {
    cout << "Down: " << event.getCode() << endl;
}
void prepareSettings( MyApp::Settings* settings ){}
CINDER_APP( MyApp, RendererGl, prepareSettings )

I'm new to cinder and found this weird behavior of KeyEvents. Running the example above I get:

Down: 119 // pressing 'w'                                                                
Down: 115 // pressing 's'                                                                  
Up: 115 // releasing 'w'                                                                  
Up: 0 // releasing 's'
Down: 119 // pressing 'w'                                                                
Down: 115 // pressing 's'                                                                  
Up: 115 // releasing 's'                                                                  
Up: 0 // releasing 'w'
Down: 119 // pressing 'w'                                                                
Down: 115 // pressing 's'                                                                  
Up: 115 // releasing 'w'     
Down: 0 // still pressing 's'       
Down: 0 // still pressing 's'       
Down: 0 // still pressing 's'                                                             
Up: 0 // releasing 's'

OS: Ubuntu 18.04.5 WM: i3 Build: source