aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--terminal-game-utils.hpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/terminal-game-utils.hpp b/terminal-game-utils.hpp
index 328ff63..189a7de 100644
--- a/terminal-game-utils.hpp
+++ b/terminal-game-utils.hpp
@@ -1,3 +1,4 @@
+#include <format>
#include <iostream>
#include <map>
#include <ostream>
@@ -146,10 +147,9 @@ inline GameKey GetKeyPress() {
keypress_string += c;
}
- if (KeyMap.count(keypress_string))
+ if (KeyMap.find(keypress_string) != KeyMap.end())
return KeyMap[keypress_string];
-
- return KeyMap[keypress_string];
+ return GameKey::INVALID;
}
// Text printers:
@@ -185,6 +185,6 @@ inline void EnterGameBuffer() { std::cout << "\033[?1049h"; }
inline void LeaveGameBuffer() { std::cout << "\033[?1049l"; }
inline void MoveCursor(int row, int col) {
- std::cout << "\033[" << row << ";" << col << "H" << std::flush;
+ std::cout << "\033[" << (row + 1) << ";" << (col + 1) << "H" << std::flush;
}
}; // namespace tgu