00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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;
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 }
00096 #endif