]> git.tdb.fi Git - libs/gui.git/blob - source/input/linux/gamecontroller_platform.h
Update .gitignore to include build products on Windows
[libs/gui.git] / source / input / linux / gamecontroller_platform.h
1 #ifndef MSP_INPUT_GAMECONTROLLER_PLATFORM_H_
2 #define MSP_INPUT_GAMECONTROLLER_PLATFORM_H_
3
4 #include <msp/io/eventobject.h>
5 #include <msp/io/handle.h>
6
7 namespace Msp {
8 namespace Input {
9
10 class JsDevice: public IO::EventObject
11 {
12 private:
13         IO::Handle handle;
14
15 public:
16         JsDevice(const std::string &);
17         ~JsDevice();
18
19         std::string get_name() const;
20
21         void set_block(bool) override { }
22         void set_inherit(bool) override { }
23
24 protected:
25         std::size_t do_read(char *, std::size_t) override;
26         std::size_t do_write(const char *, std::size_t) override;
27
28 public:
29         const IO::Handle &get_handle(IO::Mode) override { return handle; }
30         const IO::Handle &get_event_handle() override { return handle; }
31 };
32
33
34 struct GameController::Private
35 {
36         JsDevice *dev = nullptr;
37
38         static std::vector<std::string> detected_controllers;
39 };
40
41 } // namespace Input
42 } // namespace Msp
43
44 #endif