From 5ba40369ccb5d2d0c72cec48feb0a7c623f14e71 Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Mon, 26 May 2014 16:54:54 +0200 Subject: [PATCH] Don't unnecessarily expose internal constant --- src/input.cpp | 8 ++++---- src/input.h | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/input.cpp b/src/input.cpp index 6758dc6..85a6d1f 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -31,7 +31,7 @@ #include #include -const int Input::buttonCodeSize = 24; +#define BUTTON_CODE_COUNT 24 struct ButtonState { @@ -285,7 +285,7 @@ struct InputPrivate /* Collective binding array */ std::vector bindings; - ButtonState stateArray[Input::buttonCodeSize*2]; + ButtonState stateArray[BUTTON_CODE_COUNT*2]; ButtonState *states; ButtonState *statesOld; @@ -312,7 +312,7 @@ struct InputPrivate initMsBindings(); states = stateArray; - statesOld = stateArray + Input::buttonCodeSize; + statesOld = stateArray + BUTTON_CODE_COUNT; /* Clear buffers */ clearBuffer(); @@ -359,7 +359,7 @@ struct InputPrivate void clearBuffer() { - const size_t size = sizeof(ButtonState) * Input::buttonCodeSize; + const size_t size = sizeof(ButtonState) * BUTTON_CODE_COUNT; memset(states, 0, size); } diff --git a/src/input.h b/src/input.h index 7d4c2c9..2a4e501 100644 --- a/src/input.h +++ b/src/input.h @@ -45,8 +45,6 @@ public: MouseLeft = 38, MouseMiddle = 39, MouseRight = 40 }; - static const int buttonCodeSize; - void update(); bool isPressed(int button);