From 3bf42c6ff3805a0d42bbc661794a95ff31bedc26 Mon Sep 17 00:00:00 2001 From: untodesu Date: Sat, 15 Mar 2025 16:22:09 +0500 Subject: Add whatever I was working on for the last month --- game/client/gamepad_button.hh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 game/client/gamepad_button.hh (limited to 'game/client/gamepad_button.hh') diff --git a/game/client/gamepad_button.hh b/game/client/gamepad_button.hh new file mode 100644 index 0000000..d8f2ed7 --- /dev/null +++ b/game/client/gamepad_button.hh @@ -0,0 +1,29 @@ +#ifndef CLIENT_GAMEPAD_BUTTON_HH +#define CLIENT_GAMEPAD_BUTTON_HH 1 +#pragma once + +#include "core/config.hh" + +struct GLFWgamepadstate; + +class ConfigGamepadButton final : public IConfigValue { +public: + explicit ConfigGamepadButton(void); + explicit ConfigGamepadButton(int button); + virtual ~ConfigGamepadButton(void) = default; + + virtual const char *get(void) const override; + virtual void set(const char *value) override; + + int get_button(void) const; + void set_button(int button); + + bool equals(int button) const; + bool is_pressed(const GLFWgamepadstate &state) const; + +private: + int m_gamepad_button; + const char *m_name; +}; + +#endif /* CLIENT_GAMEPAD_BUTTON_HH */ -- cgit