]> git.mxchange.org Git - flightgear.git/blobdiff - src/GUI/mouse.cxx
Added static port system and a new altimeter model connected to it.
[flightgear.git] / src / GUI / mouse.cxx
index 9a08c457b8bbdf17018ee562b1e3d015b90cf17d..71bb00e19bcef5905753ddf63c2d6a18dc07ba7d 100644 (file)
@@ -175,20 +175,30 @@ static inline int right_button( void ) {
 
 static inline void set_goal_view_offset( float offset )
 {
-       globals->get_current_view()->set_goal_view_offset(offset);
+       globals->get_current_view()->setGoalHeadingOffset_deg(offset * SGD_RADIANS_TO_DEGREES);
 }
 
 static inline void set_view_offset( float offset )
 {
-       globals->get_current_view()->set_view_offset(offset);
+       globals->get_current_view()->setHeadingOffset_deg(offset * SGD_RADIANS_TO_DEGREES);
+}
+
+static inline void set_goal_view_tilt( float tilt )
+{
+       globals->get_current_view()->setGoalPitchOffset_deg(tilt);
+}
+
+static inline void set_view_tilt( float tilt )
+{
+       globals->get_current_view()->setPitchOffset_deg(tilt);
 }
 
 static inline float get_view_offset() {
-       return globals->get_current_view()->get_view_offset();
+       return globals->get_current_view()->getHeadingOffset_deg() * SGD_DEGREES_TO_RADIANS;
 }
 
 static inline float get_goal_view_offset() {
-       return globals->get_current_view()->get_goal_view_offset();
+       return globals->get_current_view()->getGoalHeadingOffset_deg() * SGD_DEGREES_TO_RADIANS;
 }
 
 static inline void move_brake(float offset) {
@@ -224,11 +234,11 @@ static inline float get_elevator() {
 }
 
 static inline bool AP_HeadingEnabled() {
-       return current_autopilot->get_HeadingEnabled();
+       return globals->get_autopilot()->get_HeadingEnabled();
 }
 
 static inline bool AP_AltitudeEnabled() {
-       return current_autopilot->get_AltitudeEnabled();
+       return globals->get_autopilot()->get_AltitudeEnabled();
 }
 
 void TurnCursorOn( void )
@@ -476,8 +486,10 @@ void guiMotionFunc ( int x, int y )
                     offset -= SGD_2PI;
                 }
                 set_goal_view_offset(offset);
+                set_goal_view_tilt(asin( GuiQuat_mat[1][2]) * SGD_RADIANS_TO_DEGREES );
 #ifdef NO_SMOOTH_MOUSE_VIEW
                 set_view_offset(offset);
+                set_view_tilt(asin( GuiQuat_mat[1][2]) * SGD_RADIANS_TO_DEGREES );
 #endif
                 break;
             
@@ -506,9 +518,6 @@ void guiMouseFunc(int button, int updown, int x, int y)
     static float _quat[4];
     static double _view_offset;
     
-    // general purpose variables
-    double offset;
-            
     glutModifiers = glutGetModifiers();
     glut_active_shift = glutModifiers & GLUT_ACTIVE_SHIFT;
     glut_active_ctrl  = glutModifiers & GLUT_ACTIVE_CTRL; 
@@ -532,6 +541,7 @@ void guiMouseFunc(int button, int updown, int x, int y)
                         y = _Vy;
                         sgCopyVec4(curGuiQuat, _quat);
                         set_goal_view_offset(_view_offset);
+                        set_goal_view_tilt(0.0);
 #ifdef NO_SMOOTH_MOUSE_VIEW
                         set_view_offset(_view_offset);
 #endif
@@ -547,8 +557,10 @@ void guiMouseFunc(int button, int updown, int x, int y)
                         Quat0();
                         _view_offset = get_goal_view_offset();
                         set_goal_view_offset(0.0);
+                        set_goal_view_tilt(0.0);
 #ifdef NO_SMOOTH_MOUSE_VIEW
                         set_view_offset(0.0);
+                        set_view_tilt(0.0);
 #endif
                     }
                     glutWarpPointer( x , y);
@@ -605,8 +617,10 @@ void guiMouseFunc(int button, int updown, int x, int y)
                     Quat0();
                     build_rotmatrix(GuiQuat_mat, curGuiQuat);
                     set_goal_view_offset(0.0);
+                    set_goal_view_tilt(0.0);
 #ifdef NO_SMOOTH_MOUSE_VIEW
                     set_view_offset(0.0);
+                    set_view_tilt(0.0);
 #endif // NO_SMOOTH_MOUSE_VIEW
 #endif // RESET_VIEW_ON_LEAVING_MOUSE_VIEW
                     glutSetCursor(GLUT_CURSOR_INHERIT);
@@ -646,3 +660,6 @@ void guiMouseFunc(int button, int updown, int x, int y)
     glutPostRedisplay ();
 }
 
+
+
+