Actually Fixed IsKeyDown

This commit is contained in:
2024-12-06 11:54:19 -05:00
parent a3adbb6266
commit fa807256af
2 changed files with 8 additions and 4 deletions

View File

@@ -54,6 +54,10 @@ class MyWindow : public ReWindow::RWindow {
if (IsMouseButtonDown(MouseButtons::Mouse5))
std::cout << "Mouse5 Mouse Button" << std::endl;
if (IsKeyDown(Keys::N))
std::cout << "Gotteem" << std::endl;
RWindow::OnRefresh(elapsed);
}

View File

@@ -141,10 +141,10 @@ void RWindow::SetSize(const Vector2& size) {
}
bool RWindow::IsKeyDown(Key key) const {
for (const auto& pair : currentKeyboard.PressedKeys)
if (pair.first == key && pair.second)
return true;
return false;
if (currentKeyboard.PressedKeys.contains(key))
return currentKeyboard.PressedKeys.at(key);
return false; // NOTE: Key may not be mapped!!
}
bool RWindow::IsMouseButtonDown(const MouseButton &button) const {