ruby-ois 0.0.1-x86-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. data/Gemfile +4 -0
  2. data/LICENSE.txt +22 -0
  3. data/README.md +37 -0
  4. data/Rakefile +56 -0
  5. data/bindings/ois/interface/OIS_Effect.i +8 -0
  6. data/bindings/ois/interface/OIS_Event.i +8 -0
  7. data/bindings/ois/interface/OIS_Exception.i +8 -0
  8. data/bindings/ois/interface/OIS_FactoryCreator.i +8 -0
  9. data/bindings/ois/interface/OIS_ForceFeedback.i +8 -0
  10. data/bindings/ois/interface/OIS_InputManager.i +20 -0
  11. data/bindings/ois/interface/OIS_Interface.i +8 -0
  12. data/bindings/ois/interface/OIS_JoyStick.i +8 -0
  13. data/bindings/ois/interface/OIS_Keyboard.i +15 -0
  14. data/bindings/ois/interface/OIS_Mouse.i +10 -0
  15. data/bindings/ois/interface/OIS_Object.i +22 -0
  16. data/bindings/ois/interface/OIS_Prereqs.i +20 -0
  17. data/bindings/ois/interface/Rakefile +19 -0
  18. data/bindings/ois/interface/ois.i +3 -0
  19. data/bindings/ois/interface/ois_all.i +23 -0
  20. data/bindings/ois/interface/ois_wrap.cpp +19311 -0
  21. data/bindings/ois/interface/ois_wrap.h +40 -0
  22. data/bindings/ois/interface/ois_wrap.o +0 -0
  23. data/deps/include/OIS/OIS.h +41 -0
  24. data/deps/include/OIS/OISConfig.h +75 -0
  25. data/deps/include/OIS/OISEffect.h +278 -0
  26. data/deps/include/OIS/OISEvents.h +43 -0
  27. data/deps/include/OIS/OISException.h +78 -0
  28. data/deps/include/OIS/OISFactoryCreator.h +81 -0
  29. data/deps/include/OIS/OISForceFeedback.h +120 -0
  30. data/deps/include/OIS/OISInputManager.h +205 -0
  31. data/deps/include/OIS/OISInterface.h +47 -0
  32. data/deps/include/OIS/OISJoyStick.h +228 -0
  33. data/deps/include/OIS/OISKeyboard.h +312 -0
  34. data/deps/include/OIS/OISMouse.h +138 -0
  35. data/deps/include/OIS/OISMultiTouch.h +169 -0
  36. data/deps/include/OIS/OISObject.h +95 -0
  37. data/deps/include/OIS/OISPrereqs.h +226 -0
  38. data/deps/lib/libOIS-1.3.0.so +0 -0
  39. data/deps/lib/libOIS.so +0 -0
  40. data/lib/ois.so +0 -0
  41. data/lib/ruby-ois.rb +30 -0
  42. data/lib/ruby-ois/version.rb +5 -0
  43. data/ruby-ois.gemspec +30 -0
  44. metadata +88 -0
