Page principale | Hiérarchie des classes | Liste alphabétique | Liste des classes | Liste des fichiers | Membres de classe

C:/Projects/ngn/include/input.h

00001 /***************************************************************************
00002  *            input.h
00003  *
00004  *  Sat Sep 11 10:35:54 2004
00005  *  Copyright  2004  thierry schartz
00006  *  thierry.schartz@bluebottle.com
00007  ****************************************************************************/
00008 
00009 /*
00010  *  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  You should have received a copy of the GNU General Public License
00021  *  along with this program; if not, write to the Free Software
00022  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00023  */
00024  
00025 #ifndef _INPUT_H
00026 #define _INPUT_H
00027 
00028 #ifdef WIN32
00029 #include <windows.h>
00030 #endif
00031 
00032 
00033 #include "types.h"
00034 #include "build.h"
00035 
00036 namespace ngn
00037 {
00042     class NGN_API InputHandler
00043         {
00044                 public:
00045                         InputHandler();
00046                         virtual ~InputHandler();
00047                         
00049                         void handleEvents();
00051                         void moveForward( bool state=true );
00053                         void moveBackward(bool state=true);
00055                         void moveLeft(bool state=true);
00057                         void moveRight(bool state=true);
00059                         bool isMoveBackwardPressed()const;
00061                         bool isMoveForwardPressed()const;
00063                         bool isMoveLeftPressed()const;
00065                         bool isMoveRightPressed()const;
00067                         int getMousePositionX()const;
00069                         int getMousePositionY()const;
00070                         unsigned int getMouseButton()const;             // return a button bitmask ( can be tested with NGN_BUTTON(x) macro )
00071                         
00072                 
00073                 protected:
00074                         
00076                         virtual void handleKeyDown( NGN_KEY keysym ) = 0;
00078                         virtual void handleKeyUp( NGN_KEY keysym )= 0;
00080                         virtual void handleMouseButtonDown( NGN_MOUSE_BUTTON_EVENT button ) = 0;
00082                         virtual void handleMouseButtonUp( NGN_MOUSE_BUTTON_EVENT button ) = 0;
00083                                         
00084                 private:
00085                         
00086                         SDL_Event m_event;
00087                         bool m_fwd;
00088                         bool m_backwd;
00089                         bool m_left;
00090                         bool m_right;
00091         };
00092         
00093         
00094 
00095 }//ngn
00096 #endif /* _INPUT_H */

Généré le Fri Nov 19 14:20:29 2004 pour NGN par  doxygen 1.3.9.1