GG

OISInput.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 /* GG is a GUI for SDL and OpenGL.
00003    Copyright (C) 2007 T. Zachary Laine
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public License
00007    as published by the Free Software Foundation; either version 2.1
00008    of the License, or (at your option) any later version.
00009    
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014     
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with this library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA
00019 
00020    If you do not wish to comply with the terms of the LGPL please
00021    contact the author as other terms are available for a fee.
00022     
00023    Zach Laine
00024    whatwasthataddress@gmail.com */
00025    
00029 #include <GG/Ogre/Plugins/OgreGUIInputPlugin.h>
00030 
00031 #include <OIS/OISKeyboard.h>
00032 #include <OIS/OISMouse.h>
00033 
00034 
00035 namespace OIS { class InputManager; }
00036 
00043 class GG_OGRE_PLUGIN_API OISInput :
00044     public GG::OgreGUIInputPlugin,
00045     public OIS::MouseListener,
00046     public OIS::KeyListener
00047 {
00048 public:
00049     OISInput();
00050     virtual ~OISInput();
00051 
00052     virtual const Ogre::String& getName() const;
00053     virtual void install();
00054     virtual void initialise();
00055     virtual void shutdown();
00056     virtual void uninstall();
00057 
00058 private:
00059     virtual void HandleSystemEvents();
00060     virtual void HandleWindowResize(GG::X width, GG::Y height);
00061     virtual void HandleWindowClose();
00062 
00063     virtual bool mouseMoved(const OIS::MouseEvent &event);
00064     virtual bool mousePressed(const OIS::MouseEvent &event, OIS::MouseButtonID id);
00065     virtual bool mouseReleased(const OIS::MouseEvent &event, OIS::MouseButtonID id);
00066 
00067     virtual bool keyPressed(const OIS::KeyEvent& event);
00068     virtual bool keyReleased(const OIS::KeyEvent& event);
00069 
00070     void CleanupInputManager();
00071 
00072     OIS::InputManager*  m_input_manager;
00073     OIS::Mouse*         m_mouse;
00074     OIS::Keyboard*      m_keyboard;
00075 };