summaryrefslogtreecommitdiffstats
path: root/src/game/client/gamepad_button.hh
blob: 04b3a41635f22bf59f4079e0f97ace2da6aa7526 (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
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 */