ruby-ois 0.0.1-x86-linux
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +37 -0
- data/Rakefile +56 -0
- data/bindings/ois/interface/OIS_Effect.i +8 -0
- data/bindings/ois/interface/OIS_Event.i +8 -0
- data/bindings/ois/interface/OIS_Exception.i +8 -0
- data/bindings/ois/interface/OIS_FactoryCreator.i +8 -0
- data/bindings/ois/interface/OIS_ForceFeedback.i +8 -0
- data/bindings/ois/interface/OIS_InputManager.i +20 -0
- data/bindings/ois/interface/OIS_Interface.i +8 -0
- data/bindings/ois/interface/OIS_JoyStick.i +8 -0
- data/bindings/ois/interface/OIS_Keyboard.i +15 -0
- data/bindings/ois/interface/OIS_Mouse.i +10 -0
- data/bindings/ois/interface/OIS_Object.i +22 -0
- data/bindings/ois/interface/OIS_Prereqs.i +20 -0
- data/bindings/ois/interface/Rakefile +19 -0
- data/bindings/ois/interface/ois.i +3 -0
- data/bindings/ois/interface/ois_all.i +23 -0
- data/bindings/ois/interface/ois_wrap.cpp +19311 -0
- data/bindings/ois/interface/ois_wrap.h +40 -0
- data/bindings/ois/interface/ois_wrap.o +0 -0
- data/deps/include/OIS/OIS.h +41 -0
- data/deps/include/OIS/OISConfig.h +75 -0
- data/deps/include/OIS/OISEffect.h +278 -0
- data/deps/include/OIS/OISEvents.h +43 -0
- data/deps/include/OIS/OISException.h +78 -0
- data/deps/include/OIS/OISFactoryCreator.h +81 -0
- data/deps/include/OIS/OISForceFeedback.h +120 -0
- data/deps/include/OIS/OISInputManager.h +205 -0
- data/deps/include/OIS/OISInterface.h +47 -0
- data/deps/include/OIS/OISJoyStick.h +228 -0
- data/deps/include/OIS/OISKeyboard.h +312 -0
- data/deps/include/OIS/OISMouse.h +138 -0
- data/deps/include/OIS/OISMultiTouch.h +169 -0
- data/deps/include/OIS/OISObject.h +95 -0
- data/deps/include/OIS/OISPrereqs.h +226 -0
- data/deps/lib/libOIS-1.3.0.so +0 -0
- data/deps/lib/libOIS.so +0 -0
- data/lib/ois.so +0 -0
- data/lib/ruby-ois.rb +30 -0
- data/lib/ruby-ois/version.rb +5 -0
- data/ruby-ois.gemspec +30 -0
- metadata +88 -0
@@ -0,0 +1,138 @@
|
|
1
|
+
/*
|
2
|
+
The zlib/libpng License
|
3
|
+
|
4
|
+
Copyright (c) 2005-2007 Phillip Castaneda (pjcast -- www.wreckedgames.com)
|
5
|
+
|
6
|
+
This software is provided 'as-is', without any express or implied warranty. In no event will
|
7
|
+
the authors be held liable for any damages arising from the use of this software.
|
8
|
+
|
9
|
+
Permission is granted to anyone to use this software for any purpose, including commercial
|
10
|
+
applications, and to alter it and redistribute it freely, subject to the following
|
11
|
+
restrictions:
|
12
|
+
|
13
|
+
1. The origin of this software must not be misrepresented; you must not claim that
|
14
|
+
you wrote the original software. If you use this software in a product,
|
15
|
+
an acknowledgment in the product documentation would be appreciated but is
|
16
|
+
not required.
|
17
|
+
|
18
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
19
|
+
misrepresented as being the original software.
|
20
|
+
|
21
|
+
3. This notice may not be removed or altered from any source distribution.
|
22
|
+
*/
|
23
|
+
#ifndef OIS_Mouse_H
|
24
|
+
#define OIS_Mouse_H
|
25
|
+
#include "OISObject.h"
|
26
|
+
#include "OISEvents.h"
|
27
|
+
|
28
|
+
namespace OIS
|
29
|
+
{
|
30
|
+
//! Button ID for mouse devices
|
31
|
+
enum MouseButtonID
|
32
|
+
{
|
33
|
+
MB_Left = 0, MB_Right, MB_Middle,
|
34
|
+
MB_Button3, MB_Button4, MB_Button5, MB_Button6, MB_Button7
|
35
|
+
};
|
36
|
+
|
37
|
+
/**
|
38
|
+
Represents the state of the mouse
|
39
|
+
All members are valid for both buffered and non buffered mode
|
40
|
+
*/
|
41
|
+
class _OISExport MouseState
|
42
|
+
{
|
43
|
+
public:
|
44
|
+
MouseState() : width(50), height(50), buttons(0) {};
|
45
|
+
|
46
|
+
/** Represents the height/width of your display area.. used if mouse clipping
|
47
|
+
or mouse grabbed in case of X11 - defaults to 50.. Make sure to set this
|
48
|
+
and change when your size changes.. */
|
49
|
+
mutable int width, height;
|
50
|
+
|
51
|
+
//! X Axis component
|
52
|
+
Axis X;
|
53
|
+
|
54
|
+
//! Y Axis Component
|
55
|
+
Axis Y;
|
56
|
+
|
57
|
+
//! Z Axis Component
|
58
|
+
Axis Z;
|
59
|
+
|
60
|
+
//! represents all buttons - bit position indicates button down
|
61
|
+
int buttons;
|
62
|
+
|
63
|
+
//! Button down test
|
64
|
+
inline bool buttonDown( MouseButtonID button ) const
|
65
|
+
{
|
66
|
+
return ((buttons & ( 1L << button )) == 0) ? false : true;
|
67
|
+
}
|
68
|
+
|
69
|
+
//! Clear all the values
|
70
|
+
void clear()
|
71
|
+
{
|
72
|
+
X.clear();
|
73
|
+
Y.clear();
|
74
|
+
Z.clear();
|
75
|
+
buttons = 0;
|
76
|
+
}
|
77
|
+
};
|
78
|
+
|
79
|
+
/** Specialised for mouse events */
|
80
|
+
class _OISExport MouseEvent : public EventArg
|
81
|
+
{
|
82
|
+
public:
|
83
|
+
MouseEvent( Object *obj, const MouseState &ms ) : EventArg(obj), state(ms) {}
|
84
|
+
virtual ~MouseEvent() {}
|
85
|
+
|
86
|
+
//! The state of the mouse - including buttons and axes
|
87
|
+
const MouseState &state;
|
88
|
+
};
|
89
|
+
|
90
|
+
/**
|
91
|
+
To recieve buffered mouse input, derive a class from this, and implement the
|
92
|
+
methods here. Then set the call back to your Mouse instance with Mouse::setEventCallback
|
93
|
+
*/
|
94
|
+
class _OISExport MouseListener
|
95
|
+
{
|
96
|
+
public:
|
97
|
+
virtual ~MouseListener() {}
|
98
|
+
virtual bool mouseMoved( const MouseEvent &arg ) = 0;
|
99
|
+
virtual bool mousePressed( const MouseEvent &arg, MouseButtonID id ) = 0;
|
100
|
+
virtual bool mouseReleased( const MouseEvent &arg, MouseButtonID id ) = 0;
|
101
|
+
};
|
102
|
+
|
103
|
+
/**
|
104
|
+
Mouse base class. To be implemented by specific system (ie. DirectX Mouse)
|
105
|
+
This class is useful as you remain OS independent using this common interface.
|
106
|
+
*/
|
107
|
+
class _OISExport Mouse : public Object
|
108
|
+
{
|
109
|
+
public:
|
110
|
+
virtual ~Mouse() {}
|
111
|
+
|
112
|
+
/**
|
113
|
+
@remarks
|
114
|
+
Register/unregister a Mouse Listener - Only one allowed for simplicity. If broadcasting
|
115
|
+
is neccessary, just broadcast from the callback you registered.
|
116
|
+
@param mouseListener
|
117
|
+
Send a pointer to a class derived from MouseListener or 0 to clear the callback
|
118
|
+
*/
|
119
|
+
virtual void setEventCallback( MouseListener *mouseListener ) {mListener = mouseListener;}
|
120
|
+
|
121
|
+
/** @remarks Returns currently set callback.. or 0 */
|
122
|
+
MouseListener* getEventCallback() const {return mListener;}
|
123
|
+
|
124
|
+
/** @remarks Returns the state of the mouse - is valid for both buffered and non buffered mode */
|
125
|
+
const MouseState& getMouseState() const { return mState; }
|
126
|
+
|
127
|
+
protected:
|
128
|
+
Mouse(const std::string &vendor, bool buffered, int devID, InputManager* creator)
|
129
|
+
: Object(vendor, OISMouse, buffered, devID, creator), mListener(0) {}
|
130
|
+
|
131
|
+
//! The state of the mouse
|
132
|
+
MouseState mState;
|
133
|
+
|
134
|
+
//! Used for buffered/actionmapping callback
|
135
|
+
MouseListener *mListener;
|
136
|
+
};
|
137
|
+
}
|
138
|
+
#endif
|
@@ -0,0 +1,169 @@
|
|
1
|
+
/*
|
2
|
+
The zlib/libpng License
|
3
|
+
|
4
|
+
Copyright (c) 2005-2007 Phillip Castaneda (pjcast -- www.wreckedgames.com)
|
5
|
+
|
6
|
+
This software is provided 'as-is', without any express or implied warranty. In no event will
|
7
|
+
the authors be held liable for any damages arising from the use of this software.
|
8
|
+
|
9
|
+
Permission is granted to anyone to use this software for any purpose, including commercial
|
10
|
+
applications, and to alter it and redistribute it freely, subject to the following
|
11
|
+
restrictions:
|
12
|
+
|
13
|
+
1. The origin of this software must not be misrepresented; you must not claim that
|
14
|
+
you wrote the original software. If you use this software in a product,
|
15
|
+
an acknowledgment in the product documentation would be appreciated but is
|
16
|
+
not required.
|
17
|
+
|
18
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
19
|
+
misrepresented as being the original software.
|
20
|
+
|
21
|
+
3. This notice may not be removed or altered from any source distribution.
|
22
|
+
*/
|
23
|
+
#ifndef OIS_MultiTouch_H
|
24
|
+
#define OIS_MultiTouch_H
|
25
|
+
#include "OISObject.h"
|
26
|
+
#include "OISEvents.h"
|
27
|
+
|
28
|
+
#include <set>
|
29
|
+
#include <vector>
|
30
|
+
|
31
|
+
#define OIS_MAX_NUM_TOUCHES 4 // 4 finger touches are probably the highest we'll ever get
|
32
|
+
|
33
|
+
namespace OIS
|
34
|
+
{
|
35
|
+
/**
|
36
|
+
Represents the state of the multi-touch device
|
37
|
+
All members are valid for both buffered and non buffered mode
|
38
|
+
*/
|
39
|
+
|
40
|
+
//! Touch Event type
|
41
|
+
enum MultiTypeEventTypeID
|
42
|
+
{
|
43
|
+
MT_None = 0, MT_Pressed, MT_Released, MT_Moved, MT_Cancelled
|
44
|
+
};
|
45
|
+
|
46
|
+
class _OISExport MultiTouchState
|
47
|
+
{
|
48
|
+
public:
|
49
|
+
MultiTouchState() : width(50), height(50), touchType(MT_None) {};
|
50
|
+
|
51
|
+
/** Represents the height/width of your display area.. used if touch clipping
|
52
|
+
or touch grabbed in case of X11 - defaults to 50.. Make sure to set this
|
53
|
+
and change when your size changes.. */
|
54
|
+
mutable int width, height;
|
55
|
+
|
56
|
+
//! X Axis component
|
57
|
+
Axis X;
|
58
|
+
|
59
|
+
//! Y Axis Component
|
60
|
+
Axis Y;
|
61
|
+
|
62
|
+
//! Z Axis Component
|
63
|
+
Axis Z;
|
64
|
+
|
65
|
+
int touchType;
|
66
|
+
|
67
|
+
inline bool touchIsType( MultiTypeEventTypeID touch ) const
|
68
|
+
{
|
69
|
+
return ((touchType & ( 1L << touch )) == 0) ? false : true;
|
70
|
+
}
|
71
|
+
|
72
|
+
//! Clear all the values
|
73
|
+
void clear()
|
74
|
+
{
|
75
|
+
X.clear();
|
76
|
+
Y.clear();
|
77
|
+
Z.clear();
|
78
|
+
touchType = MT_None;
|
79
|
+
}
|
80
|
+
};
|
81
|
+
|
82
|
+
/** Specialised for multi-touch events */
|
83
|
+
class _OISExport MultiTouchEvent : public EventArg
|
84
|
+
{
|
85
|
+
public:
|
86
|
+
MultiTouchEvent( Object *obj, const MultiTouchState &ms ) : EventArg(obj), state(ms) {}
|
87
|
+
virtual ~MultiTouchEvent() {}
|
88
|
+
|
89
|
+
//! The state of the touch - including axes
|
90
|
+
const MultiTouchState &state;
|
91
|
+
};
|
92
|
+
|
93
|
+
/**
|
94
|
+
To receive buffered touch input, derive a class from this, and implement the
|
95
|
+
methods here. Then set the call back to your MultiTouch instance with MultiTouch::setEventCallback
|
96
|
+
*/
|
97
|
+
class _OISExport MultiTouchListener
|
98
|
+
{
|
99
|
+
public:
|
100
|
+
virtual ~MultiTouchListener() {}
|
101
|
+
virtual bool touchMoved( const MultiTouchEvent &arg ) = 0;
|
102
|
+
virtual bool touchPressed( const MultiTouchEvent &arg ) = 0;
|
103
|
+
virtual bool touchReleased( const MultiTouchEvent &arg ) = 0;
|
104
|
+
virtual bool touchCancelled( const MultiTouchEvent &arg ) = 0;
|
105
|
+
};
|
106
|
+
|
107
|
+
/**
|
108
|
+
MultiTouch base class. To be implemented by specific system (ie. iPhone UITouch)
|
109
|
+
This class is useful as you remain OS independent using this common interface.
|
110
|
+
*/
|
111
|
+
class _OISExport MultiTouch : public Object
|
112
|
+
{
|
113
|
+
public:
|
114
|
+
virtual ~MultiTouch() {}
|
115
|
+
|
116
|
+
/**
|
117
|
+
@remarks
|
118
|
+
Register/unregister a MultiTouch Listener - Only one allowed for simplicity. If broadcasting
|
119
|
+
is necessary, just broadcast from the callback you registered.
|
120
|
+
@param touchListener
|
121
|
+
Send a pointer to a class derived from MultiTouchListener or 0 to clear the callback
|
122
|
+
*/
|
123
|
+
virtual void setEventCallback( MultiTouchListener *touchListener ) {mListener = touchListener;}
|
124
|
+
|
125
|
+
/** @remarks Returns currently set callback.. or 0 */
|
126
|
+
MultiTouchListener* getEventCallback() {return mListener;}
|
127
|
+
|
128
|
+
/** @remarks Clear out the set of input states. Should be called after input has been processed by the application */
|
129
|
+
void clearStates(void) { mStates.clear(); }
|
130
|
+
|
131
|
+
/** @remarks Returns the state of the touch - is valid for both buffered and non buffered mode */
|
132
|
+
std::vector<MultiTouchState> getMultiTouchStates() const { return mStates; }
|
133
|
+
|
134
|
+
/** @remarks Returns the first n touch states. Useful if you know your app only needs to
|
135
|
+
process n touches. The return value is a vector to allow random access */
|
136
|
+
const std::vector<MultiTouchState> getFirstNTouchStates(int n) {
|
137
|
+
std::vector<MultiTouchState> states;
|
138
|
+
for( unsigned int i = 0; i < mStates.size(); i++ ) {
|
139
|
+
if(!(mStates[i].touchIsType(MT_None))) {
|
140
|
+
states.push_back(mStates[i]);
|
141
|
+
}
|
142
|
+
}
|
143
|
+
return states;
|
144
|
+
}
|
145
|
+
|
146
|
+
/** @remarks Returns the first n touch states. Useful if you know your app only needs to
|
147
|
+
process n touches. The return value is a vector to allow random access */
|
148
|
+
const std::vector<MultiTouchState> getMultiTouchStatesOfType(MultiTypeEventTypeID type) {
|
149
|
+
std::vector<MultiTouchState> states;
|
150
|
+
for( unsigned int i = 0; i < mStates.size(); i++ ) {
|
151
|
+
if(mStates[i].touchIsType(type)) {
|
152
|
+
states.push_back(mStates[i]);
|
153
|
+
}
|
154
|
+
}
|
155
|
+
return states;
|
156
|
+
}
|
157
|
+
|
158
|
+
protected:
|
159
|
+
MultiTouch(const std::string &vendor, bool buffered, int devID, InputManager* creator)
|
160
|
+
: Object(vendor, OISMultiTouch, buffered, devID, creator), mListener(0) {}
|
161
|
+
|
162
|
+
//! The state of the touch device, implemented in a vector to store the state from each finger touch
|
163
|
+
std::vector<MultiTouchState> mStates;
|
164
|
+
|
165
|
+
//! Used for buffered/actionmapping callback
|
166
|
+
MultiTouchListener *mListener;
|
167
|
+
};
|
168
|
+
}
|
169
|
+
#endif
|
@@ -0,0 +1,95 @@
|
|
1
|
+
/*
|
2
|
+
The zlib/libpng License
|
3
|
+
|
4
|
+
Copyright (c) 2005-2007 Phillip Castaneda (pjcast -- www.wreckedgames.com)
|
5
|
+
|
6
|
+
This software is provided 'as-is', without any express or implied warranty. In no event will
|
7
|
+
the authors be held liable for any damages arising from the use of this software.
|
8
|
+
|
9
|
+
Permission is granted to anyone to use this software for any purpose, including commercial
|
10
|
+
applications, and to alter it and redistribute it freely, subject to the following
|
11
|
+
restrictions:
|
12
|
+
|
13
|
+
1. The origin of this software must not be misrepresented; you must not claim that
|
14
|
+
you wrote the original software. If you use this software in a product,
|
15
|
+
an acknowledgment in the product documentation would be appreciated but is
|
16
|
+
not required.
|
17
|
+
|
18
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
19
|
+
misrepresented as being the original software.
|
20
|
+
|
21
|
+
3. This notice may not be removed or altered from any source distribution.
|
22
|
+
*/
|
23
|
+
#ifndef OIS_Object_H
|
24
|
+
#define OIS_Object_H
|
25
|
+
|
26
|
+
#include "OISPrereqs.h"
|
27
|
+
#include "OISInterface.h"
|
28
|
+
|
29
|
+
namespace OIS
|
30
|
+
{
|
31
|
+
/** The base class of all input types. */
|
32
|
+
class _OISExport Object
|
33
|
+
{
|
34
|
+
public:
|
35
|
+
virtual ~Object() {}
|
36
|
+
|
37
|
+
/** @remarks Get the type of device */
|
38
|
+
Type type() const { return mType; }
|
39
|
+
|
40
|
+
/** @remarks Get the vender string name */
|
41
|
+
const std::string& vendor() const { return mVendor; }
|
42
|
+
|
43
|
+
/** @remarks Get buffered mode - true is buffered, false otherwise */
|
44
|
+
virtual bool buffered() const { return mBuffered; }
|
45
|
+
|
46
|
+
/** @remarks Returns this input object's creator */
|
47
|
+
InputManager* getCreator() const { return mCreator; }
|
48
|
+
|
49
|
+
/** @remarks Sets buffered mode */
|
50
|
+
virtual void setBuffered(bool buffered) = 0;
|
51
|
+
|
52
|
+
/** @remarks Used for updating call once per frame before checking state or to update events */
|
53
|
+
virtual void capture() = 0;
|
54
|
+
|
55
|
+
/** @remarks This may/may not) differentiate the different controllers based on (for instance) a port number (useful for console InputManagers) */
|
56
|
+
virtual int getID() const {return mDevID;}
|
57
|
+
|
58
|
+
/**
|
59
|
+
@remarks
|
60
|
+
If available, get an interface to write to some devices.
|
61
|
+
Examples include, turning on and off LEDs, ForceFeedback, etc
|
62
|
+
@param type
|
63
|
+
The type of interface you are looking for
|
64
|
+
*/
|
65
|
+
virtual Interface* queryInterface(Interface::IType type) = 0;
|
66
|
+
|
67
|
+
/** @remarks Internal... Do not call this directly. */
|
68
|
+
virtual void _initialize() = 0;
|
69
|
+
|
70
|
+
protected:
|
71
|
+
Object(const std::string &vendor, Type iType, bool buffered,
|
72
|
+
int devID, InputManager* creator) :
|
73
|
+
mVendor(vendor),
|
74
|
+
mType(iType),
|
75
|
+
mBuffered(buffered),
|
76
|
+
mDevID(devID),
|
77
|
+
mCreator(creator) {}
|
78
|
+
|
79
|
+
//! Vendor name if applicable/known
|
80
|
+
std::string mVendor;
|
81
|
+
|
82
|
+
//! Type of controller object
|
83
|
+
Type mType;
|
84
|
+
|
85
|
+
//! Buffered flag
|
86
|
+
bool mBuffered;
|
87
|
+
|
88
|
+
//! Not fully implemented yet
|
89
|
+
int mDevID;
|
90
|
+
|
91
|
+
//! The creator who created this object
|
92
|
+
InputManager* mCreator;
|
93
|
+
};
|
94
|
+
}
|
95
|
+
#endif
|
@@ -0,0 +1,226 @@
|
|
1
|
+
/*
|
2
|
+
The zlib/libpng License
|
3
|
+
|
4
|
+
Copyright (c) 2005-2007 Phillip Castaneda (pjcast -- www.wreckedgames.com)
|
5
|
+
|
6
|
+
This software is provided 'as-is', without any express or implied warranty. In no event will
|
7
|
+
the authors be held liable for any damages arising from the use of this software.
|
8
|
+
|
9
|
+
Permission is granted to anyone to use this software for any purpose, including commercial
|
10
|
+
applications, and to alter it and redistribute it freely, subject to the following
|
11
|
+
restrictions:
|
12
|
+
|
13
|
+
1. The origin of this software must not be misrepresented; you must not claim that
|
14
|
+
you wrote the original software. If you use this software in a product,
|
15
|
+
an acknowledgment in the product documentation would be appreciated but is
|
16
|
+
not required.
|
17
|
+
|
18
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
19
|
+
misrepresented as being the original software.
|
20
|
+
|
21
|
+
3. This notice may not be removed or altered from any source distribution.
|
22
|
+
*/
|
23
|
+
#ifndef OIS_Prereqs_H
|
24
|
+
#define OIS_Prereqs_H
|
25
|
+
//----------------------------------------------------------------------------//
|
26
|
+
// This Header File contains: forward declared classes
|
27
|
+
// * Forward Declarations of all public API classes
|
28
|
+
// * Several typedef's used around the library
|
29
|
+
// * Base class component types
|
30
|
+
// * Preprocessor definitons
|
31
|
+
//----------------------------------------------------------------------------//
|
32
|
+
|
33
|
+
//-------------- Common STL Containers ---------------------------------------//
|
34
|
+
#include <vector>
|
35
|
+
#include <string>
|
36
|
+
#include <map>
|
37
|
+
#include "OISConfig.h"
|
38
|
+
|
39
|
+
// Default is blank for most OS's
|
40
|
+
#define _OISExport
|
41
|
+
|
42
|
+
//-------------- Determine Compiler ---------------------------------
|
43
|
+
#if defined( _MSC_VER )
|
44
|
+
# define OIS_MSVC_COMPILER
|
45
|
+
#elif defined( __GNUC__ )
|
46
|
+
# if defined( __WIN32__ ) || defined( _WIN32 )
|
47
|
+
# define OIS_MINGW_COMPILER
|
48
|
+
# else
|
49
|
+
# define OIS_GCC_COMPILER
|
50
|
+
# endif
|
51
|
+
#elif defined( __BORLANDC__ )
|
52
|
+
# define OIS_BORLAND_COMPILER
|
53
|
+
#else
|
54
|
+
# error No Recognized Compiler!
|
55
|
+
#endif
|
56
|
+
|
57
|
+
// --------------- Determine Operating System Platform ---------------
|
58
|
+
#if defined( __WIN32__ ) || defined( _WIN32 ) // Windows 2000, XP, ETC
|
59
|
+
# if defined ( _XBOX )
|
60
|
+
# define OIS_XBOX_PLATFORM
|
61
|
+
# else
|
62
|
+
# define OIS_WIN32_PLATFORM
|
63
|
+
# if defined( OIS_DYNAMIC_LIB )
|
64
|
+
# undef _OISExport
|
65
|
+
//Ignorable Dll interface warning...
|
66
|
+
# if !defined(OIS_MINGW_COMPILER)
|
67
|
+
# pragma warning (disable : 4251)
|
68
|
+
# endif
|
69
|
+
# if defined( OIS_NONCLIENT_BUILD )
|
70
|
+
# define _OISExport __declspec( dllexport )
|
71
|
+
# else
|
72
|
+
# if defined(OIS_MINGW_COMPILER)
|
73
|
+
# define _OISExport
|
74
|
+
# else
|
75
|
+
# define _OISExport __declspec( dllimport )
|
76
|
+
# endif
|
77
|
+
# endif
|
78
|
+
# endif
|
79
|
+
# endif
|
80
|
+
#elif defined( __APPLE_CC__ ) // Apple OS X
|
81
|
+
// Device Simulator
|
82
|
+
# if __IPHONE_OS_VERSION_MIN_REQUIRED >= 20201 || __IPHONE_OS_VERSION_MIN_REQUIRED >= 20000
|
83
|
+
//# if __IPHONE_OS_VERSION_MIN_REQUIRED >= 30000 || __IPHONE_OS_VERSION_MIN_REQUIRED >= 30000
|
84
|
+
# define OIS_IPHONE_PLATFORM
|
85
|
+
# else
|
86
|
+
# define OIS_APPLE_PLATFORM
|
87
|
+
# endif
|
88
|
+
# undef _OISExport
|
89
|
+
# define _OISExport __attribute__((visibility("default")))
|
90
|
+
#else //Probably Linux
|
91
|
+
# define OIS_LINUX_PLATFORM
|
92
|
+
#endif
|
93
|
+
|
94
|
+
//Is Processor 32 or 64 bits...
|
95
|
+
#if defined(__x86_64__)
|
96
|
+
# define OIS_ARCH_64
|
97
|
+
#else
|
98
|
+
# define OIS_ARCH_32
|
99
|
+
#endif
|
100
|
+
|
101
|
+
//-------------- Common Classes, Enums, and Typdef's -------------------------//
|
102
|
+
#define OIS_VERSION_MAJOR 1
|
103
|
+
#define OIS_VERSION_MINOR 3
|
104
|
+
#define OIS_VERSION_PATCH 0
|
105
|
+
#define OIS_VERSION_NAME "1.3.0"
|
106
|
+
|
107
|
+
#define OIS_VERSION ((OIS_VERSION_MAJOR << 16) | (OIS_VERSION_MINOR << 8) | OIS_VERSION_PATCH)
|
108
|
+
|
109
|
+
namespace OIS
|
110
|
+
{
|
111
|
+
//Forward Declarations
|
112
|
+
class InputManager;
|
113
|
+
class FactoryCreator;
|
114
|
+
class Object;
|
115
|
+
class Keyboard;
|
116
|
+
class Mouse;
|
117
|
+
class JoyStick;
|
118
|
+
class MultiTouch;
|
119
|
+
class KeyListener;
|
120
|
+
class MouseListener;
|
121
|
+
class MultiTouchListener;
|
122
|
+
class JoyStickListener;
|
123
|
+
class Interface;
|
124
|
+
class ForceFeedback;
|
125
|
+
class Effect;
|
126
|
+
class Exception;
|
127
|
+
|
128
|
+
//! Way to send OS nuetral parameters.. ie OS Window handles, modes, flags
|
129
|
+
typedef std::multimap<std::string, std::string> ParamList;
|
130
|
+
|
131
|
+
//! List of FactoryCreator's
|
132
|
+
typedef std::vector<FactoryCreator*> FactoryList;
|
133
|
+
|
134
|
+
//! Map of FactoryCreator created Objects
|
135
|
+
typedef std::map<Object*, FactoryCreator*> FactoryCreatedObject;
|
136
|
+
|
137
|
+
//! Each Input class has a General Type variable, a form of RTTI
|
138
|
+
enum Type
|
139
|
+
{
|
140
|
+
OISUnknown = 0,
|
141
|
+
OISKeyboard = 1,
|
142
|
+
OISMouse = 2,
|
143
|
+
OISJoyStick = 3,
|
144
|
+
OISTablet = 4,
|
145
|
+
OISMultiTouch = 5
|
146
|
+
};
|
147
|
+
|
148
|
+
//! Map of device objects connected and their respective vendors
|
149
|
+
typedef std::multimap<Type, std::string> DeviceList;
|
150
|
+
|
151
|
+
//-------- Shared common components ------------------------//
|
152
|
+
|
153
|
+
//! Base type for all device components (button, axis, etc)
|
154
|
+
enum ComponentType
|
155
|
+
{
|
156
|
+
OIS_Unknown = 0,
|
157
|
+
OIS_Button = 1, //ie. Key, mouse button, joy button, etc
|
158
|
+
OIS_Axis = 2, //ie. A joystick or mouse axis
|
159
|
+
OIS_Slider = 3, //
|
160
|
+
OIS_POV = 4, //ie. Arrow direction keys
|
161
|
+
OIS_Vector3 = 5 //ie. WiiMote orientation
|
162
|
+
};
|
163
|
+
|
164
|
+
//! Base of all device components (button, axis, etc)
|
165
|
+
class _OISExport Component
|
166
|
+
{
|
167
|
+
public:
|
168
|
+
Component() : cType(OIS_Unknown) {};
|
169
|
+
Component(ComponentType type) : cType(type) {};
|
170
|
+
//! Indicates what type of coponent this is
|
171
|
+
ComponentType cType;
|
172
|
+
};
|
173
|
+
|
174
|
+
//! Button can be a keyboard key, mouse button, etc
|
175
|
+
class _OISExport Button : public Component
|
176
|
+
{
|
177
|
+
public:
|
178
|
+
Button() : Component(OIS_Button), pushed(false) {}
|
179
|
+
Button(bool bPushed) : Component(OIS_Button), pushed(bPushed) {}
|
180
|
+
//! true if pushed, false otherwise
|
181
|
+
bool pushed;
|
182
|
+
};
|
183
|
+
|
184
|
+
//! Axis component
|
185
|
+
class _OISExport Axis : public Component
|
186
|
+
{
|
187
|
+
public:
|
188
|
+
Axis() : Component(OIS_Axis), abs(0), rel(0), absOnly(false) {};
|
189
|
+
|
190
|
+
//! Absoulte and Relative value components
|
191
|
+
int abs, rel;
|
192
|
+
|
193
|
+
//! Indicates if this Axis only supports Absoulte (ie JoyStick)
|
194
|
+
bool absOnly;
|
195
|
+
|
196
|
+
//! Used internally by OIS
|
197
|
+
void clear()
|
198
|
+
{
|
199
|
+
abs = rel = 0;
|
200
|
+
}
|
201
|
+
};
|
202
|
+
|
203
|
+
//! A 3D Vector component (perhaps an orientation, as in the WiiMote)
|
204
|
+
class _OISExport Vector3 : public Component
|
205
|
+
{
|
206
|
+
public:
|
207
|
+
Vector3() {}
|
208
|
+
Vector3(float _x, float _y, float _z) : Component(OIS_Vector3), x(_x), y(_y), z(_z) {};
|
209
|
+
|
210
|
+
//! X component of vector
|
211
|
+
float x;
|
212
|
+
|
213
|
+
//! Y component of vector
|
214
|
+
float y;
|
215
|
+
|
216
|
+
//! Z component of vector
|
217
|
+
float z;
|
218
|
+
|
219
|
+
void clear()
|
220
|
+
{
|
221
|
+
x = y = z = 0.0f;
|
222
|
+
}
|
223
|
+
};
|
224
|
+
}
|
225
|
+
|
226
|
+
#endif //end if prereq header defined
|