22 #ifndef FIFE_EVENTCHANNEL_JOYSTICKMANAGER_H 23 #define FIFE_EVENTCHANNEL_JOYSTICKMANAGER_H 88 void saveMapping(
const std::string guid,
const std::string& file);
void addJoystickListener(IJoystickListener *listener)
Adds a listener to the back of the listener deque Listener will be notified via the corresponding eve...
JoystickManager()
Constructor.
virtual ~JoystickManager()
Destructor.
void removeJoystick(Joystick *joystick)
Removes the given joystick, can be reused.
void processJoystickEvent(SDL_Event event)
Creates and process joystick events.
ControllerMappingLoader m_mappingLoader
Loader for gamecontroller mapping.
uint8_t getJoystickCount() const
Return the number of joysticks / gamecontrollers.
float convertRange(int16_t value)
Converts the int16 in -1.0 to 1.0 range.
void removeControllerGuid(Joystick *joystick)
Removes / decal controller GUID.
std::map< std::string, uint8_t > m_gamepadGuids
Each sort of gamepad have a GUID from SDL. Indicates the number of gamepads with given GUID are conne...
void setStringMapping(const std::string &mapping)
Sets controller mapping from string and adds or updates the related controllers.
std::vector< Joystick * > m_joysticks
All "known" Joysticks. Useful if a user reconnect a Joystick.
Listener of joystick events.
std::vector< Joystick * > m_activeJoysticks
All active / connected Joysticks.
Represents a Joystick and if available the Gamecontroller.
Controller provides a way to receive events from the system Using this interface, clients can subscri...
void addControllerGuid(Joystick *joystick)
Adds GUID from controller.
std::map< int32_t, uint32_t > m_joystickIndices
Map to hold the relation between Joystick InstanceId and JoystickId.
void dispatchJoystickEvent(JoystickEvent &evt)
Dispatches joystick / controller events.
ControllerMappingSaver m_mappingSaver
Saver for gamecontroller mapping.
Joystick Manager manages all events related to Joysticks and Gamecontrollers.
void saveMapping(const std::string guid, const std::string &file)
Saves controller mapping for given GUID in the specified file.
void processControllerEvent(SDL_Event event)
Creates and process gamecontroller events.
std::string getGuidString(int32_t deviceIndex)
Return GUID for given device index as string.
Joystick * getJoystick(int32_t instanceId)
Return the joystick with the given instance id.
void loadMapping(const std::string &file)
Loads controller mappings from given file and if possible, it opens the related controllers.
void addJoystickListenerFront(IJoystickListener *listener)
Adds a listener to the front of the listener deque Listener will be notified via the corresponding ev...
Class for Joystick events.
std::string getStringMapping(const std::string &guid)
Return the controller mapping for given GUID as string.
void removeJoystickListener(IJoystickListener *listener)
Removes an added listener from the controller.
Joystick * addJoystick(int32_t deviceIndex)
Adds a joystick with the given device index.
void saveMappings(const std::string &file)
Saves all controller mappings that were used during the season.
EventSourceType
Types for different event sources.
Representation of event source (a thing sending events)
std::deque< IJoystickListener * > m_joystickListeners
The Joystick listeners.
EventSourceType getEventSourceType()
Gets the source type of this event.