Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OgreSDLInput.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of OGRE
00004     (Object-oriented Graphics Rendering Engine)
00005 For the latest info, see http://ogre.sourceforge.net/
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 <SDL.h>
00035 
00036 namespace Ogre {
00037     class SDLInput : public InputReader
00038     {
00039     public:
00040         SDLInput();
00041         virtual ~SDLInput();
00042 
00043         void initialise( RenderWindow* pWindow, bool useKeyboard = true, bool useMouse = true, bool useGameController = false );
00044         void capture();
00045 
00046         bool isKeyDown( KeyCode kc ) const;
00047 
00048         /*
00049          * Mouse getters
00050          */
00051         virtual long getMouseRelX() const;
00052         virtual long getMouseRelY() const;
00053         virtual long getMouseRelZ() const;
00054 
00055         virtual long getMouseAbsX() const;
00056         virtual long getMouseAbsY() const;
00057         virtual long getMouseAbsZ() const;
00058 
00059         virtual void getMouseState( MouseState& state ) const;
00060 
00061         virtual bool getMouseButton( uchar button ) const;
00062 
00063     private:
00064         // State at last 'capture' call
00065         Uint8* mKeyboardBuffer;
00066         int mMaxKey;
00067         int mMouseX, mMouseY;
00068         int mMouseCenterX, mMouseCenterY;
00069         Real mScale;
00070         Uint8 mMouseKeys;
00071         bool _visible;
00072 
00073         void processBufferedMouse();
00074     };
00075 }
00076 
00077 #endif
00078 

Copyright © 2002 by The OGRE Team