Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/physics_merge/src/ois/OISPrereqs.h @ 2490

Last change on this file since 2490 was 1505, checked in by rgrieder, 17 years ago

f* svn: It doesn't even inform you if you attempt to set a non existing property. It is svn:eol-style and not eol-style when using the command by the way…

  • Property svn:eol-style set to native
File size: 5.8 KB
Line 
1/*
2The zlib/libpng License
3
4Copyright (c) 2005-2007 Phillip Castaneda (pjcast -- www.wreckedgames.com)
5
6This software is provided 'as-is', without any express or implied warranty. In no event will
7the authors be held liable for any damages arising from the use of this software.
8
9Permission is granted to anyone to use this software for any purpose, including commercial
10applications, and to alter it and redistribute it freely, subject to the following
11restrictions:
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#       define OIS_APPLE_PLATFORM
82#       undef _OISExport
83#       define _OISExport __attribute__((visibility("default")))
84#else //Probably Linux
85#       define OIS_LINUX_PLATFORM
86#endif
87
88//Is Processor 32 or 64 bits...
89#if defined(__x86_64__)
90#       define OIS_ARCH_64
91#else
92#       define OIS_ARCH_32
93#endif
94
95//-------------- Common Classes, Enums, and Typdef's -------------------------//
96#define OIS_VERSION_MAJOR 1
97#define OIS_VERSION_MINOR 2
98#define OIS_VERSION_PATCH 0
99#define OIS_VERSION_NAME "Smash"
100
101#define OIS_VERSION ((OIS_VERSION_MAJOR << 16) | (OIS_VERSION_MINOR << 8) | OIS_VERSION_PATCH)
102
103namespace OIS
104{
105        //Forward Declarations
106        class InputManager;
107        class FactoryCreator;
108        class Object;
109        class Keyboard;
110        class Mouse;
111        class JoyStick;
112        class KeyListener;
113        class MouseListener;
114        class JoyStickListener;
115        class Interface;
116        class ForceFeedback;
117        class Effect;
118        class Exception;
119
120        //! Way to send OS nuetral parameters.. ie OS Window handles, modes, flags
121        typedef std::multimap<std::string, std::string> ParamList;
122
123        //! List of FactoryCreator's
124        typedef std::vector<FactoryCreator*> FactoryList;
125
126        //! Map of FactoryCreator created Objects
127        typedef std::map<Object*, FactoryCreator*> FactoryCreatedObject;
128
129        //! Each Input class has a General Type variable, a form of RTTI
130    enum Type
131        {
132                OISUnknown   = 0,
133                OISKeyboard  = 1,
134                OISMouse     = 2,
135                OISJoyStick  = 3,
136                OISTablet    = 4
137        };
138
139        //! Map of device objects connected and their respective vendors
140        typedef std::multimap<Type, std::string> DeviceList;
141
142        //--------     Shared common components    ------------------------//
143
144        //! Base type for all device components (button, axis, etc)
145    enum ComponentType
146        {
147                OIS_Unknown = 0,
148                OIS_Button  = 1, //ie. Key, mouse button, joy button, etc
149                OIS_Axis    = 2, //ie. A joystick or mouse axis
150                OIS_Slider  = 3, //
151                OIS_POV     = 4, //ie. Arrow direction keys
152                OIS_Vector3 = 5  //ie. WiiMote orientation
153        };
154
155        //! Base of all device components (button, axis, etc)
156        class _OISExport Component
157        {
158        public:
159                Component() : cType(OIS_Unknown) {};
160                Component(ComponentType type) : cType(type) {};
161                //! Indicates what type of coponent this is
162                ComponentType cType;
163        };
164
165        //! Button can be a keyboard key, mouse button, etc
166        class _OISExport Button : public Component
167        {
168        public:
169                Button() {}
170                Button(bool bPushed) : Component(OIS_Button), pushed(bPushed) {};
171                //! true if pushed, false otherwise
172                bool pushed;
173        };
174
175        //! Axis component
176        class _OISExport Axis : public Component
177        {
178        public:
179                Axis() : Component(OIS_Axis), abs(0), rel(0), absOnly(false) {};
180
181                //! Absoulte and Relative value components
182                int abs, rel;
183
184                //! Indicates if this Axis only supports Absoulte (ie JoyStick)
185                bool absOnly;
186
187                //! Used internally by OIS
188                void clear()
189                {
190                        abs = rel = 0;
191                }
192        };
193
194        //! A 3D Vector component (perhaps an orientation, as in the WiiMote)
195        class _OISExport Vector3 : public Component
196        {
197        public:
198                Vector3() {}
199                Vector3(float _x, float _y, float _z) : Component(OIS_Vector3), x(_x), y(_y), z(_z) {};
200               
201                //! X component of vector
202                float x;
203               
204                //! Y component of vector
205                float y;
206
207                //! Z component of vector
208                float z;
209
210                void clear()
211                {
212                        x = y = z = 0.0f;
213                }
214        };
215}
216
217#endif //end if prereq header defined
Note: See TracBrowser for help on using the repository browser.