Free Electron
JoySDL.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __sdl_JoySDL_h__
8 #define __sdl_JoySDL_h__
9 
10 #include "window/WindowEvent.h"
11 namespace fe
12 {
13 namespace ext
14 {
15 
16 /**************************************************************************//**
17  @brief WindowEvent handler that watches for a poll event and then
18  feeds back any accumulated joystick events
19 
20  @ingroup sdl
21 *//***************************************************************************/
22 class FE_DL_EXPORT JoySDL:
23  virtual public JoyI,
24  public Initialize<JoySDL>
25 {
26  public:
27  JoySDL(void);
28 virtual ~JoySDL(void);
29 
30  void initialize(void);
31 
32  //* As HandlerI
33 virtual void handleBind(sp<SignalerI> spSignalerI, sp<Layout> spLayout);
34 virtual void handle(Record &record);
35 
36 virtual ControllerType getControllerType(I32 a_joystickIndex);
37 
38  private:
39 
40 
41  void poll(void);
42 
43  hp<SignalerI> m_hpSignalerI;
44  sp<Component> m_spContextSDL;
45 
46  Array<SDL_Joystick*> m_joysticks;
47  Array<ControllerType> m_controllerTypes;
48 
49 #if FE_SDL>1
50  Array<SDL_GameController*> m_gameControllers;
51 #endif
52 
53  WindowEvent m_event;
54  WindowEvent m_joyEvent;
55  Record m_joyRecord;
56 
57  I32 m_maxAxes;
58  I32 m_maxButtons;
59 
60  Array< Array<I32> > m_pAxisLastState; //* for debounce
61  Array< Array<I32> > m_pAxisState;
62  Array< Array<I32> > m_pButtonState;
63 };
64 
65 } /* namespace ext */
66 } /* namespace fe */
67 
68 #endif /* __sdl_JoySDL_h__ */
Joystick event generator.
Definition: JoyI.h:20
kernel
Definition: namespace.dox:3
Per-class participation in the Initialized <> mechanism.
Definition: Initialized.h:117
WindowEvent handler that watches for a poll event and then feeds back any accumulated joystick events...
Definition: JoySDL.h:22
Generalized windowing event.
Definition: WindowEvent.h:43
Wrapper for std::vector.
Definition: Array.h:21
Reference to an instance of a Layout.
Definition: RecordSB.h:35