FreeStick  0.3
Cross Platform Open Sorce Joystick Lib
FSMFIJoystickManager.h
Go to the documentation of this file.
1 /**************************************************************************
2  Created by Alan Uthoff on 10/8/2013
3  Copyright (C) 2019.
4 
5  This Code is free software; you can redistribute it and/or
6  modify it under the terms of the zlib/libpng License as published
7  by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9  This software is provided 'as-is', without any express or implied warranty.
10 
11  In no event will the authors be held liable for any damages arising from the use of this software.
12 
13  Permission is granted to anyone to use this software for any purpose,
14  including commercial applications, and to alter it and redistribute
15  it freely, subject to the following restrictions:
16 
17  1. The origin of this software must not be misrepresented;
18  you must not claim that you wrote the original software.
19  If you use this software in a product, an acknowledgment
20  in the product documentation would be appreciated but is not required.
21 
22  2. Altered source versions must be plainly marked as such,
23  and must not be misrepresented as being the original software.
24 
25  3. This notice may not be removed or altered from any source distribution.
26 */
27 #pragma once
29 #include <map>
30 #include <vector>
31 //#import <GameController/GCController.h>
32 namespace freestick
33 {
34 typedef int mfiID;
36  {
37  public:
40  virtual void init( );
41  const FSUSBJoystick * getUSBJoystickDevice(idNumber deviceID){return static_cast<const FSUSBJoystick *>(FSUSBDeviceManager::getDevice(deviceID));}
42 
43  protected:
44  void updateJoystickButtons(idNumber joyStickID, idNumber elementID, bool pressed,float value);
45  void updateJoystickAnalog(idNumber joyStickID,idNumber elementID,float value);
47  void addMFIDevice(void * controller);
48  void removeMFIDevice(void * device);
49 
50  // void updateControllers();
51  void connectControlesToController(void * contorller,idNumber joyStickID);
52  // uint64_t contorllerIDs = 0;
53  std::vector<mfiID> _connectedLastUpdateJoysticks;
54  std::map<void *,unsigned int> _wordToIDControllerMap;
55  };
56 }
void addMFIDevice(void *controller)
Definition: FSMFIJoystickManager.mm:92
void connectControlesToController(void *contorller, idNumber joyStickID)
Definition: FSMFIJoystickManager.mm:181
std::map< void *, unsigned int > _wordToIDControllerMap
Definition: FSMFIJoystickManager.h:54
virtual void init()
Definition: FSMFIJoystickManager.mm:53
FSMFIJoystickDeviceManager()
Definition: FSMFIJoystickManager.mm:13
virtual const FSBaseDevice * getDevice(idNumber deviceID)
Definition: FSBaseManager.cpp:72
int mfiID
Definition: FSMFIJoystickManager.h:34
uint32_t idNumber
Definition: FSTypes.h:33
void updateJoystickAnalog(idNumber joyStickID, idNumber elementID, float value)
Definition: FSMFIJoystickManager.mm:166
void removeMFIDevice(void *device)
Definition: FSMFIJoystickManager.mm:76
Definition: FSBaseDevice.h:32
const FSUSBJoystick * getUSBJoystickDevice(idNumber deviceID)
Definition: FSMFIJoystickManager.h:41
Definition: FSUSBJoystick.h:36
uint64_t deviceID
Definition: FSTypes.h:37
std::vector< mfiID > _connectedLastUpdateJoysticks
Definition: FSMFIJoystickManager.h:53
Definition: FSMFIJoystickManager.h:35
void updateJoystickButtons(idNumber joyStickID, idNumber elementID, bool pressed, float value)
Definition: FSMFIJoystickManager.mm:129
Definition: FSUpdatableJoystickDeviceManager.h:32
unsigned int elementID
Definition: FSTypes.h:36
virtual ~FSMFIJoystickDeviceManager()
Definition: FSMFIJoystickManager.mm:49