E:/Download/ois-1.0RC1/src/OISInputManager.cpp

Go to the documentation of this file.
00001 /*
00002 The zlib/libpng License
00003 
00004 Copyright (c) 2006 Phillip Castaneda (pjcast -- www.wreckedgames.com)
00005 
00006 This software is provided 'as-is', without any express or implied warranty. In no event will
00007 the authors be held liable for any damages arising from the use of this software.
00008 
00009 Permission is granted to anyone to use this software for any purpose, including commercial 
00010 applications, and to alter it and redistribute it freely, subject to the following
00011 restrictions:
00012 
00013     1. The origin of this software must not be misrepresented; you must not claim that 
00014                 you wrote the original software. If you use this software in a product, 
00015                 an acknowledgment in the product documentation would be appreciated but is 
00016                 not required.
00017 
00018     2. Altered source versions must be plainly marked as such, and must not be 
00019                 misrepresented as being the original software.
00020 
00021     3. This notice may not be removed or altered from any source distribution.
00022 */
00023 #include "OISInputManager.h"
00024 #include "OISException.h"
00025 #include <sstream>
00026 
00027 //Bring in correct Header / InputManager for current build platform
00028 #if defined OIS_SDL_PLATFORM
00029 #  include "SDL/SDLInputManager.h"
00030 #elif defined OIS_WIN32_PLATFORM
00031 #  include "win32/Win32InputManager.h"
00032 #elif defined OIS_LINUX_PLATFORM
00033 #  include "linux/LinuxInputManager.h"
00034 #elif defined OIS_APPLE_PLATFORM
00035 #  include "mac/MacInputManager.h"
00036 #elif defined OIS_XBOX_PLATFORM
00037 #  include "xbox/XBoxInputManager.h"
00038 #endif
00039 
00040 using namespace OIS;
00041 
00042 const char* gVersionName = OIS_VERSION_NAME;
00043 
00044 //----------------------------------------------------------------------------//
00045 unsigned int InputManager::getVersionNumber()
00046 {
00047         return OIS_VERSION;
00048 }
00049 
00050 //----------------------------------------------------------------------------//
00051 const char* InputManager::getVersionName()
00052 {
00053         return gVersionName;
00054 }
00055 
00056 //----------------------------------------------------------------------------//
00057 InputManager* InputManager::createInputSystem( std::size_t windowhandle )
00058 {
00059         ParamList pl;
00060         std::ostringstream wnd;
00061         wnd << windowhandle;
00062         pl.insert(std::make_pair( std::string("WINDOW"), wnd.str() ));
00063 
00064         return createInputSystem( pl );
00065 }
00066 
00067 //----------------------------------------------------------------------------//
00068 InputManager* InputManager::createInputSystem( ParamList &paramList )
00069 {
00070         InputManager* im = 0;
00071 
00072 #if defined OIS_SDL_PLATFORM
00073         im = new SDLInputManager();
00074 #elif defined OIS_WIN32_PLATFORM
00075         im = new Win32InputManager();
00076 #elif defined OIS_XBOX_PLATFORM
00077         im = new XBoxInputManager();
00078 #elif defined OIS_LINUX_PLATFORM
00079         im = new LinuxInputManager();
00080 #elif defined OIS_APPLE_PLATFORM
00081         im = new MacInputManager();
00082 #else
00083         OIS_EXCEPT(E_General, "No platform library.. check build platform defines!");
00084 #endif 
00085 
00086         try
00087         {
00088                 im->_initialize(paramList);
00089         }
00090         catch(...)
00091         {
00092                 delete im;
00093                 throw; //rethrow
00094         }
00095 
00096         return im;
00097 }
00098 
00099 //----------------------------------------------------------------------------//
00100 void InputManager::destroyInputSystem(InputManager* manager)
00101 {
00102         delete manager;
00103 }

Generated on Sat Dec 1 20:13:52 2007 for OIS by  doxygen 1.5.4