Rework Tile detection system

This commit is contained in:
Bram Verhulst
2024-03-28 18:53:36 +01:00
parent d441222173
commit 3b9c96ea8d
15 changed files with 252 additions and 41 deletions

View File

@@ -757,11 +757,8 @@ int utils::randRange(int min, int max) {
}
bool utils::isKeyDown(int keycode) {
const Uint8* pStates = SDL_GetKeyboardState(nullptr);
if (pStates != nullptr)
{
if(pStates[keycode]) {
return true;
}
if (pStates != nullptr) {
return pStates[keycode];
}
return false;
}
@@ -771,8 +768,10 @@ bool utils::isKeyPressed(int keycode) {
if (pStates != nullptr) {
if(pStates[keycode] && !s_KeyStates[keycode]) {
s_KeyStates[keycode] = true;
return s_KeyStates[keycode];
}else {
s_KeyStates[keycode] = false;
}
return s_KeyStates[keycode];
}
return false;
}