summaryrefslogtreecommitdiffstats
path: root/src/game/client/gamepad_button.cc
diff options
context:
space:
mode:
authoruntodesu <kirill@untode.su>2025-07-01 03:08:39 +0500
committeruntodesu <kirill@untode.su>2025-07-01 03:08:39 +0500
commit458e0005690ea9d579588a0a12368fc2c2c9a93a (patch)
tree588a9ca6cb3c76d9193b5bd4601d64f0e50e8c8c /src/game/client/gamepad_button.cc
parentc7b0c8e0286a1b2bb7ec55e579137dfc3b22eeb9 (diff)
downloadvoxelius-458e0005690ea9d579588a0a12368fc2c2c9a93a.tar.bz2
voxelius-458e0005690ea9d579588a0a12368fc2c2c9a93a.zip
I hyper-focued on refactoring again
- I put a cool-sounding "we are number one" remix on repeat and straight up grinded the entire repository to a better state until 03:09 AM. I guess I have something wrong in my brain that makes me do this shit
Diffstat (limited to 'src/game/client/gamepad_button.cc')
-rw-r--r--src/game/client/gamepad_button.cc90
1 files changed, 0 insertions, 90 deletions
diff --git a/src/game/client/gamepad_button.cc b/src/game/client/gamepad_button.cc
deleted file mode 100644
index dd3dca7..0000000
--- a/src/game/client/gamepad_button.cc
+++ /dev/null
@@ -1,90 +0,0 @@
-#include "client/pch.hh"
-
-#include "client/gamepad_button.hh"
-
-#include "core/constexpr.hh"
-
-#include "client/gamepad.hh"
-
-constexpr static const char* UNKNOWN_BUTTON_NAME = "UNKNOWN";
-
-static const std::pair<int, const char*> button_names[] = {
- { GLFW_GAMEPAD_BUTTON_A, "A" },
- { GLFW_GAMEPAD_BUTTON_B, "B" },
- { GLFW_GAMEPAD_BUTTON_X, "X" },
- { GLFW_GAMEPAD_BUTTON_Y, "Y" },
- { GLFW_GAMEPAD_BUTTON_LEFT_BUMPER, "L_BUMP" },
- { GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER, "R_BUMP" },
- { GLFW_GAMEPAD_BUTTON_BACK, "BACK" },
- { GLFW_GAMEPAD_BUTTON_START, "START" },
- { GLFW_GAMEPAD_BUTTON_GUIDE, "GUIDE" },
- { GLFW_GAMEPAD_BUTTON_LEFT_THUMB, "L_THUMB" },
- { GLFW_GAMEPAD_BUTTON_RIGHT_THUMB, "R_THUMB" },
- { GLFW_GAMEPAD_BUTTON_DPAD_UP, "DPAD_UP" },
- { GLFW_GAMEPAD_BUTTON_DPAD_RIGHT, "DPAD_RIGHT" },
- { GLFW_GAMEPAD_BUTTON_DPAD_DOWN, "DPAD_DOWN" },
- { GLFW_GAMEPAD_BUTTON_DPAD_LEFT, "DPAD_LEFT" },
-};
-
-static const char* get_button_name(int button)
-{
- for(const auto& it : button_names) {
- if(it.first == button) {
- return it.second;
- }
- }
-
- return UNKNOWN_BUTTON_NAME;
-}
-
-ConfigGamepadButton::ConfigGamepadButton(void)
-{
- m_gamepad_button = INVALID_GAMEPAD_BUTTON;
- m_name = UNKNOWN_BUTTON_NAME;
-}
-
-ConfigGamepadButton::ConfigGamepadButton(int button)
-{
- m_gamepad_button = button;
- m_name = get_button_name(button);
-}
-
-const char* ConfigGamepadButton::get(void) const
-{
- return m_name;
-}
-
-void ConfigGamepadButton::set(const char* value)
-{
- for(const auto& it : button_names) {
- if(!std::strcmp(it.second, value)) {
- m_gamepad_button = it.first;
- m_name = it.second;
- return;
- }
- }
-
- m_gamepad_button = INVALID_GAMEPAD_BUTTON;
- m_name = UNKNOWN_BUTTON_NAME;
-}
-
-int ConfigGamepadButton::get_button(void) const
-{
- return m_gamepad_button;
-}
-
-void ConfigGamepadButton::set_button(int button)
-{
- m_gamepad_button = button;
- m_name = get_button_name(button);
-}
-
-bool ConfigGamepadButton::equals(int button) const
-{
- return m_gamepad_button == button;
-}
-
-bool ConfigGamepadButton::is_pressed(const GLFWgamepadstate& state) const
-{
- return m_gamepad_button < vx::array_size(state.buttons) && state.buttons[m_gamepad_button] == GLFW_PRESS;
-}