summaryrefslogtreecommitdiffstats
path: root/game/client/config/gamepad_button.hh
blob: 584c35338e5af2a81f4f588a8f72a2caf5c0b9ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once

#include "core/config/ivalue.hh"

struct GLFWgamepadstate;

namespace config
{
class GamepadButton final : public IValue {
public:
    explicit GamepadButton(void);
    explicit GamepadButton(int button);
    virtual ~GamepadButton(void) = default;

    virtual std::string_view get(void) const override;
    virtual void set(std::string_view 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;
    std::string_view m_name;
};
} // namespace config