Commit 884d3ea4 authored by Jordan Milne's avatar Jordan Milne

Rip out OIS, fill the holes with SDL goodness. WIP.

parent e31cd1c8
......@@ -204,7 +204,7 @@ endif()
find_package(OGRE REQUIRED)
find_package(MyGUI REQUIRED)
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
find_package(OIS REQUIRED)
find_package(SDL2 REQUIRED)
find_package(OpenAL REQUIRED)
find_package(Bullet REQUIRED)
IF(OGRE_STATIC)
......@@ -218,7 +218,8 @@ ENDIF(OGRE_STATIC)
include_directories("."
${OGRE_INCLUDE_DIR} ${OGRE_INCLUDE_DIR}/Ogre ${OGRE_INCLUDE_DIR}/OGRE ${OGRE_PLUGIN_INCLUDE_DIRS}
${OGRE_Terrain_INCLUDE_DIR}
${OIS_INCLUDE_DIRS} ${Boost_INCLUDE_DIR}
${SDL2_INCLUDE_DIR}
${Boost_INCLUDE_DIR}
${PLATFORM_INCLUDE_DIR}
${MYGUI_INCLUDE_DIRS}
${MYGUI_PLATFORM_INCLUDE_DIRS}
......@@ -227,7 +228,7 @@ include_directories("."
${LIBDIR}
)
link_directories(${Boost_LIBRARY_DIRS} ${OGRE_LIB_DIR} ${MYGUI_LIB_DIR})
link_directories(${SDL2_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS} ${OGRE_LIB_DIR} ${MYGUI_LIB_DIR})
if (APPLE)
# List used Ogre plugins
......@@ -361,6 +362,7 @@ if(DPKG_PROGRAM)
SET(CPACK_DEBIAN_PACKAGE_NAME "openmw")
SET(CPACK_DEBIAN_PACKAGE_VERSION "${VERSION_STRING}")
SET(CPACK_PACKAGE_EXECUTABLES "openmw;OpenMW esmtool;Esmtool omwlauncher;OMWLauncher mwiniimporter;MWiniImporter")
#TODO: should SDL2 be mentioned in here somewhere?
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.11.2), libfreetype6 (>= 2.2.1), libgcc1 (>= 1:4.1.1), libmpg123-0 (>= 1.12.1), libois-1.3.0 (>= 1.3.0), libopenal1 (>= 1:1.12.854), libsndfile1 (>= 1.0.23), libstdc++6 (>= 4.4.5), libuuid1 (>= 2.17.2), libqtgui4 (>= 4.7.0)")
SET(CPACK_DEBIAN_PACKAGE_SECTION "Games")
......
......@@ -20,7 +20,7 @@ add_openmw_dir (mwrender
)
add_openmw_dir (mwinput
inputmanagerimp
inputmanagerimp sdlinputwrapper
)
add_openmw_dir (mwgui
......@@ -103,6 +103,7 @@ target_link_libraries(openmw
${SOUND_INPUT_LIBRARY}
${BULLET_LIBRARIES}
${MYGUI_LIBRARIES}
${SDL2_LIBRARY}
${MYGUI_PLATFORM_LIBRARIES}
"shiny"
"shiny.OgrePlatform"
......
This diff is collapsed.
......@@ -6,6 +6,7 @@
#include <components/settings/settings.hpp>
#include "../mwbase/inputmanager.hpp"
#include "sdlinputwrapper.hpp"
namespace OEngine
{
......@@ -35,18 +36,9 @@ namespace ICS
class InputControlSystem;
}
namespace OIS
{
class Keyboard;
class Mouse;
class InputManager;
}
#include <OISKeyboard.h>
#include <OISMouse.h>
#include <extern/oics/ICSChannelListener.h>
#include <extern/oics/ICSInputControlSystem.h>
#include <extern/oics/OISCompat.h>
namespace MWInput
{
......@@ -54,7 +46,12 @@ namespace MWInput
/**
* @brief Class that handles all input and key bindings for OpenMW.
*/
class InputManager : public MWBase::InputManager, public OIS::KeyListener, public OIS::MouseListener, public ICS::ChannelListener, public ICS::DetectingBindingListener
class InputManager :
public MWBase::InputManager,
public ICS::MWSDLKeyListener,
public ICS::MWSDLMouseListener,
public ICS::ChannelListener,
public ICS::DetectingBindingListener
{
public:
InputManager(OEngine::Render::OgreRenderer &_ogre,
......@@ -85,12 +82,12 @@ namespace MWInput
virtual void resetToDefaultBindings();
public:
virtual bool keyPressed( const OIS::KeyEvent &arg );
virtual bool keyReleased( const OIS::KeyEvent &arg );
virtual bool keyPressed(const SDL_KeyboardEvent &arg );
virtual bool keyReleased( const SDL_KeyboardEvent &arg );
virtual bool mousePressed( const OIS::MouseEvent &arg, OIS::MouseButtonID id );
virtual bool mouseReleased( const OIS::MouseEvent &arg, OIS::MouseButtonID id );
virtual bool mouseMoved( const OIS::MouseEvent &arg );
virtual bool mousePressed( const SDL_MouseButtonEvent &arg, Uint8 id );
virtual bool mouseReleased( const SDL_MouseButtonEvent &arg, Uint8 id );
virtual bool mouseMoved( const ICS::MWSDLMouseMotionEvent &arg );
virtual void channelChanged(ICS::Channel* channel, float currentValue, float previousValue);
......@@ -98,7 +95,7 @@ namespace MWInput
, ICS::InputControlSystem::NamedAxis axis, ICS::Control::ControlChangingDirection direction);
virtual void keyBindingDetected(ICS::InputControlSystem* ICS, ICS::Control* control
, OIS::KeyCode key, ICS::Control::ControlChangingDirection direction);
, SDL_Keycode key, ICS::Control::ControlChangingDirection direction);
virtual void mouseButtonBindingDetected(ICS::InputControlSystem* ICS, ICS::Control* control
, unsigned int button, ICS::Control::ControlChangingDirection direction);
......@@ -125,9 +122,8 @@ namespace MWInput
ICS::InputControlSystem* mInputCtrl;
OIS::Keyboard* mKeyboard;
OIS::Mouse* mMouse;
OIS::InputManager* mInputManager;
MWSDLInputWrapper* mInputManager;
std::string mUserFile;
......
#include "sdlinputwrapper.hpp"
#include <SDL2/SDL.h>
namespace MWInput
{
MWSDLInputWrapper::MWSDLInputWrapper(Ogre::RenderWindow *window) :
mWindow(window), mStarted(false), mSDLWindow(NULL)
{
_start();
}
MWSDLInputWrapper::~MWSDLInputWrapper()
{
SDL_DestroyWindow(mSDLWindow);
mSDLWindow = NULL;
SDL_Quit();
}
void MWSDLInputWrapper::capture()
{
_start();
SDL_Event evt;
while(SDL_PollEvent(&evt))
{
switch(evt.type)
{
case SDL_MOUSEMOTION:
mMouseListener->mouseMoved(ICS::MWSDLMouseMotionEvent(evt.motion));
break;
case SDL_MOUSEWHEEL:
mMouseListener->mouseMoved(ICS::MWSDLMouseMotionEvent(evt.wheel));
break;
case SDL_MOUSEBUTTONDOWN:
mMouseListener->mousePressed(evt.button, evt.button.button);
break;
case SDL_MOUSEBUTTONUP:
mMouseListener->mouseReleased(evt.button, evt.button.button);
break;
case SDL_KEYDOWN:
mKeyboardListener->keyPressed(evt.key);
break;
case SDL_KEYUP:
mKeyboardListener->keyReleased(evt.key);
break;
}
}
}
bool MWSDLInputWrapper::isModifierHeld(int mod)
{
return SDL_GetModState() & mod;
}
void MWSDLInputWrapper::_start()
{
Uint32 flags = SDL_INIT_VIDEO;
if(SDL_WasInit(flags) == 0)
{
//get the HWND from ogre's renderwindow
size_t windowHnd;
mWindow->getCustomAttribute("WINDOW", &windowHnd);
//just use that one for input
SDL_Init(flags);
mSDLWindow = SDL_CreateWindowFrom((void*)windowHnd);
}
}
}
#ifndef _MWINPUT_SDLINPUTWRAPPER_H
#define _MWINPUT_SDLINPUTWRAPPER_H
#include "SDL2/SDL_events.h"
#include <extern/oics/OISCompat.h>
#include <OGRE/OgreRenderWindow.h>
namespace MWInput
{
class MWSDLInputWrapper
{
public:
MWSDLInputWrapper(Ogre::RenderWindow* window);
~MWSDLInputWrapper();
void setMouseEventCallback(ICS::MWSDLMouseListener* listen) { mMouseListener = listen; }
void setKeyboardEventCallback(ICS::MWSDLKeyListener* listen) { mKeyboardListener = listen; }
void capture();
bool isModifierHeld(int mod);
private:
ICS::MWSDLMouseListener* mMouseListener;
ICS::MWSDLKeyListener* mKeyboardListener;
Ogre::RenderWindow* mWindow;
SDL_Window* mSDLWindow;
bool mStarted;
void _start();
};
}
#endif
# Locate SDL2 library
# This module defines
# SDL2_LIBRARY, the name of the library to link against
# SDL2_FOUND, if false, do not try to link to SDL2
# SDL2_INCLUDE_DIR, where to find SDL.h
#
# This module responds to the the flag:
# SDL2_BUILDING_LIBRARY
# If this is defined, then no SDL2_main will be linked in because
# only applications need main().
# Otherwise, it is assumed you are building an application and this
# module will attempt to locate and set the the proper link flags
# as part of the returned SDL2_LIBRARY variable.
#
# Don't forget to include SDL2main.h and SDL2main.m your project for the
# OS X framework based version. (Other versions link to -lSDL2main which
# this module will try to find on your behalf.) Also for OS X, this
# module will automatically add the -framework Cocoa on your behalf.
#
#
# Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration
# and no SDL2_LIBRARY, it means CMake did not find your SDL2 library
# (SDL2.dll, libsdl2.so, SDL2.framework, etc).
# Set SDL2_LIBRARY_TEMP to point to your SDL2 library, and configure again.
# Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value
# as appropriate. These values are used to generate the final SDL2_LIBRARY
# variable, but when these values are unset, SDL2_LIBRARY does not get created.
#
#
# $SDL2DIR is an environment variable that would
# correspond to the ./configure --prefix=$SDL2DIR
# used in building SDL2.
# l.e.galup 9-20-02
#
# Modified by Eric Wing.
# Added code to assist with automated building by using environmental variables
# and providing a more controlled/consistent search behavior.
# Added new modifications to recognize OS X frameworks and
# additional Unix paths (FreeBSD, etc).
# Also corrected the header search path to follow "proper" SDL2 guidelines.
# Added a search for SDL2main which is needed by some platforms.
# Added a search for threads which is needed by some platforms.
# Added needed compile switches for MinGW.
#
# On OSX, this will prefer the Framework version (if found) over others.
# People will have to manually change the cache values of
# SDL2_LIBRARY to override this selection or set the CMake environment
# CMAKE_INCLUDE_PATH to modify the search paths.
#
# Note that the header path has changed from SDL2/SDL.h to just SDL.h
# This needed to change because "proper" SDL2 convention
# is #include "SDL.h", not <SDL2/SDL.h>. This is done for portability
# reasons because not all systems place things in SDL2/ (see FreeBSD).
#
# Ported by Johnny Patterson. This is a literal port for SDL2 of the FindSDL.cmake
# module with the minor edit of changing "SDL" to "SDL2" where necessary. This
# was not created for redistribution, and exists temporarily pending official
# SDL2 CMake modules.
#=============================================================================
# Copyright 2003-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
FIND_PATH(SDL2_INCLUDE_DIR SDL.h
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES include/SDL2 include
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local/include/SDL2
/usr/include/SDL2
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
#MESSAGE("SDL2_INCLUDE_DIR is ${SDL2_INCLUDE_DIR}")
FIND_LIBRARY(SDL2_LIBRARY_TEMP
NAMES SDL2
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES lib64 lib
PATHS
/sw
/opt/local
/opt/csw
/opt
)
#MESSAGE("SDL2_LIBRARY_TEMP is ${SDL2_LIBRARY_TEMP}")
IF(NOT SDL2_BUILDING_LIBRARY)
IF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
# Non-OS X framework versions expect you to also dynamically link to
# SDL2main. This is mainly for Windows and OS X. Other (Unix) platforms
# seem to provide SDL2main for compatibility even though they don't
# necessarily need it.
FIND_LIBRARY(SDL2MAIN_LIBRARY
NAMES SDL2main
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES lib64 lib
PATHS
/sw
/opt/local
/opt/csw
/opt
)
ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
ENDIF(NOT SDL2_BUILDING_LIBRARY)
# SDL2 may require threads on your system.
# The Apple build may not need an explicit flag because one of the
# frameworks may already provide it.
# But for non-OSX systems, I will use the CMake Threads package.
IF(NOT APPLE)
FIND_PACKAGE(Threads)
ENDIF(NOT APPLE)
# MinGW needs an additional library, mwindows
# It's total link flags should look like -lmingw32 -lSDL2main -lSDL2 -lmwindows
# (Actually on second look, I think it only needs one of the m* libraries.)
IF(MINGW)
SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW")
ENDIF(MINGW)
SET(SDL2_FOUND "NO")
IF(SDL2_LIBRARY_TEMP)
# For SDL2main
IF(NOT SDL2_BUILDING_LIBRARY)
IF(SDL2MAIN_LIBRARY)
SET(SDL2_LIBRARY_TEMP ${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY_TEMP})
ENDIF(SDL2MAIN_LIBRARY)
ENDIF(NOT SDL2_BUILDING_LIBRARY)
# For OS X, SDL2 uses Cocoa as a backend so it must link to Cocoa.
# CMake doesn't display the -framework Cocoa string in the UI even
# though it actually is there if I modify a pre-used variable.
# I think it has something to do with the CACHE STRING.
# So I use a temporary variable until the end so I can set the
# "real" variable in one-shot.
IF(APPLE)
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa")
ENDIF(APPLE)
# For threads, as mentioned Apple doesn't need this.
# In fact, there seems to be a problem if I used the Threads package
# and try using this line, so I'm just skipping it entirely for OS X.
IF(NOT APPLE)
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
ENDIF(NOT APPLE)
# For MinGW library
IF(MINGW)
SET(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP})
ENDIF(MINGW)
# Set the final string here so the GUI reflects the final state.
SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found")
# Set the temp variable to INTERNAL so it is not seen in the CMake GUI
SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "")
SET(SDL2_FOUND "YES")
ENDIF(SDL2_LIBRARY_TEMP)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2
REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)
......@@ -9,6 +9,7 @@ set(OICS_SOURCE_FILES
ICSInputControlSystem_keyboard.cpp
ICSInputControlSystem_mouse.cpp
ICSInputControlSystem_joystick.cpp
OISCompat.h
tinyxml.cpp
tinyxmlparser.cpp
tinyxmlerror.cpp
......
......@@ -41,7 +41,7 @@ namespace ICS
this->mActive = active;
this->fillOISKeysMap();
this->fillSDLKeysMap();
ICS_LOG("Channel count = " + ToString<size_t>(channelCount) );
for(size_t i=0;i<channelCount;i++)
......@@ -429,7 +429,7 @@ namespace ICS
control.SetAttribute( "axisBindable", "false" );
}
if(getKeyBinding(*o, Control/*::ControlChangingDirection*/::INCREASE) != OIS::KC_UNASSIGNED)
if(getKeyBinding(*o, Control/*::ControlChangingDirection*/::INCREASE) != SDLK_UNKNOWN)
{
TiXmlElement keyBinder( "KeyBinder" );
......@@ -439,7 +439,7 @@ namespace ICS
control.InsertEndChild(keyBinder);
}
if(getKeyBinding(*o, Control/*::ControlChangingDirection*/::DECREASE) != OIS::KC_UNASSIGNED)
if(getKeyBinding(*o, Control/*::ControlChangingDirection*/::DECREASE) != SDLK_UNKNOWN)
{
TiXmlElement keyBinder( "KeyBinder" );
......@@ -503,15 +503,15 @@ namespace ICS
TiXmlElement binder( "MouseButtonBinder" );
unsigned int button = getMouseButtonBinding(*o, Control/*::ControlChangingDirection*/::INCREASE);
if(button == OIS::/*MouseButtonID::*/MB_Left)
if(button == SDL_BUTTON_LEFT)
{
binder.SetAttribute( "button", "LEFT" );
}
else if(button == OIS::/*MouseButtonID::*/MB_Middle)
else if(button == SDL_BUTTON_MIDDLE)
{
binder.SetAttribute( "button", "MIDDLE" );
}
else if(button == OIS::/*MouseButtonID::*/MB_Right)
else if(button == SDL_BUTTON_RIGHT)
{
binder.SetAttribute( "button", "RIGHT" );
}
......@@ -529,15 +529,15 @@ namespace ICS
TiXmlElement binder( "MouseButtonBinder" );
unsigned int button = getMouseButtonBinding(*o, Control/*::ControlChangingDirection*/::DECREASE);
if(button == OIS::/*MouseButtonID::*/MB_Left)
if(button == SDL_BUTTON_LEFT)
{
binder.SetAttribute( "button", "LEFT" );
}
else if(button == OIS::/*MouseButtonID::*/MB_Middle)
else if(button == SDL_BUTTON_MIDDLE)
{
binder.SetAttribute( "button", "MIDDLE" );
}
else if(button == OIS::/*MouseButtonID::*/MB_Right)
else if(button == SDL_BUTTON_RIGHT)
{
binder.SetAttribute( "button", "RIGHT" );
}
......@@ -801,129 +801,132 @@ namespace ICS
mDetectingBindingControl = NULL;
}
void InputControlSystem::fillOISKeysMap()
void InputControlSystem::fillSDLKeysMap()
{
mKeys["UNASSIGNED"]= OIS::KC_UNASSIGNED;
mKeys["ESCAPE"]= OIS::KC_ESCAPE;
mKeys["1"]= OIS::KC_1;
mKeys["2"]= OIS::KC_2;
mKeys["3"]= OIS::KC_3;
mKeys["4"]= OIS::KC_4;
mKeys["5"]= OIS::KC_5;
mKeys["6"]= OIS::KC_6;
mKeys["7"]= OIS::KC_7;
mKeys["8"]= OIS::KC_8;
mKeys["9"]= OIS::KC_9;
mKeys["0"]= OIS::KC_0;
mKeys["MINUS"]= OIS::KC_MINUS;
mKeys["EQUALS"]= OIS::KC_EQUALS;
mKeys["BACK"]= OIS::KC_BACK;
mKeys["TAB"]= OIS::KC_TAB;
mKeys["Q"]= OIS::KC_Q;
mKeys["W"]= OIS::KC_W;
mKeys["E"]= OIS::KC_E;
mKeys["R"]= OIS::KC_R;
mKeys["T"]= OIS::KC_T;
mKeys["Y"]= OIS::KC_Y;
mKeys["U"]= OIS::KC_U;
mKeys["I"]= OIS::KC_I;
mKeys["O"]= OIS::KC_O;
mKeys["P"]= OIS::KC_P;
mKeys["LBRACKET"]= OIS::KC_LBRACKET;
mKeys["RBRACKET"]= OIS::KC_RBRACKET;
mKeys["RETURN"]= OIS::KC_RETURN;
mKeys["LCONTROL"]= OIS::KC_LCONTROL;
mKeys["A"]= OIS::KC_A;
mKeys["S"]= OIS::KC_S;
mKeys["D"]= OIS::KC_D;
mKeys["F"]= OIS::KC_F;
mKeys["G"]= OIS::KC_G;
mKeys["H"]= OIS::KC_H;
mKeys["J"]= OIS::KC_J;
mKeys["K"]= OIS::KC_K;
mKeys["L"]= OIS::KC_L;
mKeys["SEMICOLON"]= OIS::KC_SEMICOLON;
mKeys["APOSTROPHE"]= OIS::KC_APOSTROPHE;
mKeys["GRAVE"]= OIS::KC_GRAVE;
mKeys["LSHIFT"]= OIS::KC_LSHIFT;
mKeys["BACKSLASH"]= OIS::KC_BACKSLASH;
mKeys["Z"]= OIS::KC_Z;
mKeys["X"]= OIS::KC_X;
mKeys["C"]= OIS::KC_C;
mKeys["V"]= OIS::KC_V;
mKeys["B"]= OIS::KC_B;
mKeys["N"]= OIS::KC_N;
mKeys["M"]= OIS::KC_M;
mKeys["COMMA"]= OIS::KC_COMMA;
mKeys["PERIOD"]= OIS::KC_PERIOD;
mKeys["SLASH"]= OIS::KC_SLASH;
mKeys["RSHIFT"]= OIS::KC_RSHIFT;
mKeys["MULTIPLY"]= OIS::KC_MULTIPLY;
mKeys["LMENU"]= OIS::KC_LMENU;
mKeys["SPACE"]= OIS::KC_SPACE;
mKeys["CAPITAL"]= OIS::KC_CAPITAL;
mKeys["F1"]= OIS::KC_F1;
mKeys["F2"]= OIS::KC_F2;
mKeys["F3"]= OIS::KC_F3;
mKeys["F4"]= OIS::KC_F4;
mKeys["F5"]= OIS::KC_F5;
mKeys["F6"]= OIS::KC_F6;
mKeys["F7"]= OIS::KC_F7;
mKeys["F8"]= OIS::KC_F8;
mKeys["F9"]= OIS::KC_F9;
mKeys["F10"]= OIS::KC_F10;
mKeys["F11"]= OIS::KC_F11;
mKeys["F12"]= OIS::KC_F12;
mKeys["NUMLOCK"]= OIS::KC_NUMLOCK;
mKeys["SCROLL"]= OIS::KC_SCROLL;
mKeys["NUMPAD7"]= OIS::KC_NUMPAD7;
mKeys["NUMPAD8"]= OIS::KC_NUMPAD8;
mKeys["NUMPAD9"]= OIS::KC_NUMPAD9;
mKeys["SUBTRACT"]= OIS::KC_SUBTRACT;
mKeys["NUMPAD4"]= OIS::KC_NUMPAD4;
mKeys["NUMPAD5"]= OIS::KC_NUMPAD5;
mKeys["NUMPAD6"]= OIS::KC_NUMPAD6;
mKeys["ADD"]= OIS::KC_ADD;
mKeys["NUMPAD1"]= OIS::KC_NUMPAD1;
mKeys["NUMPAD2"]= OIS::KC_NUMPAD2;
mKeys["NUMPAD3"]= OIS::KC_NUMPAD3;
mKeys["NUMPAD0"]= OIS::KC_NUMPAD0;
mKeys["DECIMAL"]= OIS::KC_DECIMAL;
mKeys["RCONTROL"]= OIS::KC_RCONTROL;
mKeys["DIVIDE"]= OIS::KC_DIVIDE;
mKeys["SYSRQ"]= OIS::KC_SYSRQ;
mKeys["RMENU"]= OIS::KC_RMENU;
mKeys["PAUSE"]= OIS::KC_PAUSE;
mKeys["HOME"]= OIS::KC_HOME;
mKeys["UP"]= OIS::KC_UP;
mKeys["PGUP"]= OIS::KC_PGUP;
mKeys["LEFT"]= OIS::KC_LEFT;
mKeys["RIGHT"]= OIS::KC_RIGHT;
mKeys["END"]= OIS::KC_END;
mKeys["DOWN"]= OIS::KC_DOWN;
mKeys["PGDOWN"]= OIS::KC_PGDOWN;
mKeys["INSERT"]= OIS::KC_INSERT;
mKeys["DELETE"]= OIS::KC_DELETE;
mKeys["LWIN"]= OIS::KC_LWIN;
mKeys["RWIN"]= OIS::KC_RWIN;
mKeys["APPS"]= OIS::KC_APPS;
mKeys["NUMPADENTER"]= OIS::KC_NUMPADENTER;
for(std::map<std::string, OIS::KeyCode>::iterator it = mKeys.begin()
mKeys["UNASSIGNED"]= SDLK_UNKNOWN;
mKeys["ESCAPE"]= SDLK_ESCAPE;
mKeys["1"]= SDLK_1;
mKeys["2"]= SDLK_2;
mKeys["3"]= SDLK_3;
mKeys["4"]= SDLK_4;
mKeys["5"]= SDLK_5;
mKeys["6"]= SDLK_6;
mKeys["7"]= SDLK_7;
mKeys["8"]= SDLK_8;
mKeys["9"]= SDLK_9;
mKeys["0"]= SDLK_0;
mKeys["MINUS"]= SDLK_MINUS;
mKeys["EQUALS"]= SDLK_EQUALS;
mKeys["BACK"]= SDLK_BACKSPACE;
mKeys["TAB"]= SDLK_TAB;
mKeys["Q"]= SDLK_q;
mKeys["W"]= SDLK_w;
mKeys["E"]= SDLK_e;
mKeys["R"]= SDLK_r;
mKeys["T"]= SDLK_t;
mKeys["Y"]= SDLK_y;
mKeys["U"]= SDLK_u;
mKeys["I"]= SDLK_i;
mKeys["O"]= SDLK_o;
mKeys["P"]= SDLK_p;
mKeys["LBRACKET"]= SDLK_LEFTBRACKET;
mKeys["RBRACKET"]= SDLK_RIGHTBRACKET;
mKeys["RETURN"]= SDLK_RETURN;
mKeys["LCONTROL"]= SDLK_LCTRL;
mKeys["A"]= SDLK_a;
mKeys["S"]= SDLK_s;
mKeys["D"]= SDLK_d;
mKeys["F"]= SDLK_f;
mKeys["G"]= SDLK_g;
mKeys["H"]= SDLK_h;
mKeys["J"]= SDLK_j;
mKeys["K"]= SDLK_k;
mKeys["L"]= SDLK_l;
mKeys["SEMICOLON"]= SDLK_SEMICOLON;
mKeys["APOSTROPHE"]= SDLK_QUOTE;
mKeys["GRAVE"]= SDLK_BACKQUOTE;
mKeys["LSHIFT"]= SDLK_LSHIFT;
mKeys["BACKSLASH"]= SDLK_BACKSLASH;
mKeys["Z"]= SDLK_z;
mKeys["X"]= SDLK_x;
mKeys["C"]= SDLK_c;
mKeys["V"]= SDLK_v;
mKeys["B"]= SDLK_b;
mKeys["N"]= SDLK_n;
mKeys["M"]= SDLK_m;
mKeys["COMMA"]= SDLK_COMMA;
mKeys["PERIOD"]= SDLK_PERIOD;
mKeys["SLASH"]= SDLK_SLASH;
mKeys["RSHIFT"]= SDLK_RSHIFT;
mKeys["MULTIPLY"]= SDLK_ASTERISK;
mKeys["LMENU"]= SDLK_LALT;
mKeys["SPACE"]= SDLK_SPACE;
mKeys["CAPITAL"]= SDLK_CAPSLOCK;
mKeys["F1"]= SDLK_F1;
mKeys["F2"]= SDLK_F2;
mKeys["F3"]= SDLK_F3;
mKeys["F4"]= SDLK_F4;
mKeys["F5"]= SDLK_F5;
mKeys["F6"]= SDLK_F6;
mKeys["F7"]= SDLK_F7;
mKeys["F8"]= SDLK_F8;
mKeys["F9"]= SDLK_F9;
mKeys["F10"]= SDLK_F10;
mKeys["F11"]= SDLK_F11;
mKeys["F12"]= SDLK_F12;
mKeys["NUMLOCK"]= SDLK_NUMLOCKCLEAR;
mKeys["SCROLL"]= SDLK_SCROLLLOCK;
mKeys["NUMPAD7"]= SDLK_KP_7;
mKeys["NUMPAD8"]= SDLK_KP_8;
mKeys["NUMPAD9"]= SDLK_KP_9;
mKeys["SUBTRACT"]= SDLK_KP_MINUS;
mKeys["NUMPAD4"]= SDLK_KP_4;
mKeys["NUMPAD5"]= SDLK_KP_5;
mKeys["NUMPAD6"]= SDLK_KP_6;
mKeys["ADD"]= SDLK_KP_PLUS;
mKeys["NUMPAD1"]= SDLK_KP_1;
mKeys["NUMPAD2"]= SDLK_KP_2;
mKeys["NUMPAD3"]= SDLK_KP_3;
mKeys["NUMPAD0"]= SDLK_KP_0;
mKeys["DECIMAL"]= SDLK_KP_DECIMAL;
mKeys["RCONTROL"]= SDLK_RCTRL;
mKeys["DIVIDE"]= SDLK_SLASH;
mKeys["SYSRQ"]= SDLK_SYSREQ;
mKeys["RMENU"]= SDLK_RALT;
mKeys["PAUSE"]= SDLK_PAUSE;
mKeys["HOME"]= SDLK_HOME;
mKeys["UP"]= SDLK_UP;
mKeys["PGUP"]= SDLK_PAGEUP;
mKeys["LEFT"]= SDLK_LEFT;
mKeys["RIGHT"]= SDLK_RIGHT;
mKeys["END"]= SDLK_END;
mKeys["DOWN"]= SDLK_DOWN;
mKeys["PGDOWN"]= SDLK_PAGEDOWN;
mKeys["INSERT"]= SDLK_INSERT;
mKeys["DELETE"]= SDLK_DELETE;
mKeys["NUMPADENTER"]= SDLK_KP_ENTER;
for(std::map<std::string, SDL_Keycode>::iterator it = mKeys.begin()
; it != mKeys.end() ; it++)
{
mKeyCodes[ it->second ] = it->first;
}