From 694e07d193e7c5758a7d672b45668651b034003d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 31 May 2015 00:19:18 +0300 Subject: Convert InputAction enum into strong typed enum. --- src/touchmanager.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/touchmanager.h') diff --git a/src/touchmanager.h b/src/touchmanager.h index a8c83b8d7..932d1981f 100644 --- a/src/touchmanager.h +++ b/src/touchmanager.h @@ -38,7 +38,7 @@ class MouseInput; typedef void (*TouchFuncPtr) (const MouseInput &mouseInput); -const int actionsSize = InputAction::TOTAL; +const int actionsSize = static_cast(InputAction::TOTAL); const int buttonsCount = 12; struct TouchItem final @@ -131,12 +131,16 @@ class TouchManager final : public ConfigListener bool processEvent(const MouseInput &mouseInput); - bool isActionActive(const int index) const; + bool isActionActive(const InputActionT index) const; - void setActionActive(const int index, const bool value) + void setActionActive(const InputActionT index, + const bool value) { - if (index >= 0 && index < actionsSize) - mActions[index] = value; + if (static_cast(index) >= 0 && + static_cast(index) < actionsSize) + { + mActions[static_cast(index)] = value; + } } void resize(const int width, const int height); -- cgit v1.2.3-60-g2f50