Gazebo

InputHandler.hh

00001 /*
00002  *  Gazebo - Outdoor Multi-Robot Simulator
00003  *  Copyright (C) 2003  
00004  *     Nate Koenig & Andrew Howard
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 /* Desc: Gazebo input handler
00022  * Author: Nate Koenig
00023  * Date: 17 Sep 2007
00024  * SVN: $Id:$
00025  */
00026 
00027 #ifndef INPUTHANDLER_HH
00028 #define INPUTHANDLER_HH
00029 
00030 #include <map>
00031 
00032 #include "Vector3.hh"
00033 #include "Vector2.hh"
00034 #include "SingletonT.hh"
00035 
00036 namespace gazebo
00037 {
00038   class InputEvent;
00039 
00041   class InputHandler : public SingletonT<InputHandler>
00042   {
00044     public: InputHandler ();
00045   
00047     public: virtual ~InputHandler();
00048   
00050     public: void HandleEvent( const InputEvent *event );
00051 
00053     public: void ClearEvents();
00054 
00056     public: void Update();
00057 
00058     private: void HandleKeyPress( const InputEvent *event );
00059     private: bool HandleKeyRelease( const InputEvent *event );
00060 
00062     private: void HandleDrag( const InputEvent *event );
00063 
00064     private: friend class DestroyerT<InputHandler>;
00065     private: friend class SingletonT<InputHandler>;
00066 
00067     private: float moveAmount;
00068     private: float moveScale;
00069     private: float rotateAmount;
00070 
00071     private: Vector3 directionVec;
00072 
00073     private: bool leftMousePressed;
00074     private: bool rightMousePressed;
00075     private: bool middleMousePressed;
00076     private: Vector2<int> prevMousePos;
00077     private: std::map<int,int> keys;
00078   };
00079   
00080 }
00081 #endif

Last updated Aug 04 2007