@@ -0,0 +1,78 @@
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_EXCEPTION_HEADER_
24
+ #define _OIS_EXCEPTION_HEADER_
25
+ #include "OISPrereqs.h"
26
+ #include <exception>
27
+
28
+ namespace OIS
29
+ {
30
+ //! Simple enum's for dealing with exceptions
31
+ enum OIS_ERROR
32
+ {
33
+ E_InputDisconnected,
34
+ E_InputDeviceNonExistant,
35
+ E_InputDeviceNotSupported,
36
+ E_DeviceFull,
37
+ E_NotSupported,
38
+ E_NotImplemented,
39
+ E_Duplicate,
40
+ E_InvalidParam,
41
+ E_General
42
+ };
43
+
44
+ /**
45
+ @remarks
46
+ Class for handling OIS exceptions. Much cleaner than checking every method for reurn value.
47
+ Inherits from std::exception so you can simply log those messages if you want to be generic.
48
+ Also note that this has a source file now since OSX was not finding the OIS::Exception symbol
49
+ which would cause program abortion with now correponding exception type.
50
+ */
51
+ class _OISExport Exception : public std::exception
52
+ {
53
+ //! Hidden default
54
+ Exception() : eType(E_General), eLine(0), eFile(0) {}
55
+ public:
56
+ //! Creates exception object
57
+ Exception( OIS_ERROR err, const char* str, int line, const char *file )
58
+ : eType(err), eLine(line), eFile(file), eText(str) {}
59
+
60
+ ~Exception() throw() {}
61
+
62
+ virtual const char* what() const throw();
63
+
64
+ //! The type of exception raised
65
+ const OIS_ERROR eType;
66
+ //! The line number it occurred on
67
+ const int eLine;
68
+ //! The source file
69
+ const char* eFile;
70
+ //! A message passed along when the exception was raised
71
+ const char* eText;
72
+ };
73
+ }
74
+
75
+ //! Use this macro to handle exceptions easily
76
+ #define OIS_EXCEPT( err, str ) throw( OIS::Exception(err, str, __LINE__, __FILE__) )
77
+
78
+ #endif //_OIS_EXCEPTION_HEADER_
@@ -0,0 +1,81 @@
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_FactoryCreator_H
24
+ #define OIS_FactoryCreator_H
25
+
26
+ #include "OISPrereqs.h"
27
+
28
+ namespace OIS
29
+ {
30
+ /**
31
+ Interface for creating devices - all devices ultimately get enumerated/created via a factory.
32
+ A factory can create multiple types of objects.
33
+ */
34
+ class _OISExport FactoryCreator
35
+ {
36
+ public:
37
+ /**
38
+ @remarks Virtual Destructor
39
+ */
40
+ virtual ~FactoryCreator() {};
41
+
42
+ /**
43
+ @remarks Return a list of all unused devices the factory maintains
44
+ */
45
+ virtual DeviceList freeDeviceList() = 0;
46
+
47
+ /**
48
+ @remarks Number of total devices of requested type
49
+ @param iType Type of devices to check
50
+ */
51
+ virtual int totalDevices(Type iType) = 0;
52
+
53
+ /**
54
+ @remarks Number of free devices of requested type
55
+ @param iType Type of devices to check
56
+ */
57
+ virtual int freeDevices(Type iType) = 0;
58
+
59
+ /**
60
+ @remarks Does a Type exist with the given vendor name
61
+ @param iType Type to check
62
+ @param vendor Vendor name to test
63
+ */
64
+ virtual bool vendorExist(Type iType, const std::string & vendor) = 0;
65
+
66
+ /**
67
+ @remarks Creates the object
68
+ @param iType Type to create
69
+ @param bufferMode True to setup for buffered events
70
+ @param vendor Create a device with the vendor name, "" means vendor name is unimportant
71
+ */
72
+ virtual Object* createObject(InputManager* creator, Type iType, bool bufferMode, const std::string & vendor = "") = 0;
73
+
74
+ /**
75
+ @remarks Destroys object
76
+ @param obj Object to destroy
77
+ */
78
+ virtual void destroyObject(Object* obj) = 0;
79
+ };
80
+ }
81
+ #endif //OIS_FactoryCreator_H
@@ -0,0 +1,120 @@
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_ForceFeedBack_H
24
+ #define OIS_ForceFeedBack_H
25
+
26
+ #include "OISPrereqs.h"
27
+ #include "OISInterface.h"
28
+ #include "OISEffect.h"
29
+
30
+ namespace OIS
31
+ {
32
+ /**
33
+ Interface class for dealing with Force Feedback devices
34
+ */
35
+ class _OISExport ForceFeedback : public Interface
36
+ {
37
+ public:
38
+ ForceFeedback();
39
+ virtual ~ForceFeedback() {}
40
+
41
+ /**
42
+ @remarks
43
+ This is like setting the master volume of an audio device.
44
+ Individual effects have gain levels; however, this affects all
45
+ effects at once.
46
+ Note: If the device does not support master gain setting, nothing is done
47
+ @param level
48
+ A value between 0.0 and 1.0 represent the percentage of gain. 1.0
49
+ being the highest possible force level (means no scaling).
50
+ */
51
+ virtual void setMasterGain( float level ) = 0;
52
+
53
+ /**
54
+ @remarks
55
+ If using Force Feedback effects, this should be turned off
56
+ before uploading any effects. Auto centering is the motor moving
57
+ the joystick back to center. DirectInput only has an on/off setting,
58
+ whereas linux has levels.. Though, we go with DI's on/off mode only
59
+ Note: If the device does not support auto-centering, nothing is done
60
+ @param auto_on
61
+ true to turn auto centering on, false to turn off.
62
+ */
63
+ virtual void setAutoCenterMode( bool auto_on ) = 0;
64
+
65
+ /**
66
+ @remarks
67
+ Creates and Plays the effect immediately. If the device is full
68
+ of effects, it will fail to be uploaded. You will know this by
69
+ an invalid Effect Handle
70
+ */
71
+ virtual void upload( const Effect* effect ) = 0;
72
+
73
+ /**
74
+ @remarks
75
+ Modifies an effect that is currently playing
76
+ */
77
+ virtual void modify( const Effect* effect ) = 0;
78
+
79
+ /**
80
+ @remarks
81
+ Remove the effect from the device
82
+ */
83
+ virtual void remove( const Effect* effect ) = 0;
84
+
85
+ /**
86
+ @remarks
87
+ Get the number of supported Axes for FF usage
88
+ */
89
+ virtual short getFFAxesNumber() = 0;
90
+
91
+ /**
92
+ @remarks
93
+ Get the current load (%, in [0, 100] of the FF device memory
94
+ */
95
+ virtual unsigned short getFFMemoryLoad() = 0;
96
+
97
+ typedef std::multimap<Effect::EForce, Effect::EType> SupportedEffectList;
98
+ /**
99
+ @remarks
100
+ Get a list of all supported effects
101
+ */
102
+ const SupportedEffectList& getSupportedEffects() const;
103
+
104
+ /**
105
+ @remarks
106
+ Tell if a given force / effect type pair is supported
107
+ */
108
+ bool supportsEffect(Effect::EForce force, Effect::EType type) const;
109
+
110
+ void _addEffectTypes( Effect::EForce force, Effect::EType type );
111
+ void _setGainSupport( bool on );
112
+ void _setAutoCenterSupport( bool on );
113
+
114
+ protected:
115
+ SupportedEffectList mSupportedEffects;
116
+ bool mSetGainSupport;
117
+ bool mSetAutoCenterSupport;
118
+ };
119
+ }
120
+ #endif //OIS_ForceFeedBack_H
@@ -0,0 +1,205 @@
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_InputManager_H
24
+ #define OIS_InputManager_H
25
+
26
+ #include "OISPrereqs.h"
27
+
28
+ namespace OIS
29
+ {
30
+ //Forward declare a couple of classes we might use later
31
+ class LIRCFactoryCreator;
32
+ class WiiMoteFactoryCreator;
33
+
34
+ /**
35
+ Base Manager class. No longer a Singleton; so feel free to create as many InputManager's as you have
36
+ windows.
37
+ */
38
+ class _OISExport InputManager
39
+ {
40
+ public:
41
+ /**
42
+ @remarks
43
+ Returns version number (useful in DLL/SO libs)
44
+ @returns
45
+ Bits: 1-8 Patch number, 9-16 Minor version, 17-32 Major version
46
+ */
47
+ static unsigned int getVersionNumber();
48
+
49
+ /**
50
+ @remarks
51
+ Returns version string (useful in DLL/SO libs)
52
+ @returns
53
+ Version name
54
+ */
55
+ const std::string &getVersionName();
56
+
57
+ /**
58
+ @remarks
59
+ Creates appropriate input system dependent on platform.
60
+ @param winHandle
61
+ Contains OS specific window handle (such as HWND or X11 Window)
62
+ @returns
63
+ A pointer to the created manager, or raises Exception
64
+ */
65
+ static InputManager* createInputSystem( std::size_t winHandle );
66
+
67
+ /**
68
+ @remarks
69
+ Creates appropriate input system dependent on platform.
70
+ @param paramList
71
+ ParamList contains OS specific info (such as HWND and HINSTANCE for window apps),
72
+ and access mode.
73
+ @returns
74
+ A pointer to the created manager, or raises Exception
75
+ */
76
+ static InputManager* createInputSystem( ParamList &paramList );
77
+
78
+ /**
79
+ @remarks
80
+ Destroys the InputManager
81
+ @param manager
82
+ Manager to destroy
83
+ */
84
+ static void destroyInputSystem(InputManager* manager);
85
+
86
+ /**
87
+ @remarks Gets the name of the current platform input system
88
+ */
89
+ const std::string& inputSystemName();
90
+
91
+ /**
92
+ @remarks
93
+ Returns the number of the specified OIS::Type devices discovered by OIS
94
+ @param iType
95
+ Type that you are interested in
96
+ */
97
+ int getNumberOfDevices( Type iType );
98
+
99
+ /**
100
+ @remarks
101
+ Lists all unused devices
102
+ @returns
103
+ DeviceList which contains Type and vendor of device
104
+ */
105
+ DeviceList listFreeDevices();
106
+
107
+ /**
108
+ @remarks
109
+ Tries to create an object with the specified vendor. If you have no
110
+ preference of vendor, leave vender as default (""). Raises exception on failure
111
+ */
112
+ Object* createInputObject( Type iType, bool bufferMode, const std::string &vendor = "");
113
+
114
+ /**
115
+ @remarks Destroys Input Object
116
+ */
117
+ void destroyInputObject( Object* obj );
118
+
119
+ /**
120
+ @remarks
121
+ Add a custom object factory to allow for user controls.
122
+ @param factory
123
+ Factory instance to add
124
+ @notes
125
+ Make sure you do not delete the factory before devices created from
126
+ the factory are destroyed (either by calling RemoveFactoryCreator, or shutting down
127
+ the input system). Order should be something like the following:
128
+ * Create Input System
129
+ * Create Factory Instance
130
+ * AddFactoryCreator(factory)
131
+ * Create a device from the InputManager (device created by factory)
132
+ * One of the follwoing:
133
+ * removeFactoryCreator(factory)
134
+ * inputManager->destroyInputObject(obj)
135
+ * destroyInputSystem(inputManager)
136
+ * destroy Factory Instance
137
+ You can safely delete the factory instance once you have removed it or shut down the
138
+ input manager.
139
+ */
140
+ void addFactoryCreator( FactoryCreator* factory );
141
+
142
+ /**
143
+ @remarks
144
+ Remove a previously added object factory
145
+ @param factory
146
+ Factory object to remove.
147
+ @notes
148
+ Removing a factory will automatically destroy any Objects created from the factory
149
+ */
150
+ void removeFactoryCreator( FactoryCreator* factory );
151
+
152
+ //! All generic devices OIS supports internally (if they are compiled in)
153
+ enum AddOnFactories
154
+ {
155
+ AddOn_All = 0, //All Devices
156
+ AddOn_LIRC = 1, //PC Linux Infrared Remote Control
157
+ AddOn_WiiMote = 2 //PC WiiMote Support
158
+ };
159
+
160
+ /**
161
+ @remarks
162
+ Enable an addon FactoryCreator extension. By default, none are activated.
163
+ If the desired support was not compiled in, this has no effect. Calling
164
+ multiple times has no effect. Once activated, there is no way to deactivate -
165
+ simply destroy and recreate input manager.
166
+ */
167
+ void enableAddOnFactory(AddOnFactories factory);
168
+
169
+ protected:
170
+ /**
171
+ @remarks
172
+ Called from createInputSystem, gives derived input class a chance to setup after it is created
173
+ */
174
+ virtual void _initialize(ParamList &paramList) = 0;
175
+
176
+ /**
177
+ @remarks
178
+ Derived classes must provide input system name
179
+ */
180
+ InputManager(const std::string& name);
181
+
182
+ /**
183
+ @remarks
184
+ Virtual Destructor - this base class will clean up all devices still opened in mFactoryObjects list
185
+ */
186
+ virtual ~InputManager();
187
+
188
+ //! OIS Version name
189
+ const std::string m_VersionName;
190
+
191
+ //! FactoryCreator list
192
+ FactoryList mFactories;
193
+
194
+ //! Factory created objects - useful so we can find creator to send destruction request to
195
+ FactoryCreatedObject mFactoryObjects;
196
+
197
+ //! Name of the input system
198
+ const std::string mInputSystemName;
199
+
200
+ //! Extra factory (not enabled by default)
201
+ LIRCFactoryCreator *m_lircSupport;
202
+ WiiMoteFactoryCreator *m_wiiMoteSupport;
203
+ };
204
+ }
205
+ #endif