mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2025-12-16 14:41:49 +01:00
Lmao, git removed some things :>(
This commit is contained in:
@@ -765,6 +765,26 @@ bool utils::isKeyDown(int keycode) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
static bool s_KeyStates[256] = {false};
|
||||
bool utils::isKeyPressed(int keycode) {
|
||||
const Uint8* pStates = SDL_GetKeyboardState(nullptr);
|
||||
if (pStates != nullptr) {
|
||||
if(pStates[keycode] && !s_KeyStates[keycode]) {
|
||||
s_KeyStates[keycode] = true;
|
||||
return s_KeyStates[keycode];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool utils::isKeyUp(int keycode) {
|
||||
const Uint8* pStates = SDL_GetKeyboardState(nullptr);
|
||||
if(pStates[keycode] == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool utils::isMouseDown(int button) {
|
||||
const Uint32 pStates = SDL_GetMouseState(nullptr, nullptr);
|
||||
if (pStates & SDL_BUTTON(button)) {
|
||||
|
||||
Reference in New Issue
Block a user