]> git.mxchange.org Git - flightgear.git/blobdiff - Main/GLUTmain.cxx
Turned "struct fgCONTROLS" into a class, with inlined accessor functions.
[flightgear.git] / Main / GLUTmain.cxx
index 4cc65807383ff32f64d526e5c5f1b0dd9a76267a..d7f420e59291247604f72d9797af050f081a5c08 100644 (file)
 #include <Cockpit/cockpit.hxx>
 #include <Debug/fg_debug.h>
 #include <GUI/gui.h>
-#include <Joystick/joystick.h>
+
+#ifdef ENABLE_JOYSTICK_SUPPORT
+#  include <Joystick/joystick.hxx>
+#endif
+
 #include <Math/fg_geodesy.hxx>
 #include <Math/mat3.h>
 #include <Math/polar3d.hxx>
@@ -456,7 +460,6 @@ static const double alt_adjust_m = alt_adjust_ft * FEET_TO_METER;
 // What should we do when we have nothing else to do?  Let's get ready
 // for the next move and update the display?
 static void fgMainLoop( void ) {
-    fgCONTROLS *c;
     fgFLIGHT *f;
     fgGENERAL *g;
     fgTIME *t;
@@ -464,10 +467,7 @@ static void fgMainLoop( void ) {
     int elapsed, multi_loop;
     int i;
     double accum;
-    // double joy_x, joy_y;
-    // int joy_b1, joy_b2;
 
-    c = &cur_control_params;
     f = current_aircraft.flight;
     g = &general;
     t = &cur_time_params;
@@ -511,12 +511,10 @@ static void fgMainLoop( void ) {
     // update "time"
     fgTimeUpdate(f, t);
 
-    // Read joystick
-    /* fgJoystickRead( &joy_x, &joy_y, &joy_b1, &joy_b2 );
-    printf( "Joystick X %f  Y %f  B1 %d  B2 %d\n",  
-           joy_x, joy_y, joy_b1, joy_b2 );
-    fgElevSet( -joy_y );
-    fgAileronSet( joy_x ); */
+#ifdef ENABLE_JOYSTICK_SUPPORT
+    // Read joystick and update control settings
+    fgJoystickRead();
+#endif
 
     // Get elapsed time for this past frame
     elapsed = fgGetTimeInterval();
@@ -577,7 +575,7 @@ static void fgMainLoop( void ) {
     // Run audio scheduler
 #ifdef ENABLE_AUDIO_SUPPORT
     if ( current_options.get_sound() && audio_sched->working() ) {
-       double param = c->throttle[0] * 2.0 + 1.0;
+       double param = controls.get_throttle( 0 ) * 2.0 + 1.0;
 
        pitch_envelope.setStep  ( 0, 0.01, param );
        volume_envelope.setStep ( 0, 0.01, param );
@@ -894,6 +892,12 @@ int main( int argc, char **argv ) {
 
 
 // $Log$
+// Revision 1.61  1998/10/25 14:08:47  curt
+// Turned "struct fgCONTROLS" into a class, with inlined accessor functions.
+//
+// Revision 1.60  1998/10/25 10:57:18  curt
+// Changes to use the new joystick library if it is available.
+//
 // Revision 1.59  1998/10/17 01:34:21  curt
 // C++ ifying ...
 //