summaryrefslogtreecommitdiffstats
path: root/game/client/config/gamepad_button.cc
diff options
context:
space:
mode:
authoruntodesu <kirill@untode.su>2025-09-11 15:48:53 +0500
committeruntodesu <kirill@untode.su>2025-09-11 15:48:53 +0500
commitd0fbd68055e3f4a796330cc8acc6c0954b5327ff (patch)
treee581014ea02711efa5e71f00f9862e5bca58f2ed /game/client/config/gamepad_button.cc
parentcbd823aa2154a956e7da4319eecbf7afc10441ae (diff)
downloadvoxelius-d0fbd68055e3f4a796330cc8acc6c0954b5327ff.tar.bz2
voxelius-d0fbd68055e3f4a796330cc8acc6c0954b5327ff.zip
Run clang-format across the project
Diffstat (limited to 'game/client/config/gamepad_button.cc')
-rw-r--r--game/client/config/gamepad_button.cc180
1 files changed, 90 insertions, 90 deletions
diff --git a/game/client/config/gamepad_button.cc b/game/client/config/gamepad_button.cc
index 07e4457..5141de3 100644
--- a/game/client/config/gamepad_button.cc
+++ b/game/client/config/gamepad_button.cc
@@ -1,90 +1,90 @@
-#include "client/pch.hh"
-
-#include "client/config/gamepad_button.hh"
-
-#include "core/math/constexpr.hh"
-
-#include "client/io/gamepad.hh"
-
-constexpr static std::string_view UNKNOWN_BUTTON_NAME = "UNKNOWN";
-
-static const std::pair<int, std::string_view> 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 std::string_view get_button_name(int button)
-{
- for(const auto& it : button_names) {
- if(it.first == button) {
- return it.second;
- }
- }
-
- return UNKNOWN_BUTTON_NAME;
-}
-
-config::GamepadButton::GamepadButton(void)
-{
- m_gamepad_button = io::INVALID_GAMEPAD_BUTTON;
- m_name = UNKNOWN_BUTTON_NAME;
-}
-
-config::GamepadButton::GamepadButton(int button)
-{
- m_gamepad_button = button;
- m_name = get_button_name(button);
-}
-
-std::string_view config::GamepadButton::get(void) const
-{
- return m_name;
-}
-
-void config::GamepadButton::set(std::string_view value)
-{
- for(const auto& it : button_names) {
- if(0 == it.second.compare(value)) {
- m_gamepad_button = it.first;
- m_name = it.second;
- return;
- }
- }
-
- m_gamepad_button = io::INVALID_GAMEPAD_BUTTON;
- m_name = UNKNOWN_BUTTON_NAME;
-}
-
-int config::GamepadButton::get_button(void) const
-{
- return m_gamepad_button;
-}
-
-void config::GamepadButton::set_button(int button)
-{
- m_gamepad_button = button;
- m_name = get_button_name(button);
-}
-
-bool config::GamepadButton::equals(int button) const
-{
- return m_gamepad_button == button;
-}
-
-bool config::GamepadButton::is_pressed(const GLFWgamepadstate& state) const
-{
- return m_gamepad_button < math::array_size(state.buttons) && state.buttons[m_gamepad_button] == GLFW_PRESS;
-}
+#include "client/pch.hh"
+
+#include "client/config/gamepad_button.hh"
+
+#include "core/math/constexpr.hh"
+
+#include "client/io/gamepad.hh"
+
+constexpr static std::string_view UNKNOWN_BUTTON_NAME = "UNKNOWN";
+
+static const std::pair<int, std::string_view> 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 std::string_view get_button_name(int button)
+{
+ for(const auto& it : button_names) {
+ if(it.first == button) {
+ return it.second;
+ }
+ }
+
+ return UNKNOWN_BUTTON_NAME;
+}
+
+config::GamepadButton::GamepadButton(void)
+{
+ m_gamepad_button = io::INVALID_GAMEPAD_BUTTON;
+ m_name = UNKNOWN_BUTTON_NAME;
+}
+
+config::GamepadButton::GamepadButton(int button)
+{
+ m_gamepad_button = button;
+ m_name = get_button_name(button);
+}
+
+std::string_view config::GamepadButton::get(void) const
+{
+ return m_name;
+}
+
+void config::GamepadButton::set(std::string_view value)
+{
+ for(const auto& it : button_names) {
+ if(0 == it.second.compare(value)) {
+ m_gamepad_button = it.first;
+ m_name = it.second;
+ return;
+ }
+ }
+
+ m_gamepad_button = io::INVALID_GAMEPAD_BUTTON;
+ m_name = UNKNOWN_BUTTON_NAME;
+}
+
+int config::GamepadButton::get_button(void) const
+{
+ return m_gamepad_button;
+}
+
+void config::GamepadButton::set_button(int button)
+{
+ m_gamepad_button = button;
+ m_name = get_button_name(button);
+}
+
+bool config::GamepadButton::equals(int button) const
+{
+ return m_gamepad_button == button;
+}
+
+bool config::GamepadButton::is_pressed(const GLFWgamepadstate& state) const
+{
+ return m_gamepad_button < math::array_size(state.buttons) && state.buttons[m_gamepad_button] == GLFW_PRESS;
+}