00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright © 2000-2002 The OGRE Team 00008 Also see acknowledgements in Readme.html 00009 00010 This program is free software; you can redistribute it and/or modify it under 00011 the terms of the GNU Lesser General Public License as published by the Free Software 00012 Foundation; either version 2 of the License, or (at your option) any later 00013 version. 00014 00015 This program is distributed in the hope that it will be useful, but WITHOUT 00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License along with 00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00022 http://www.gnu.org/copyleft/lesser.txt. 00023 ----------------------------------------------------------------------------- 00024 */ 00025 00026 00027 #ifndef __SDLInputReader_H__ 00028 #define __SDLInputReader_H__ 00029 00030 #include "OgreInput.h" 00031 #include "OgreInputEvent.h" 00032 #include "OgreRenderWindow.h" 00033 00034 #include <map> 00035 00036 #include <SDL.h> 00037 00038 namespace Ogre { 00039 class SDLInput : public InputReader 00040 { 00041 public: 00042 SDLInput(); 00043 virtual ~SDLInput(); 00044 00045 void initialise( RenderWindow* pWindow, bool useKeyboard = true, bool useMouse = true, bool useGameController = false ); 00046 void capture(); 00047 00048 bool isKeyDown( KeyCode kc ) const; 00049 00050 /* 00051 * Mouse getters 00052 */ 00053 virtual long getMouseRelX() const; 00054 virtual long getMouseRelY() const; 00055 virtual long getMouseRelZ() const; 00056 00057 virtual long getMouseAbsX() const; 00058 virtual long getMouseAbsY() const; 00059 virtual long getMouseAbsZ() const; 00060 00061 virtual void getMouseState( MouseState& state ) const; 00062 00063 virtual bool getMouseButton( uchar button ) const; 00064 00065 private: 00066 // State at last 'capture' call 00067 Uint8* mKeyboardBuffer; 00068 int mMaxKey; 00069 int mMouseX, mMouseY; 00070 int mMouseRelativeX, mMouseRelativeY, mMouseRelativeZ; 00071 Real mScale; 00072 Uint8 mMouseKeys; 00073 bool _visible; 00074 typedef std::map<SDLKey, KeyCode> InputKeyMap; 00075 InputKeyMap _key_map; 00076 bool warpMouse; 00077 00078 static const unsigned int mWheelStep = 60; 00079 void processBufferedKeyboard(); 00080 void processBufferedMouse(); 00081 }; 00082 } 00083 00084 #endif 00085
Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:22:46 2004