Skip to content

Commit

Permalink
Implement query methods in terms of static methods
Browse files Browse the repository at this point in the history
Reduce code duplication. Ensure functions with similar names behave in the same manner. Previously the `shift` and `query_shift` functions treated Caps Lock differently.
  • Loading branch information
DanRStevens committed Jan 28, 2024
1 parent fdb7db8 commit d6346ab
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions NAS2D/EventHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ bool EventHandler::control(KeyModifier mod)
*/
bool EventHandler::query_shift() const
{
return KeyModifier::None != (static_cast<KeyModifier>(SDL_GetModState()) & KeyModifier::Shift);
return shift(static_cast<KeyModifier>(SDL_GetModState()));
}


Expand All @@ -801,7 +801,7 @@ bool EventHandler::query_shift() const
*/
bool EventHandler::query_numlock() const
{
return KeyModifier::None != (static_cast<KeyModifier>(SDL_GetModState()) & KeyModifier::Num);
return numlock(static_cast<KeyModifier>(SDL_GetModState()));
}


Expand All @@ -810,7 +810,7 @@ bool EventHandler::query_numlock() const
*/
bool EventHandler::query_control() const
{
return KeyModifier::None != (static_cast<KeyModifier>(SDL_GetModState()) & KeyModifier::Ctrl);
return control(static_cast<KeyModifier>(SDL_GetModState()));
}


Expand Down

0 comments on commit d6346ab

Please sign in to comment.