Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Commit

Permalink
more small corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
Ybalrid committed Dec 23, 2017
1 parent f6e1383 commit 16fc4a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/AnnEventManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ void AnnEventManager::clearListenerList()
}

//l equals NULL by default
void AnnEventManager::removeListener(shared_ptr<AnnEventListener> l)
void AnnEventManager::removeListener(AnnEventListenerPtr l)
{
AnnDebug() << "Removing an event listener : " << l.get();
if (l == nullptr) { clearListenerList(); return; }
Expand Down Expand Up @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion src/AnnEvents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)
Expand Down

0 comments on commit 16fc4a1

Please sign in to comment.