Merge pull request #164 from SHADE-DP/SP3-10-input-management
Zero out arrays in input manager Properly zero out arrays in input manager so that it works in Release Mode, where arrays are not zeroed-out to save time.
This commit is contained in:
commit
02e9df4df7
|
@ -25,16 +25,16 @@ namespace SHADE
|
|||
std::map<std::string, SHInputManager::SHLogicalBindingData> SHInputManager::bindings;
|
||||
|
||||
unsigned SHInputManager::keyCount = 0;
|
||||
bool SHInputManager::keys[MAX_KEYS];
|
||||
bool SHInputManager::keysLast[MAX_KEYS];
|
||||
double SHInputManager::keysHeldTime[MAX_KEYS];
|
||||
double SHInputManager::keysReleasedTime[MAX_KEYS];
|
||||
bool SHInputManager::keys[MAX_KEYS] = {};
|
||||
bool SHInputManager::keysLast[MAX_KEYS] = {};
|
||||
double SHInputManager::keysHeldTime[MAX_KEYS] = {};
|
||||
double SHInputManager::keysReleasedTime[MAX_KEYS] = {};
|
||||
|
||||
unsigned SHInputManager::keyToggleCount = 0;
|
||||
bool SHInputManager::keysToggle[MAX_KEYS];
|
||||
bool SHInputManager::keysToggleLast[MAX_KEYS];
|
||||
double SHInputManager::keysToggleOnTime[MAX_KEYS];
|
||||
double SHInputManager::keysToggleOffTime[MAX_KEYS];
|
||||
bool SHInputManager::keysToggle[MAX_KEYS] = {};
|
||||
bool SHInputManager::keysToggleLast[MAX_KEYS] = {};
|
||||
double SHInputManager::keysToggleOnTime[MAX_KEYS] = {};
|
||||
double SHInputManager::keysToggleOffTime[MAX_KEYS] = {};
|
||||
|
||||
int SHInputManager::mouseScreenX = 0;
|
||||
int SHInputManager::mouseScreenY = 0;
|
||||
|
@ -46,11 +46,11 @@ namespace SHADE
|
|||
int SHInputManager::mouseWheelVerticalDeltaPoll = 0;
|
||||
|
||||
unsigned char SHInputManager::controllersConnectedCount = 0;
|
||||
unsigned SHInputManager::controllersInputCount[XUSER_MAX_COUNT];
|
||||
unsigned SHInputManager::controllersButtonCount[XUSER_MAX_COUNT];
|
||||
short SHInputManager::controllers[XUSER_MAX_COUNT][MAX_CONTROLLER_INPUT];
|
||||
short SHInputManager::controllersLast[XUSER_MAX_COUNT][MAX_CONTROLLER_INPUT];
|
||||
double SHInputManager::controllersHeldTime[XUSER_MAX_COUNT][MAX_CONTROLLER_INPUT];
|
||||
unsigned SHInputManager::controllersInputCount[XUSER_MAX_COUNT] = {};
|
||||
unsigned SHInputManager::controllersButtonCount[XUSER_MAX_COUNT] = {};
|
||||
short SHInputManager::controllers[XUSER_MAX_COUNT][MAX_CONTROLLER_INPUT] = {};
|
||||
short SHInputManager::controllersLast[XUSER_MAX_COUNT][MAX_CONTROLLER_INPUT] = {};
|
||||
double SHInputManager::controllersHeldTime[XUSER_MAX_COUNT][MAX_CONTROLLER_INPUT] = {};
|
||||
double SHInputManager::controllersReleasedTime[XUSER_MAX_COUNT][MAX_CONTROLLER_INPUT];
|
||||
|
||||
//Internal helper function for splitting between inputs
|
||||
|
@ -106,9 +106,11 @@ namespace SHADE
|
|||
memcpy(keysLast, keys, sizeof(keys));
|
||||
|
||||
//Poll
|
||||
unsigned char keyboardState[MAX_KEYS];
|
||||
unsigned char keyboardState[MAX_KEYS] = {};
|
||||
SecureZeroMemory(keyboardState, sizeof(keyboardState));
|
||||
//if (GetKeyboardState(keyboardState) == false) return;
|
||||
SHASSERT(GetKeyboardState(keyboardState), "SHInputManager:GetKeyboardState() failed ({})", GetLastError());
|
||||
bool keyboardStateGot = GetKeyboardState(keyboardState);
|
||||
SHASSERT(keyboardStateGot, "SHInputManager:GetKeyboardState() failed ({})", GetLastError());
|
||||
keyCount = 0;
|
||||
keyToggleCount = 0;
|
||||
for (size_t i = 0; i < MAX_KEYS; ++i)
|
||||
|
|
Loading…
Reference in New Issue