FreeStick  0.3
Cross Platform Open Sorce Joystick Lib
IFSDevice.h
Go to the documentation of this file.
1 /**************************************************************************
2 Created by Alan Uthoff on 10/13/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
29 #include "common/FSTypes.h"
30 namespace freestick {
31  typedef enum
32  {
33  XAxis,//Left
34  YAxis,//Left
35  XAxis2,//Right
36  YAxis2,//Right
45  //use the HTML standard https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html excpet for button 12-15
46  Button0,//A
48  Button1,//B
50  Button2,//X
52  Button3,//Y
58  Button6,//Left digital shoulder button L2
60  Button7,//Right digital sholder button R
62  Button8,//Select/back
64  Button9,//Start
66  Button10,//L3
68  Button11,//R3
75  ButtonCenter,//example xbox button
85  Trigger1,//Left
86  Trigger2,//Right
89  LastValueUp, //use to return and event of released on the last value for the device controll (used a lot in hatswitch)
92  } FSDeviceInput;
93 
94  #define FS_isInputBetween(inputType,min,max) inputType >= min && inputType < max ? true : false
95  #define FS_isButtion(inputType) FS_isInputBetween(inputType,Button0,LastButton)
96  #define FS_isDpad(inputType) FS_isInputBetween(inputType,DPadUp,LastDPad)
97  #define FS_isAxis(inputType) FS_isInputBetween(inputType,XAxis,LastAxis)
98  #define FS_isTrigger(inputType) FS_isInputBetween(inputType,Trigger1,LastTrigger)
99 
100  typedef enum
101  {
109 
110  } FSDeviceType;
111  class IFSDevice
112  {
113  protected:
115  virtual ~IFSDevice(){}
116  private:
117 
118  public:
119  virtual idNumber getJoystickID() const= 0;
120  virtual FSDeviceType getClassType() const = 0;
121  };
122 }
Definition: IFSDevice.h:33
Definition: IFSDevice.h:86
Definition: IFSDevice.h:74
Definition: IFSDevice.h:91
Definition: IFSDevice.h:111
Definition: IFSDevice.h:62
IFSDevice()
Definition: IFSDevice.h:114
Definition: IFSDevice.h:80
Definition: IFSDevice.h:104
Definition: IFSDevice.h:89
Definition: IFSDevice.h:63
Definition: IFSDevice.h:87
Definition: IFSDevice.h:51
virtual ~IFSDevice()
Definition: IFSDevice.h:115
virtual FSDeviceType getClassType() const =0
Definition: IFSDevice.h:56
Definition: IFSDevice.h:106
Definition: IFSDevice.h:49
Definition: IFSDevice.h:107
Definition: IFSDevice.h:83
Definition: IFSDevice.h:77
virtual idNumber getJoystickID() const =0
Definition: IFSDevice.h:75
Definition: IFSDevice.h:53
Definition: IFSDevice.h:37
Definition: IFSDevice.h:46
Definition: IFSDevice.h:38
uint32_t idNumber
Definition: FSTypes.h:33
Definition: IFSDevice.h:85
Definition: IFSDevice.h:69
Definition: IFSDevice.h:81
Definition: IFSDevice.h:66
Definition: IFSDevice.h:64
Definition: IFSDevice.h:60
Definition: IFSDevice.h:48
Definition: IFSDevice.h:52
Definition: IFSDevice.h:44
Definition: IFSDevice.h:39
Definition: IFSDevice.h:84
Definition: IFSDevice.h:79
Definition: IFSDevice.h:55
Definition: IFSDevice.h:71
Definition: IFSDevice.h:103
Definition: FSBaseDevice.h:32
Definition: IFSDevice.h:54
Definition: IFSDevice.h:82
Definition: IFSDevice.h:47
FSDeviceType
Definition: IFSDevice.h:100
Definition: IFSDevice.h:73
Definition: IFSDevice.h:90
Definition: IFSDevice.h:36
Definition: IFSDevice.h:34
Definition: IFSDevice.h:78
Definition: IFSDevice.h:58
Definition: IFSDevice.h:40
Definition: IFSDevice.h:57
Definition: IFSDevice.h:43
Definition: IFSDevice.h:65
Definition: IFSDevice.h:102
Definition: IFSDevice.h:88
Definition: IFSDevice.h:72
Definition: IFSDevice.h:68
Definition: IFSDevice.h:41
Definition: IFSDevice.h:76
Definition: IFSDevice.h:61
Definition: IFSDevice.h:108
Definition: IFSDevice.h:50
Definition: IFSDevice.h:59
Definition: IFSDevice.h:70
Definition: IFSDevice.h:42
Definition: IFSDevice.h:105
FSDeviceInput
Definition: IFSDevice.h:31
Definition: IFSDevice.h:35
Definition: IFSDevice.h:67