]> git.mxchange.org Git - flightgear.git/commitdiff
Move FGControls declaration to globals.hxx
authorcurt <curt>
Sun, 22 Jul 2001 19:51:16 +0000 (19:51 +0000)
committercurt <curt>
Sun, 22 Jul 2001 19:51:16 +0000 (19:51 +0000)
31 files changed:
src/Aircraft/aircraft.cxx
src/Autopilot/newauto.cxx
src/Cockpit/cockpit.cxx
src/Cockpit/hud.cxx
src/Cockpit/panel.cxx
src/Cockpit/steam.cxx
src/Controls/controls.cxx
src/Controls/controls.hxx
src/FDM/ADA.cxx
src/FDM/Balloon.cxx
src/FDM/JSBSim.cxx
src/FDM/LaRCsim.cxx
src/FDM/MagicCarpet.cxx
src/GUI/gui.cxx
src/GUI/mouse.cxx
src/Main/fg_commands.cxx
src/Main/fg_init.cxx
src/Main/fg_props.cxx
src/Main/globals.hxx
src/Main/main.cxx
src/Main/options.cxx
src/Network/Makefile.am
src/Network/joyclient.cxx
src/NetworkOLK/net_send.cxx
src/Scenery/hitlist.cxx
src/Scenery/newcache.cxx
src/Scenery/tileentry.cxx
src/Scenery/tilemgr.cxx
src/Time/light.cxx
src/Time/moonpos.cxx
src/Time/sunpos.cxx

index 08bcaf8daadf07c67e69cebbceb178e15e514897..886cc149d93170d141159758c9d443a565794c11 100644 (file)
@@ -26,6 +26,8 @@
 #include <simgear/constants.h>
 #include <simgear/debug/logstream.hxx>
 
+#include <Main/globals.hxx>
+
 #include "aircraft.hxx"
 
 // This is a record containing all the info for the aircraft currently
@@ -38,7 +40,7 @@ void fgAircraftInit( void ) {
     SG_LOG( SG_AIRCRAFT, SG_INFO, "Initializing Aircraft structure" );
 
     current_aircraft.fdm_state   = cur_fdm_state;
-    current_aircraft.controls = &controls;
+    current_aircraft.controls = globals->get_controls();
 }
 
 
@@ -60,10 +62,10 @@ void fgAircraftOutputCurrent(fgAIRCRAFT *a) {
 
     SG_LOG( SG_FLIGHT, SG_DEBUG,
            "Kts = " << f->get_V_equiv_kts() 
-           << "  Elev = " << controls.get_elevator() 
-           << "  Aileron = " << controls.get_aileron() 
-           << "  Rudder = " << controls.get_rudder() 
-           << "  Power = " << controls.get_throttle( 0 ) );
+           << "  Elev = " << globals->get_controls()->get_elevator() 
+           << "  Aileron = " << globals->get_controls()->get_aileron() 
+           << "  Rudder = " << globals->get_controls()->get_rudder() 
+           << "  Power = " << globals->get_controls()->get_throttle( 0 ) );
 }
 
 
index 2198459c38d993d5ce8276d038ea18c692cc7dc9..2d27bf059912e60d61271aa4d316d88ecf61ddb9 100644 (file)
@@ -207,10 +207,10 @@ void FGAutopilot::MakeTargetWPStr( double distance ) {
 
 
 void FGAutopilot::update_old_control_values() {
-    old_aileron = controls.get_aileron();
-    old_elevator = controls.get_elevator();
-    old_elevator_trim = controls.get_elevator_trim();
-    old_rudder = controls.get_rudder();
+    old_aileron = globals->get_controls()->get_aileron();
+    old_elevator = globals->get_controls()->get_elevator();
+    old_elevator_trim = globals->get_controls()->get_elevator_trim();
+    old_rudder = globals->get_controls()->get_rudder();
 }
 
 
@@ -514,8 +514,8 @@ int FGAutopilot::run() {
            double AileronSet = -turn / 2.0;
            if ( AileronSet < -1.0 ) { AileronSet = -1.0; }
            if ( AileronSet >  1.0 ) { AileronSet =  1.0; }
-           controls.set_aileron( AileronSet );
-           controls.set_rudder( AileronSet / 4.0 );
+           globals->get_controls()->set_aileron( AileronSet );
+           globals->get_controls()->set_rudder( AileronSet / 4.0 );
        } else {
            // steer towards the target heading
 
@@ -580,8 +580,8 @@ int FGAutopilot::run() {
                                                MaxAileron );
            }
 
-           controls.set_aileron( AileronSet );
-           controls.set_rudder( AileronSet / 4.0 );
+           globals->get_controls()->set_aileron( AileronSet );
+           globals->get_controls()->set_rudder( AileronSet / 4.0 );
            // controls.set_rudder( 0.0 );
        }
     }
