Sleeping Wombat GUI  0.100
swGUI
WinApiInputProxy.h
Go to the documentation of this file.
1 #pragma once
2 
10 
14 
15 
16 #include <Windows.h>
17 
18 
19 
20 namespace sw {
21 namespace input
22 {
23 
31 class WinApiInputProxy : public IInput
32 {
33 private:
34 
35  std::vector< const KeyboardState* > m_keyboardsStates;
36  std::vector< const MouseState* > m_mousesStates;
37  std::vector< const JoystickState* > m_joysticksStates;
38 
39  std::vector< KeyboardDeviceOPtr > m_keyboards;
40  std::vector< MouseDeviceOPtr > m_mouses;
41  std::vector< JoystickDeviceOPtr > m_joysticks;
42 
45 
47 
48 public:
51 
52  virtual bool Init ( const InputInitInfo& initInfo ) override;
53 
54  virtual const std::vector< const KeyboardState* >& GetKeyboardStates () const override;
55  virtual const std::vector< const MouseState* >& GetMouseStates () const override;
56  virtual const std::vector< const JoystickState* >& GetJoystickStates () const override;
57 
58  virtual std::vector< KeyboardDeviceOPtr >& GetKeyboardDevice () override;
59  virtual std::vector< MouseDeviceOPtr >& GetMouseDevice () override;
60  virtual std::vector< JoystickDeviceOPtr >& GetJoystickDevice () override;
61 
62  virtual std::vector< const InputDeviceInfo* > GetDevicesInfo () const override;
63 
64  virtual void Update ( float timeInterval ) override;
65  virtual bool UpdateDevices () override;
66 
67 public:
70  void KeyboardChange ( int keyId, bool pressed );
71  void KeyboardCharacter ( wchar_t character );
72  void MouseButtonChange ( int button, bool pressed );
73  void MousePositionChange ( short X, short Y );
74  void MouseWheelChange ( double delta );
75 
76  void LostFocus ();
77 
78  void HandleEvent ( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam );
80 };
81 
82 
83 
84 } // input
85 } // sw
86 
void MousePositionChange(short X, short Y)
Ustawia nową pozycję myszy.
Definition: WinApiInputProxy.cpp:291
uint16_t uint16
Definition: TypesDefinitions.h:29
virtual const std::vector< const MouseState * > & GetMouseStates() const override
Definition: WinApiInputProxy.cpp:44
virtual std::vector< const InputDeviceInfo * > GetDevicesInfo() const override
Definition: WinApiInputProxy.cpp:75
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: WinApiInputProxy.cpp:23
uint16 Timestamp
Definition: InputDeviceEvent.h:19
void KeyboardChange(int keyId, bool pressed)
Ustawia nowy stan przycisku na klawiaturze.
Definition: WinApiInputProxy.cpp:257
Klasa do przekierowywania do silnika wejścia pobranego z WPFa.
Definition: WinApiInputProxy.h:31
std::vector< const MouseState * > m_mousesStates
Copy of device state in m_mouses.
Definition: WinApiInputProxy.h:36
Definition: DirectInputModule.cpp:11
void MouseButtonChange(int button, bool pressed)
Ustawia nowy stan przycisku myszy.
Definition: WinApiInputProxy.cpp:281
void HandleEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Funkcja uzupełnia stan klasy bezpośrednio na podstawie komunikatów z WinAPI.
Definition: WinApiInputProxy.cpp:340
std::vector< JoystickDeviceOPtr > m_joysticks
Only first element is in use now.
Definition: WinApiInputProxy.h:41
std::vector< const KeyboardState * > m_keyboardsStates
Copy of device state in m_keyboards.
Definition: WinApiInputProxy.h:35
uint16 m_lastX
Definition: WinApiInputProxy.h:43
Initialization structure for input objects.
Definition: IInput.h:45
void LostFocus()
Ponieważ okno straciło focus to czyścimy stan przycisków i myszy.
Definition: WinApiInputProxy.cpp:332
~WinApiInputProxy()
Definition: WinApiInputProxy.cpp:19
uint16 m_lastY
Definition: WinApiInputProxy.h:44
virtual void Update(float timeInterval) override
Definition: WinApiInputProxy.cpp:93
void KeyboardCharacter(wchar_t character)
Definition: WinApiInputProxy.cpp:268
virtual std::vector< KeyboardDeviceOPtr > & GetKeyboardDevice() override
Definition: WinApiInputProxy.cpp:56
virtual const std::vector< const KeyboardState * > & GetKeyboardStates() const override
Definition: WinApiInputProxy.cpp:38
std::vector< const JoystickState * > m_joysticksStates
Copy of device state in m_joysticks.
Definition: WinApiInputProxy.h:37
virtual std::vector< JoystickDeviceOPtr > & GetJoystickDevice() override
Definition: WinApiInputProxy.cpp:68
virtual bool UpdateDevices() override
Funkcja na nowo sprawdza obecne w systemie urządzenia i aktualizuje wszystkie potrzebne dane...
Definition: WinApiInputProxy.cpp:107
Timestamp m_eventNum
Number of event in current frame.
Definition: WinApiInputProxy.h:46
void MouseWheelChange(double delta)
Ustawia przesunięcie kółka myszy.
Definition: WinApiInputProxy.cpp:320
virtual std::vector< MouseDeviceOPtr > & GetMouseDevice() override
Definition: WinApiInputProxy.cpp:62
std::vector< KeyboardDeviceOPtr > m_keyboards
Only first element is in use now.
Definition: WinApiInputProxy.h:39
Interface for input classes for capturing user input.
Definition: IInput.h:65
std::vector< MouseDeviceOPtr > m_mouses
Only first element is in use now.
Definition: WinApiInputProxy.h:40
WinApiInputProxy()
Definition: WinApiInputProxy.cpp:12
virtual const std::vector< const JoystickState * > & GetJoystickStates() const override
Definition: WinApiInputProxy.cpp:50