]> git.tdb.fi Git - libs/gui.git/blob - source/input/linux/gamecontroller_platform.h
Enumerate available game controllers
[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 protected:
22         virtual unsigned do_read(char *, unsigned);
23         virtual unsigned do_write(const char *, unsigned);
24
25 public:
26         virtual const IO::Handle &get_event_handle() { return handle; }
27 };
28
29
30 struct GameController::Private
31 {
32         JsDevice *dev;
33
34         static std::vector<std::string> detected_controllers;
35 };
36
37 } // namespace Input
38 } // namespace Msp
39
40 #endif