FreeStick  0.3
Cross Platform Open Sorce Joystick Lib
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
FSHIDAndroidJoysickDeviceManager.h
Go to the documentation of this file.
1 /**************************************************************************
2 Created by Alan Uthoff on 10/8/2013
3 Copyright (C) 2013.
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 
28 #pragma once
30 #include "FSJNI_Wrapper.h"
31 #include "common/FSTypes.h"
32 #include <jni.h>
33 namespace freestick
34 {
36  {
37  public:
39  void init(JavaVM * jvm);
40  virtual void init();
41  virtual void gamepadWasAddedFromJINBridge(int hid_id,JavaVM * jvm);
42  virtual void gamepadWasRemovedFromJINBridge(int hid_id);
43  virtual bool gamepadWasUpdatedFromJINBridge(int deviceid,int code,JNICallBackType type,float value,minMaxNumber min,minMaxNumber max);
44  void addAndroidMapping(unsigned int androidEventType,FSDeviceInput deviceInput);
45  void update();
46  private:
47  std::map<int,elementID> _androidIDToIDMap;
48  //Requires two maps since motion events and key events defines collide
49  std::map<unsigned int,FSDeviceInput > _androidButtonUsageMapToInputEvent;//KeyEvents
50  std::map<unsigned int,FSDeviceInput > _androidAxisnUsageMapToInputEvent;//MotionEvents
51 
52  JNIEnv *_jniEvn ;
53  JavaVM * _jvm;
54 
55 
56  };
57 }
virtual void gamepadWasAddedFromJINBridge(int hid_id, JavaVM *jvm)
Definition: FSHIDAndroidJoysickDeviceManager.cpp:243
void update()
Definition: FSHIDAndroidJoysickDeviceManager.cpp:272
virtual void init()
Definition: FSHIDAndroidJoysickDeviceManager.cpp:112
JNICallBackType
Definition: FSJNI_Wrapper.h:35
virtual void gamepadWasRemovedFromJINBridge(int hid_id)
Definition: FSHIDAndroidJoysickDeviceManager.cpp:254
void addAndroidMapping(unsigned int androidEventType, FSDeviceInput deviceInput)
Definition: FSHIDAndroidJoysickDeviceManager.cpp:52
virtual bool gamepadWasUpdatedFromJINBridge(int deviceid, int code, JNICallBackType type, float value, minMaxNumber min, minMaxNumber max)
Definition: FSHIDAndroidJoysickDeviceManager.cpp:121
Definition: FSHIDAndroidJoysickDeviceManager.h:35
Definition: FSBaseDevice.h:32
FSHIDAndroidJoysickDeviceManager()
Definition: FSHIDAndroidJoysickDeviceManager.cpp:64
Definition: FSUSBJoystickDeviceManager.h:34
FSDeviceInput
Definition: IFSDevice.h:31
int32_t minMaxNumber
Definition: FSTypes.h:34