#endif
#include <GL/glut.h>
-#include <simgear/xgl/xgl.h>
+#include <GL/gl.h>
#if defined(FX) && defined(XMESA)
# include <GL/xmesa.h>
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
-#include <simgear/misc/fgpath.hxx>
+#include <simgear/misc/sg_path.hxx>
#include <simgear/screen/screen-dump.hxx>
#include <Include/general.hxx>
#include <FDM/flight.hxx>
#include <Main/fg_init.hxx>
#include <Main/fg_props.hxx>
-//#include <Main/views.hxx>
-//#include <Network/network.h>
-//#include <Time/fg_time.hxx>
+#include <Main/viewmgr.hxx>
#if defined( WIN32 ) && !defined( __CYGWIN__ )
# include <simgear/screen/win32-printer.h>
} else {
if ( left_button() ) {
offset = (_mX - x) * brake_sensitivity;
- controls.move_brake(FGControls::ALL_WHEELS, offset);
+ globals->get_controls()->move_brake(FGControls::ALL_WHEELS, offset);
offset = (_mY - y) * throttle_sensitivity;
- controls.move_throttle(FGControls::ALL_ENGINES, offset);
+ globals->get_controls()->move_throttle(FGControls::ALL_ENGINES, offset);
} else if ( right_button() ) {
if( ! current_autopilot->get_HeadingEnabled() ) {
offset = (x - _mX) * rudder_sensitivity;
- controls.move_rudder(offset);
+ globals->get_controls()->move_rudder(offset);
}
if( ! current_autopilot->get_AltitudeEnabled() ) {
offset = (_mY - y) * trim_sensitivity;
- controls.move_elevator_trim(offset);
+ globals->get_controls()->move_elevator_trim(offset);
}
} else {
if( ! current_autopilot->get_HeadingEnabled() ) {
offset = (x - _mX) * aileron_sensitivity;
- controls.move_aileron(offset);
+ globals->get_controls()->move_aileron(offset);
}
if( ! current_autopilot->get_AltitudeEnabled() ) {
offset = (_mY - y) * elevator_sensitivity;
- controls.move_elevator(offset);
+ globals->get_controls()->move_elevator(offset);
}
}
}
need_warp = 1;
x = 1;
}
- // try to get SG_PI movement in each half of screen
+ // try to get SGD_PI movement in each half of screen
// do spherical pan
W = ww;
H = wh;
// this could be done in above quat
// but requires redoing view pipeline
offset = globals->get_current_view()->get_goal_view_offset();
- offset += ((_mX - x) * SG_2PI / W );
+ offset += ((_mX - x) * SGD_2PI / W );
while (offset < 0.0) {
- offset += SG_2PI;
+ offset += SGD_2PI;
}
- while (offset > SG_2PI) {
- offset -= SG_2PI;
+ while (offset > SGD_2PI) {
+ offset -= SGD_2PI;
}
globals->get_current_view()->set_goal_view_offset(offset);
#ifdef NO_SMOOTH_MOUSE_VIEW
// try to have the MOUSE_YOKE position
// reflect the current stick position
- offset = controls.get_aileron();
+ offset = globals->get_controls()->get_aileron();
x = _mX - (int)(offset * aileron_sensitivity);
- offset = controls.get_elevator();
+ offset = globals->get_controls()->get_elevator();
y = _mY - (int)(offset * elevator_sensitivity);
glutSetCursor(GLUT_CURSOR_CROSSHAIR);
- FG_LOG( FG_INPUT, FG_INFO, "Mouse in yoke mode" );
+ SG_LOG( SG_INPUT, SG_INFO, "Mouse in yoke mode" );
break;
case MOUSE_YOKE:
Quat0();
build_rotmatrix(GuiQuat_mat, curGuiQuat);
glutSetCursor(GLUT_CURSOR_LEFT_RIGHT);
- FG_LOG( FG_INPUT, FG_INFO, "Mouse in view mode" );
+ SG_LOG( SG_INPUT, SG_INFO, "Mouse in view mode" );
break;
case MOUSE_VIEW:
if(!gui_menu_on)
TurnCursorOff();
- FG_LOG( FG_INPUT, FG_INFO, "Mouse in pointer mode" );
+ SG_LOG( SG_INPUT, SG_INFO, "Mouse in pointer mode" );
break;
}
glutWarpPointer( x, y );
// know what's going on.
if (mouse_mode == MOUSE_POINTER) {
if (!puMouse (button, updown, x,y)) {
- current_panel->doMouseAction(button, updown, x, y);
+ if ( current_panel != NULL ) {
+ current_panel->doMouseAction(button, updown, x, y);
+ }
}
}