Sleeping Wombat GUI  0.100
swGUI
DirectInputModule.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "IncludeDirectInput.h"
5 
6 #include <vector>
7 
8 
9 
10 namespace sw {
11 namespace input
12 {
13 
14 
15 
28 class DirectInputModule : public IInput
29 {
30 private:
31 
33 
34  LPDIRECTINPUT8 m_directInput;
35  LPDIRECTINPUTDEVICE8 m_keyboardInput;
36  LPDIRECTINPUTDEVICE8 m_mouseInput;
37 
38  std::vector< const KeyboardState* > m_keyboardsStates;
39  std::vector< const MouseState* > m_mousesStates;
40  std::vector< const JoystickState* > m_joysticksStates;
41 
42  std::vector< KeyboardDeviceOPtr > m_keyboards;
43  std::vector< MouseDeviceOPtr > m_mouses;
44  std::vector< JoystickDeviceOPtr > m_joysticks;
45 
46 public:
47  explicit DirectInputModule ();
48  virtual ~DirectInputModule ();
49 
50  virtual bool Init ( const InputInitInfo& initInfo ) override;
51 
52  virtual const std::vector< const KeyboardState* >& GetKeyboardStates () const override;
53  virtual const std::vector< const MouseState* >& GetMouseStates () const override;
54  virtual const std::vector< const JoystickState* >& GetJoystickStates () const override;
55 
56  virtual std::vector< KeyboardDeviceOPtr >& GetKeyboardDevice () override;
57  virtual std::vector< MouseDeviceOPtr >& GetMouseDevice () override;
58  virtual std::vector< JoystickDeviceOPtr >& GetJoystickDevice () override;
59 
60  virtual std::vector< const InputDeviceInfo* > GetDevicesInfo () const override;
61 
62  virtual void Update ( float timeInterval ) override;
63  virtual bool UpdateDevices () override;
64 
65 private:
66 
67  void CleanDirectInput ();
68 
69  void UpdateKeyboard ( int idx );
70  void UpdateMouse ( int idx );
71  void UpdateJoystick ( int idx );
72 };
73 
74 
75 } // input
76 } // sw
LPDIRECTINPUT8 m_directInput
Definition: DirectInputModule.h:34
virtual const std::vector< const KeyboardState * > & GetKeyboardStates() const override
Definition: DirectInputModule.cpp:83
void UpdateJoystick(int idx)
Definition: DirectInputModule.cpp:195
void CleanDirectInput()
Zwalania zasoby DirectInputa.
Definition: DirectInputModule.cpp:207
virtual std::vector< const InputDeviceInfo * > GetDevicesInfo() const override
Definition: DirectInputModule.cpp:119
Definition: DirectInputModule.cpp:11
HWND m_windowHandle
Definition: DirectInputModule.h:32
virtual ~DirectInputModule()
Definition: DirectInputModule.cpp:31
virtual std::vector< JoystickDeviceOPtr > & GetJoystickDevice() override
Definition: DirectInputModule.cpp:113
void UpdateMouse(int idx)
Definition: DirectInputModule.cpp:176
virtual const std::vector< const MouseState * > & GetMouseStates() const override
Definition: DirectInputModule.cpp:89
virtual bool UpdateDevices() override
Funkcja na nowo sprawdza obecne w systemie urządzenia i aktualizuje wszystkie potrzebne dane...
Definition: DirectInputModule.cpp:200
std::vector< JoystickDeviceOPtr > m_joysticks
Only first element is in use now.
Definition: DirectInputModule.h:44
Klasa obsługująca wejście użytkownika.
Definition: DirectInputModule.h:28
void UpdateKeyboard(int idx)
Definition: DirectInputModule.cpp:162
Initialization structure for input objects.
Definition: IInput.h:45
std::vector< KeyboardDeviceOPtr > m_keyboards
Only first element is in use now.
Definition: DirectInputModule.h:42
virtual std::vector< MouseDeviceOPtr > & GetMouseDevice() override
Definition: DirectInputModule.cpp:107
virtual void Update(float timeInterval) override
Definition: DirectInputModule.cpp:133
LPDIRECTINPUTDEVICE8 m_keyboardInput
Definition: DirectInputModule.h:35
virtual const std::vector< const JoystickState * > & GetJoystickStates() const override
Definition: DirectInputModule.cpp:95
std::vector< const KeyboardState * > m_keyboardsStates
Copy of device state in m_keyboards.
Definition: DirectInputModule.h:38
std::vector< const MouseState * > m_mousesStates
Copy of device state in m_mouses.
Definition: DirectInputModule.h:39
virtual bool Init(const InputInitInfo &initInfo) override
Inicjalizuje cały moduł. Po wywołaniu tej funkcji moduł musi być gotowy do użytku w innym przypadku p...
Definition: DirectInputModule.cpp:35
std::vector< const JoystickState * > m_joysticksStates
Copy of device state in m_joysticks.
Definition: DirectInputModule.h:40
Interface for input classes for capturing user input.
Definition: IInput.h:65
virtual std::vector< KeyboardDeviceOPtr > & GetKeyboardDevice() override
Definition: DirectInputModule.cpp:101
std::vector< MouseDeviceOPtr > m_mouses
Only first element is in use now.
Definition: DirectInputModule.h:43
LPDIRECTINPUTDEVICE8 m_mouseInput
Definition: DirectInputModule.h:36
DirectInputModule()
Definition: DirectInputModule.cpp:20