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