diff --git a/src/AnnEventManager.cpp b/src/AnnEventManager.cpp index 8a699d4a..a6bd9865 100644 --- a/src/AnnEventManager.cpp +++ b/src/AnnEventManager.cpp @@ -216,7 +216,7 @@ void AnnEventManager::clearListenerList() } //l equals NULL by default -void AnnEventManager::removeListener(shared_ptr l) +void AnnEventManager::removeListener(AnnEventListenerPtr l) { AnnDebug() << "Removing an event listener : " << l.get(); if (l == nullptr) { clearListenerList(); return; } @@ -254,17 +254,18 @@ void AnnEventManager::processKeyboardEvents() { //for each key of the keyboard for (size_t c(0); c < KeyCode::SIZE; c++) - if ((Keyboard->isKeyDown(OIS::KeyCode(c)) && !previousKeyStates[c]) || //TODO: V728 https://www.viva64.com/en/w/V728 An excessive check can be simplified. The '(A && !B) || (!A && B)' expression is equivalent to the 'bool(A) != bool(B)' expression. - (!Keyboard->isKeyDown(OIS::KeyCode(c)) && previousKeyStates[c])) + { + if(Keyboard->isKeyDown(OIS::KeyCode(c)) != previousKeyStates[c]) { //create a corresponding key event AnnKeyEvent e; e.setCode(KeyCode::code(c)); e.ignored = keyboardIgnore; - bool(previousKeyStates[c] = Keyboard->isKeyDown(OIS::KeyCode(c))) ? e.setPressed() : e.setReleased(); + bool(previousKeyStates[c] = Keyboard->isKeyDown(OIS::KeyCode(c))) ? e.pressed = true : e.pressed = false; keyEventBuffer.push_back(e); } + } } void AnnEventManager::processMouseEvents() diff --git a/src/AnnEvents.cpp b/src/AnnEvents.cpp index 099ade15..f9d08c8f 100644 --- a/src/AnnEvents.cpp +++ b/src/AnnEvents.cpp @@ -160,7 +160,7 @@ StickAxisId AnnStickAxis::getAxisId() const return id; } -AnnStickAxis::AnnStickAxis(StickAxisId ax, int rel, int abs) //TODO: V730 https://www.viva64.com/en/w/V730 It is possible that not all members of a class are initialized inside the constructor. Consider inspecting: noRel. +AnnStickAxis::AnnStickAxis(StickAxisId ax, int rel, int abs) { setAxis(ax); setRelValue(rel); @@ -170,6 +170,7 @@ AnnStickAxis::AnnStickAxis(StickAxisId ax, int rel, int abs) //TODO: V730 https: void AnnStickAxis::setRelValue(int rel) { r = rel; + noRel = false; } void AnnStickAxis::setAbsValue(int abs)