@@ -698,7 +698,7 @@ int FGAutopilot::run() {
            total_adj = -1.0;
        }
 
-       controls.set_elevator( total_adj );
+       globals->get_controls()->set_elevator( total_adj );
     }
 
     // auto throttle
@@ -737,7 +737,8 @@ int FGAutopilot::run() {
            total_adj = 0.0;
        }
 
-       controls.set_throttle( FGControls::ALL_ENGINES, total_adj );
+       globals->get_controls()->set_throttle( FGControls::ALL_ENGINES,
+                                              total_adj );
     }
 
 #ifdef THIS_CODE_IS_NOT_USED
@@ -769,10 +770,10 @@ int FGAutopilot::run() {
 
     // stash this runs control settings
     // update_old_control_values();
-    old_aileron = controls.get_aileron();
-    old_elevator = controls.get_elevator();
-    old_elevator_trim = controls.get_elevator_trim();
-    old_rudder = controls.get_rudder();
+    old_aileron = globals->get_controls()->get_aileron();
+    old_elevator = globals->get_controls()->get_elevator();
+    old_elevator_trim = globals->get_controls()->get_elevator_trim();
+    old_rudder = globals->get_controls()->get_rudder();
 
     // for cross track error
     old_lat = lat;
index 79b071802f3df33682ffaabbc59468ca7a011286..f8e822b3f0303188fa3a9482af211b0a80663159 100644 (file)
@@ -45,6 +45,7 @@
 #include <FDM/ADA.hxx>
 #include <Main/globals.hxx>
 #include <Main/fg_props.hxx>
+#include <Main/viewmgr.hxx>
 #include <Scenery/scenery.hxx>
 #include <Time/fg_timer.hxx>
 #include <GUI/gui.h>
@@ -123,31 +124,31 @@ float get_long_min( void )
 
 float get_throttleval( void )
 {
-    float throttle = controls.get_throttle( 0 );
+    float throttle = globals->get_controls()->get_throttle( 0 );
     return (throttle);     // Hack limiting to one engine
 }
 
 float get_aileronval( void )
 {
-    float aileronval = controls.get_aileron();
+    float aileronval = globals->get_controls()->get_aileron();
     return (aileronval);
 }
 
 float get_elevatorval( void )
 {
-    float elevator_val = (float)controls.get_elevator();
+    float elevator_val = (float)globals->get_controls()->get_elevator();
     return elevator_val;
 }
 
 float get_elev_trimval( void )
 {
-    float elevatorval = controls.get_elevator_trim();
+    float elevatorval = globals->get_controls()->get_elevator_trim();
     return (elevatorval);
 }
 
 float get_rudderval( void )
 {
-    float rudderval = controls.get_rudder();
+    float rudderval = globals->get_controls()->get_rudder();
     return (rudderval);
 }
 
index a3aa88452a8d29d50b3470d1a08a29ad0bde03f4..fcc1ea9306c87f29de5a02d8dfb598ff7589e1a0 100644 (file)
@@ -52,6 +52,7 @@
 #include <GUI/gui.h>
 #include <Main/globals.hxx>
 #include <Main/fg_props.hxx>
+#include <Main/viewmgr.hxx>
 #ifdef FG_NETWORK_OLK
 #include <NetworkOLK/network.h>
 #endif
index c83e3d02fbd28a4f62ad44626adc5f0272f79b22..dca6cfdff95b3382478ba7ffdfe1f5d3cc909b23 100644 (file)
@@ -36,6 +36,7 @@
 
 #include <Main/globals.hxx>
 #include <Main/fg_props.hxx>
+#include <Main/viewmgr.hxx>
 #include <Objects/texload.h>
 #include <Time/light.hxx>
 
index 344e6f6a0275209a17070ab027596461f6d7177a..75eae0e4d70e982f04a36f815dc346275adb5cfe 100644 (file)
@@ -326,7 +326,7 @@ void FGSteam::_CatchUp()
        scaling capability for the vacuum pump later on.
        When we have a real engine model, we can ask it.
        */
-       the_ENGINE_rpm = controls.get_throttle(0) * 26.0;
+       the_ENGINE_rpm = globals->get_controls()->get_throttle(0) * 26.0;
 
        /**************************
        First, we need to know what the static line is reporting,
index 1ec0b3d2ce4eaed71916d2b8c845d9b94cba2897..30492fa5f4dec22df6623d6f1ec4d56ba17ca4a8 100644 (file)
@@ -27,9 +27,6 @@
 #include <Main/fg_props.hxx>
 
 
-FGControls controls;
-
-
 // Constructor
 FGControls::FGControls() :
     aileron( 0.0 ),
index ba2a92d5bae1d8dbd2f1cdd5f514e6b3ea9e00a8..414a11458525d7f172c08e57dd642fd54662a040 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <simgear/misc/props.hxx>
 
+#include <Sound/soundmgr.hxx>
 #include <Main/fgfs.hxx>
 #include <Main/globals.hxx>
 
@@ -266,9 +267,6 @@ public:
 };
 
 
-extern FGControls controls;
-
-
 #endif // _CONTROLS_HXX
 
 
index f2965b684a8b15a30f0f73efffd05969e6f359df..43bce1ea6a6cfd4ad3ea46b9938d0b0119740f7f 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <Controls/controls.hxx>
 #include <GUI/gui.h>
+#include <Main/globals.hxx>
 
 #include "ADA.hxx"
 
@@ -261,10 +262,10 @@ bool FGADA::copy_from_FGADA() {
     //    printf("psi = %f %f\n",Psi,Psi*SGD_RADIANS_TO_DEGREES);    
 
     // controls
-    controls.set_throttle(0,throttle/131.0);
-    controls.set_elevator(pstick);
-    controls.set_aileron(rstick);
-    controls.set_rudder(rpedal);
+    globals->get_controls()->set_throttle(0,throttle/131.0);
+    globals->get_controls()->set_elevator(pstick);
+    globals->get_controls()->set_aileron(rstick);
+    globals->get_controls()->set_rudder(rpedal);
 
     // auxilliary parameters for HUD
     set_iaux1(sixdof_to_visuals.iaux1);
index 8cd245ed53e980b37c19f2cb6414b6da9395890d..86e0f7156c3621874d0298eb55154b5f1ca3d739 100644 (file)
@@ -121,7 +121,7 @@ bool FGBalloonSim::update( int multiloop ) {
     }
 
     // set control positions
-    current_balloon.set_burner_strength ( controls.get_throttle(0) );
+    current_balloon.set_burner_strength ( globals->get_controls()->get_throttle(0) );
     //not more implemented yet
 
     // Inform BalloonSim of the local terrain altitude
index dc308ffd5e95b2d65882727f54cbfd0f8aa30c03..3b9cefb2a35138cb81d1e216e342dde5b2b09324 100644 (file)
@@ -235,20 +235,20 @@ bool FGJSBsim::update( int multiloop ) {
         aileron_trim->setDoubleValue( FCS->GetDaCmd() );
         rudder_trim->setDoubleValue( FCS->GetDrCmd() );
 
-        controls.set_elevator_trim(FCS->GetPitchTrimCmd());
-        controls.set_elevator(FCS->GetDeCmd());
-        controls.set_throttle(FGControls::ALL_ENGINES,
-                              FCS->GetThrottleCmd(0));
+        globals->get_controls()->set_elevator_trim(FCS->GetPitchTrimCmd());
+        globals->get_controls()->set_elevator(FCS->GetDeCmd());
+        globals->get_controls()->set_throttle(FGControls::ALL_ENGINES,
+                                             FCS->GetThrottleCmd(0));
 
-        controls.set_aileron(FCS->GetDaCmd());
-        controls.set_rudder( FCS->GetDrCmd());
+        globals->get_controls()->set_aileron(FCS->GetDaCmd());
+        globals->get_controls()->set_rudder( FCS->GetDrCmd());
     
         SG_LOG( SG_FLIGHT, SG_INFO, "  Trim complete" );
     }
   
     for( i=0; i<get_num_engines(); i++ ) {
       get_engine(i)->set_RPM( Propulsion->GetThruster(i)->GetRPM() );
-      get_engine(i)->set_Throttle( controls.get_throttle(i) );
+      get_engine(i)->set_Throttle( globals->get_controls()->get_throttle(i) );
     }
 
     for ( i=0; i < multiloop; i++ ) {
@@ -272,18 +272,18 @@ bool FGJSBsim::update( int multiloop ) {
 bool FGJSBsim::copy_to_JSBsim() {
     // copy control positions into the JSBsim structure
 
-    FCS->SetDaCmd( controls.get_aileron());
-    FCS->SetDeCmd( controls.get_elevator());
-    FCS->SetPitchTrimCmd(controls.get_elevator_trim());
-    FCS->SetDrCmd( -controls.get_rudder());
-    FCS->SetDfCmd(  controls.get_flaps() );
+    FCS->SetDaCmd( globals->get_controls()->get_aileron());
+    FCS->SetDeCmd( globals->get_controls()->get_elevator());
+    FCS->SetPitchTrimCmd(globals->get_controls()->get_elevator_trim());
+    FCS->SetDrCmd( -globals->get_controls()->get_rudder());
+    FCS->SetDfCmd(  globals->get_controls()->get_flaps() );
     FCS->SetDsbCmd( 0.0 ); //speedbrakes
     FCS->SetDspCmd( 0.0 ); //spoilers
     FCS->SetThrottleCmd( FGControls::ALL_ENGINES,
-                         controls.get_throttle( 0 ));
-    FCS->SetLBrake( controls.get_brake( 0 ) );
-    FCS->SetRBrake( controls.get_brake( 1 ) );
-    FCS->SetCBrake( controls.get_brake( 2 ) );
+                         globals->get_controls()->get_throttle( 0 ));
+    FCS->SetLBrake( globals->get_controls()->get_brake( 0 ) );
+    FCS->SetRBrake( globals->get_controls()->get_brake( 1 ) );
+    FCS->SetCBrake( globals->get_controls()->get_brake( 2 ) );
 
     Position->SetSeaLevelRadius( get_Sea_level_radius() );
     Position->SetRunwayRadius( scenery.cur_elev*SG_METER_TO_FEET
index 0da1f9f9258f9af0fe84ad068a83324fae1d55c1..da2ee815992089a813bdf09979957d3912729b07 100644 (file)
@@ -101,9 +101,11 @@ bool FGLaRCsim::update( int multiloop ) {
        // set control inputs
        // cout << "V_calibrated_kts = " << V_calibrated_kts << '\n';
        eng.set_IAS( V_calibrated_kts );
-       eng.set_Throttle_Lever_Pos( controls.get_throttle( 0 ) * 100.0 );
+       eng.set_Throttle_Lever_Pos( globals->get_controls()->get_throttle( 0 )
+                                   * 100.0 );
        eng.set_Propeller_Lever_Pos( 100 );
-        eng.set_Mixture_Lever_Pos( controls.get_mixture( 0 ) * 100.0 );
+        eng.set_Mixture_Lever_Pos( globals->get_controls()->get_mixture( 0 )
+                                  * 100.0 );
        eng.set_p_amb( Static_pressure );
        eng.set_T_amb( Static_temperature );
 
@@ -112,7 +114,7 @@ bool FGLaRCsim::update( int multiloop ) {
 
        // copy engine state values onto "bus"
        FGEngInterface *e = get_engine( 0 );
-       e->set_Throttle( controls.get_throttle( 0 ) * 100.0 );
+       e->set_Throttle( globals->get_controls()->get_throttle( 0 ) * 100.0 );
        e->set_Mixture( 80 );
        e->set_Prop_Advance( 100 );
        e->set_RPM( eng.get_RPM() );
@@ -132,7 +134,7 @@ bool FGLaRCsim::update( int multiloop ) {
 
 #if 0
        SG_LOG( SG_FLIGHT, SG_INFO, "Throttle = "
-               << controls.get_throttle( 0 ) * 100.0);
+               << globals->get_controls()->get_throttle( 0 ) * 100.0);
        SG_LOG( SG_FLIGHT, SG_INFO, " Mixture = " << 80);
        SG_LOG( SG_FLIGHT, SG_INFO, " RPM = " << eng.get_RPM());
        SG_LOG( SG_FLIGHT, SG_INFO, " MP = " << eng.get_Manifold_Pressure());
@@ -156,13 +158,13 @@ bool FGLaRCsim::update( int multiloop ) {
     }
 
     // copy control positions into the LaRCsim structure
-    Lat_control = controls.get_aileron() /
+    Lat_control = globals->get_controls()->get_aileron() /
        speed_up->getIntValue();
-    Long_control = controls.get_elevator();
-    Long_trim = controls.get_elevator_trim();
-    Rudder_pedal = controls.get_rudder() /
+    Long_control = globals->get_controls()->get_elevator();
+    Long_trim = globals->get_controls()->get_elevator_trim();
+    Rudder_pedal = globals->get_controls()->get_rudder() /
         speed_up->getIntValue();
-    Flap_handle = 30.0 * controls.get_flaps();
+    Flap_handle = 30.0 * globals->get_controls()->get_flaps();
 
     if ( aircraft->getStringValue() == "c172" ) {
        Use_External_Engine = 1;
@@ -170,10 +172,10 @@ bool FGLaRCsim::update( int multiloop ) {
        Use_External_Engine = 0;
     }
 
-    Throttle_pct = controls.get_throttle( 0 ) * 1.0;
+    Throttle_pct = globals->get_controls()->get_throttle( 0 ) * 1.0;
 
-    Brake_pct[0] = controls.get_brake( 1 );
-    Brake_pct[1] = controls.get_brake( 0 );
+    Brake_pct[0] = globals->get_controls()->get_brake( 1 );
+    Brake_pct[1] = globals->get_controls()->get_brake( 0 );
 
     // Inform LaRCsim of the local terrain altitude
     // Runway_altitude = get_Runway_altitude();
index 858ff522139447b0aa5e1a1735405467f6d3d0bd..b78d764743ca12d9a8af0518bb47d2b25b0a8159 100644 (file)
@@ -57,7 +57,7 @@ bool FGMagicCarpet::update( int multiloop ) {
     double time_step = get_delta_t() * multiloop;
 
     // speed and distance traveled
-    double speed = controls.get_throttle( 0 ) * 2000; // meters/sec
+    double speed = globals->get_controls()->get_throttle( 0 ) * 2000; // meters/sec
     double dist = speed * time_step;
     double kts = speed * SG_METER_TO_NM * 3600.0;
     _set_V_equiv_kts( kts );
@@ -65,7 +65,7 @@ bool FGMagicCarpet::update( int multiloop ) {
     _set_V_ground_speed( kts );
 
     // angle of turn
-    double turn_rate = controls.get_aileron() * SGD_PI_4; // radians/sec
+    double turn_rate = globals->get_controls()->get_aileron() * SGD_PI_4; // radians/sec
     double turn = turn_rate * time_step;
 
     // update euler angles
@@ -94,7 +94,7 @@ bool FGMagicCarpet::update( int multiloop ) {
     sgGeodToGeoc( get_Latitude(), get_Altitude(), &sl_radius, &lat_geoc );
 
     // update altitude
-    double real_climb_rate = -controls.get_elevator() * 5000; // feet/sec
+    double real_climb_rate = -globals->get_controls()->get_elevator() * 5000; // feet/sec
     _set_Climb_Rate( real_climb_rate / 500.0 );
     double climb = real_climb_rate * time_step;
 
index 985cfc60b68e51c6aefd0d8e7b2e28a90ef22755..059b813b2f4999cfd42ec64d966cd178f789b161 100644 (file)
@@ -69,6 +69,7 @@
 #include <Main/globals.hxx>
 #include <Main/fg_props.hxx>
 #include <Main/options.hxx>
+#include <Main/viewmgr.hxx>
 
 #ifdef FG_NETWORK_OLK
 #include <NetworkOLK/network.h>
index d80ead445b6bc3b3565f6c740c759edc88dc75d2..fd7311f76c768a6991a79815bc671daed42b33d3 100644 (file)
@@ -66,9 +66,7 @@
 #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>
@@ -293,26 +291,26 @@ void guiMotionFunc ( int x, int y )
                 } 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);
                         }
                     }
                 }
@@ -486,9 +484,9 @@ void guiMouseFunc(int button, int updown, int x, int y)
                     
                     // 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);
index 50b6bc9e30432ea90bd4f109a53228cc2680af8c..de48e81e8b79e3bc124dd3b575478893990f62dc 100644 (file)
@@ -27,6 +27,7 @@ SG_USING_STD(ofstream);
 #include "fg_props.hxx"
 #include "fg_io.hxx"
 #include "globals.hxx"
+#include "viewmgr.hxx"
 
 
 \f
index 90c2edd194df841c80189c22ae616a5f4e8f3ed5..1b301b8d8d801c688340cabe7ad9273a41e42205 100644 (file)
 #include "fg_props.hxx"
 #include "options.hxx"
 #include "globals.hxx"
+#include "viewmgr.hxx"
 
 #if defined(FX) && defined(XMESA)
 #include <GL/xmesa.h>
@@ -810,8 +811,8 @@ bool fgInitSubsystems( void ) {
     // Initialize the controls subsystem.
     ////////////////////////////////////////////////////////////////////
 
-    controls.init();
-    controls.bind();
+    globals->get_controls()->init();
+    globals->get_controls()->bind();
 
 
     ////////////////////////////////////////////////////////////////////
@@ -885,7 +886,7 @@ void fgReInitSubsystems( void )
 
     cur_fdm_state->init();
 
-    controls.reset_all();
+    globals->get_controls()->reset_all();
     current_autopilot->reset();
 
     fgUpdateSunPos();
index cc662d3d51f77046a1b59a4c6ea32c4ce2366fbb..c8c5db3318b15d05ff43a1c294b490bec60b85c1 100644 (file)
@@ -43,6 +43,7 @@
 
 #include "fgfs.hxx"
 #include "fg_props.hxx"
+#include "viewer.hxx"
 
 #if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
 SG_USING_STD(istream);
@@ -668,7 +669,7 @@ getAPRudderControl ()
     if (getAPHeadingLock())
         return current_autopilot->get_TargetHeading();
     else
-        return controls.get_rudder();
+        return globals->get_controls()->get_rudder();
 }
 
 // kludge
@@ -680,7 +681,7 @@ setAPRudderControl (double value)
         value -= current_autopilot->get_TargetHeading();
         current_autopilot->HeadingAdjust(value < 0.0 ? -1.0 : 1.0);
     } else {
-        controls.set_rudder(value);
+        globals->get_controls()->set_rudder(value);
     }
 }
 
@@ -691,7 +692,7 @@ getAPElevatorControl ()
   if (getAPAltitudeLock())
       return current_autopilot->get_TargetAltitude();
   else
-    return controls.get_elevator();
+    return globals->get_controls()->get_elevator();
 }
 
 // kludge
@@ -703,7 +704,7 @@ setAPElevatorControl (double value)
         value -= current_autopilot->get_TargetAltitude();
         current_autopilot->AltitudeAdjust(value < 0.0 ? 100.0 : -100.0);
     } else {
-        controls.set_elevator(value);
+        globals->get_controls()->set_elevator(value);
     }
 }
 
@@ -714,7 +715,7 @@ getAPThrottleControl ()
   if (getAPAutoThrottleLock())
     return 0.0;                        // always resets
   else
-    return controls.get_throttle(0);
+    return globals->get_controls()->get_throttle(0);
 }
 
 // kludge
@@ -724,7 +725,7 @@ setAPThrottleControl (double value)
   if (getAPAutoThrottleLock())
     current_autopilot->AutoThrottleAdjust(value < 0.0 ? -0.01 : 0.01);
   else
-    controls.set_throttle(0, value);
+    globals->get_controls()->set_throttle(0, value);
 }
 
 
index 8b5e9e6f718462b958ab9436630b1bfb0a966517..c68053602f65061a13295c16f50d46a1dc29ed20 100644 (file)
@@ -37,8 +37,9 @@
 #include <simgear/misc/commands.hxx>
 #include <simgear/misc/props.hxx>
 
-#include <Sound/soundmgr.hxx>
-#include "viewmgr.hxx"
+// #include <Controls/controls.hxx>
+// #include <Sound/soundmgr.hxx>
+// #include "viewmgr.hxx"
 
 SG_USING_STD( vector );
 SG_USING_STD( string );
@@ -46,6 +47,12 @@ SG_USING_STD( string );
 typedef vector<string> string_list;
 
 
+// Forward declarations
+class FGControls;
+class FGSoundMgr;
+class FGViewMgr;
+class FGViewer;
+
 class FGGlobals {
 
 private:
@@ -82,6 +89,9 @@ private:
     // sound manager
     FGSoundMgr *soundmgr;
 
+    // control input state
+    FGControls *controls;
+
     // viewer manager
     FGViewMgr *viewmgr;
     FGViewer *current_view;
@@ -134,6 +144,9 @@ public:
     inline FGSoundMgr *get_soundmgr() const { return soundmgr; }
     inline void set_soundmgr( FGSoundMgr *sm ) { soundmgr = sm; }
 
+    inline FGControls *get_controls() const { return controls; }
+    inline void set_controls( FGControls *c ) { controls = c; }
+
     inline FGViewMgr *get_viewmgr() const { return viewmgr; }
     inline void set_viewmgr( FGViewMgr *vm ) { viewmgr = vm; }
     inline FGViewer *get_current_view() const { return current_view; }
index 71531a268564916657cf22565553c77ccec56f43..031112fce46a330a91996fc3c13254dd22450c10 100644 (file)
@@ -131,6 +131,7 @@ int objc=0;
 #include "fg_props.hxx"
 #include "globals.hxx"
 #include "splash.hxx"
+#include "viewmgr.hxx"
 
 #ifdef macintosh
 #  include <console.h>         // -dw- for command line dialog
@@ -716,7 +717,7 @@ void fgRenderFrame( void ) {
 
            // set up moving parts
            if (flaps_selector != NULL) {
-             flaps_selector->select( (controls.get_flaps() > 0.5f) ? 1 : 2 );
+               flaps_selector->select( (globals->get_controls()->get_flaps() > 0.5f) ? 1 : 2 );
            }
 
            if (prop_selector != NULL) {
@@ -799,7 +800,7 @@ void fgRenderFrame( void ) {
        current_input.update();
 
        // update the controls subsystem
-       controls.update();
+       globals->get_controls()->update();
 
        hud_and_panel->apply();
        fgCockpitUpdate();
@@ -1175,7 +1176,8 @@ static void fgMainLoop( void ) {
            s1->set_pitch( pitch );
            s1->set_volume( volume );
        } else {
-           double param = controls.get_throttle( 0 ) * 2.0 + 1.0;
+           double param
+               = globals->get_controls()->get_throttle( 0 ) * 2.0 + 1.0;
            s1->set_pitch( param );
            s1->set_volume( param );
        }
@@ -1463,6 +1465,9 @@ int mainLoop( int argc, char **argv ) {
     SGRoute *route = new SGRoute;
     globals->set_route( route );
 
+    FGControls *controls = new FGControls;
+    globals->set_controls( controls );
+
     FGViewMgr *viewmgr = new FGViewMgr;
     globals->set_viewmgr( viewmgr );
 
index 9e77dd783d49438607327b6135718d775e7a3ff7..0dd95997a05b393f5f5cd45189fe42b830ae4468 100644 (file)
@@ -57,6 +57,7 @@ bool global_fullscreen = true;
 #include "fg_init.hxx"
 #include "fg_props.hxx"
 #include "options.hxx"
+#include "viewmgr.hxx"
 
 SG_USING_STD(string);
 SG_USING_NAMESPACE(std);
index ba4bf0d432aa4855096868a5763e7875d2d07c74..5fbf6db4fea23dea0d473f66f9232c142ed3c78a 100644 (file)
@@ -6,9 +6,11 @@ libNetwork_a_SOURCES = \
        garmin.cxx garmin.hxx \
        joyclient.cxx joyclient.hxx \
        native.cxx native.hxx \
+       native_ctrls.cxx native_ctrls.hxx \
        nmea.cxx nmea.hxx \
        props.cxx props.hxx \
        pve.cxx pve.hxx \
+       raw_ctrls.hxx \
        ray.cxx ray.hxx \
        rul.cxx rul.hxx
 
index 419c8a41741490f604823261c794884862b66866..954b4e55c7e251d84c61b86a74f5f2c0d57d5c04 100644 (file)
@@ -82,8 +82,8 @@ bool FGJoyClient::process() {
                if ( fabs(elevator) < 0.05 ) {
                    elevator = 0.0;
                }
-               controls.set_aileron( aileron );
-               controls.set_elevator( -elevator );
+               globals->get_controls()->set_aileron( aileron );
+               globals->get_controls()->set_elevator( -elevator );
            }
        } else {
            while ( io->read( (char *)(& buf), length ) == length ) {
@@ -100,8 +100,8 @@ bool FGJoyClient::process() {
                if ( fabs(elevator) < 0.05 ) {
                    elevator = 0.0;
                }
-               controls.set_aileron( aileron );
-               controls.set_elevator( -elevator );
+               globals->get_controls()->set_aileron( aileron );
+               globals->get_controls()->set_elevator( -elevator );
            }
        }
     }
index b417c1d725a40b75d7cfdb788884e1bf823940d4..cf0fdad8d063143094337edc6ba1ef20a9f75a97 100644 (file)
@@ -41,6 +41,7 @@
 #include <Cockpit/hud.hxx>
 #include <plib/ssg.h>
 #include <Main/globals.hxx>
+#include <Main/viewmgr.hxx>
 
 //#define printf //
 
index b5abb780541af2209a2d75901e497a741520844b..a819afaed4cc1d111aa680bdbd4a9acc3bb2b7fc 100644 (file)
@@ -20,6 +20,7 @@
 #include <simgear/math/vector.hxx>
 
 #include <Main/globals.hxx>
+#include <Main/viewer.hxx>
 
 #include "hitlist.hxx"
 
index db1b7aa56b9b436e2b3ce7deb3511d8d1b1aca11..b83d3a3aabbbe718abd9c1f6839b3b4952937573 100644 (file)
@@ -39,6 +39,7 @@
 #include <simgear/misc/sg_path.hxx>
 
 #include <Main/globals.hxx>
+#include <Main/viewer.hxx>
 #include <Scenery/scenery.hxx>  // for scenery.center
 
 #include "newcache.hxx"
index 8149e09c02b087c4850e614d2272f6f3e237becf..0acadb712784ab073ecd4a07b5b685b5c6efb6b8 100644 (file)
@@ -36,6 +36,7 @@
 #include <Aircraft/aircraft.hxx>
 #include <Include/general.hxx>
 #include <Main/globals.hxx>
+#include <Main/viewer.hxx>
 #include <Scenery/scenery.hxx>
 #include <Time/light.hxx>
 #include <Objects/apt_signs.hxx>
index a8a078a09c579b81743785d2d6e92b01b98d429f..912aa2994fa4227a51e3ba2faebb532a32a0b98c 100644 (file)
@@ -41,6 +41,7 @@
 #include <simgear/math/vector.hxx>
 
 #include <Main/globals.hxx>
+#include <Main/viewer.hxx>
 #include <Objects/obj.hxx>
 
 #ifndef FG_OLD_WEATHER
index 7202a3670849c1c3d8e67dee1effee508deb13d2..b9a41b508c86f49f92e9234eb5ccb790b3efdd1f 100644 (file)
@@ -56,6 +56,7 @@ SG_USING_STD(string);
 
 #include <Aircraft/aircraft.hxx>
 #include <Main/globals.hxx>
+#include <Main/viewer.hxx>
 
 #include "light.hxx"
 #include "sunpos.hxx"
index 8cac8cafdffb35566cab2ec8cd3809a67e9627c2..9507f1a9f9cd31024e69e020d288fb8ac9b6aabd 100644 (file)
@@ -61,6 +61,7 @@
 #include <simgear/math/vector.hxx>
 
 #include <Main/globals.hxx>
+#include <Main/viewer.hxx>
 #include <Scenery/scenery.hxx>
 #include <Time/light.hxx>
 
@@ -335,7 +336,7 @@ static void fgMoonPositionGST(double gst, double *lon, double *lat) {
 // update the cur_time_params structure with the current moon position
 void fgUpdateMoonPos( void ) {
     fgLIGHT *l;
-    FGViewerRPH *v;
+    FGViewer *v;
     sgVec3 nup, nmoon;
     Point3D p, rel_moonpos;
     double dot, east_dot;
@@ -350,7 +351,7 @@ void fgUpdateMoonPos( void ) {
 
     l = &cur_light_params;
     SGTime *t = globals->get_time_params();
-    v = (FGViewerRPH *)globals->get_current_view();
+    v = globals->get_current_view();
 
     SG_LOG( SG_EVENT, SG_INFO, "  Updating Moon position" );
 
index f9d4f19d059252ccb96665b7bb5c9d9b4b4aee0a..961e03706c04eedb37f8e11a8673d6dc7b04ce4c 100644 (file)
@@ -62,6 +62,7 @@
 #include <simgear/math/vector.hxx>
 
 #include <Main/globals.hxx>
+#include <Main/viewer.hxx>
 #include <Scenery/scenery.hxx>
 #include <Time/light.hxx>
 
@@ -243,7 +244,7 @@ static void fgSunPositionGST(double gst, double *lon, double *lat) {
 // update the cur_time_params structure with the current sun position
 void fgUpdateSunPos( void ) {
     fgLIGHT *l;
-    FGViewerRPH *v;
+    FGViewer *v;
     sgVec3 nup, nsun;
     Point3D p, rel_sunpos;
     double dot, east_dot;
@@ -258,7 +259,7 @@ void fgUpdateSunPos( void ) {
 
     l = &cur_light_params;
     SGTime *t = globals->get_time_params();
-    v = (FGViewerRPH *)globals->get_current_view();
+    v = globals->get_current_view();
 
     SG_LOG( SG_EVENT, SG_INFO, "  Updating Sun position" );
     SG_LOG( SG_EVENT, SG_INFO, "  Gst = " << t->getGst() );