00001 #ifndef _MOUSE_H
00002
00003 #include <SDL/SDL.h>
00004 #include "camera.h"
00005 #include "quat.h"
00006 #include "settings.h"
00007
00008 #include "globals.h"
00009
00010
00011
00012 #define EARTH_RADIUS 637800.0
00013
00014 #define ZOOMSPEED 1.0
00015
00016 class MOUSE
00017 {
00018 private:
00019 float mousezoom;
00020 QUATERNION viewdir;
00021
00022 void UpdateCamera(CAMERA & cam, int mousePos_x, int mousePos_y, float timefactor, float fps);
00023 void UpdateSteering(int x, int y);
00024 float mouse_sensitivity_x, mouse_sensitivity_y;
00025 float deadzone_y;
00026 float steer_x, steer_y;
00027 bool lbounce, mbounce, rbounce, lastl, lastm, lastr, upbounce, downbounce, lastup, lastdown;
00028 void ClearBounce() {lbounce = false; rbounce = false; lastl = false; lastr = false;}
00029
00030 public:
00031 MOUSE();
00032 void Update(CAMERA & cam, int screenw, int screenh, float timefactor, float fps);
00033 float GetZoom() {return mousezoom;}
00034 QUATERNION GetDir() {return viewdir;}
00035 void InitDir(QUATERNION newd) {viewdir = newd;}
00036 bool GetMouseControls(float * x, float * y, bool * click_l, bool * click_r);
00037 bool IsPressed( int which_btn );
00038 void SetDeadzoneY(float newydz) {if (newydz > 1) newydz = 1; if (newydz < 0) newydz = 0; deadzone_y = newydz;}
00039 void SetSensitivityX(float newxs) {mouse_sensitivity_x = newxs;}
00040 void SetSensitivityY(float newys) {mouse_sensitivity_x = newys;}
00041 float GetDeadzoneY() {return deadzone_y;}
00042 float GetSensitivityX() {return mouse_sensitivity_x;}
00043 float GetSensitivityY() {return mouse_sensitivity_y;}
00044 void GetMousePos( int &xpos, int &ypos );
00045 void GetMouseButtons( bool &btn_l, bool &btn_m, bool &btn_r, bool &scroll_up, bool &scroll_down );
00046 void UpdateSettings();
00047 };
00048
00049 #define _MOUSE_H
00050 #endif