Sleeping Wombat GUI  0.100
swGUI
JoystickDevice.h
Go to the documentation of this file.
1 #pragma once
2 
8 #include "Device.h"
9 
10 #include "JoystickState.h"
11 #include "InputDeviceInfo.h"
12 #include "InputDeviceEvent.h"
13 
14 #include "EventQueue.h"
15 
16 #include <vector>
17 
18 
19 namespace sw {
20 namespace input
21 {
22 
23 
27 class JoystickDevice : public Device
28 {
29 private:
30 
33 
35 
36 protected:
37 public:
38  explicit JoystickDevice () = default;
39  ~JoystickDevice () = default;
40 
41 
42  const InputDeviceInfo& GetInfo () const { return m_info; }
43  const JoystickState& GetState () const { return m_state; }
44 
45  void ApplyAllEvents ();
48 
49  void RemoveEvents ();
50 
52 };
53 
54 DEFINE_OPTR_TYPE( JoystickDevice );
55 
56 
57 //====================================================================================//
58 // Inline implementation
59 //====================================================================================//
60 
61 
62 // ================================ //
63 //
65 {
66  while( !m_events.NoMoreEvents() )
67  {
68  auto& event = m_events.PopEvent();
69  //m_state.ApplyEvent( event );
70  }
71 }
72 
73 // ================================ //
74 // @todo Implement
76 {
77  m_events.PopEvent();
78  return DeviceEvent();
79 }
80 
81 // ================================ //
82 // @todo implment
84 {
85  return std::numeric_limits< Timestamp >::max();
86 }
87 
88 // ================================ //
89 //
91 {
93  m_events.ClearReadEvents();
94 }
95 
96 
97 
98 } // input
99 } // sw
100 
101 
Information about device. For future use.
Definition: InputDeviceInfo.h:14
uint16 Timestamp
Definition: InputDeviceEvent.h:19
Definition: DirectInputModule.cpp:11
EventQueue< DeviceEvent > & GetEventsQueue()
Definition: JoystickDevice.h:51
void RemoveEvents()
Definition: JoystickState.h:44
KeyStates changed events.
Definition: InputDeviceEvent.h:313
DeviceEvent ApplyNextEvent()
Definition: JoystickDevice.h:75
Interface class for input devices.
Definition: Device.h:21
const JoystickState & GetState() const
Definition: JoystickDevice.h:43
void RemoveEvents()
Definition: JoystickDevice.h:90
State of joystick device or other controllers which aren't mouse and keyboard.
Definition: JoystickState.h:19
JoystickState m_state
Definition: JoystickDevice.h:32
Timestamp GetNextEvtTimestamp()
Definition: JoystickDevice.h:83
const InputDeviceInfo & GetInfo() const
Definition: JoystickDevice.h:42
Abstraction of event queue.
Definition: EventQueue.h:26
DEFINE_OPTR_TYPE(Device)
void ApplyAllEvents()
Definition: JoystickDevice.h:64
Joystick or other controller state and events.
Definition: JoystickDevice.h:27
InputDeviceInfo m_info
Definition: JoystickDevice.h:31
EventQueue< DeviceEvent > m_events
Definition: JoystickDevice.h:34