]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/keyboard.cxx
One more pass at a reorg.
[flightgear.git] / src / Main / keyboard.cxx
index b7cdf9b5e2e8727ad6153cdf8c3f410cd6bb170a..dcf0a7057691bdce2bfc814e10f6613c87bbaee3 100644 (file)
@@ -30,7 +30,7 @@
 #endif
 
 #include <GL/glut.h>
-#include <XGL/xgl.h>
+#include <simgear/xgl/xgl.h>
 
 #if defined(FX) && defined(XMESA)
 #include <GL/xmesa.h>
 #include <stdio.h>
 #include <stdlib.h>
 
-#include <pu.h>                        // plib include
+#include <plib/pu.h>           // plib include
+
+#include <simgear/constants.h>
+#include <simgear/debug/logstream.hxx>
+#include <simgear/misc/fgpath.hxx>
 
-#include <Debug/logstream.hxx>
 #include <Aircraft/aircraft.hxx>
 #include <Astro/solarsystem.hxx>
 #include <Astro/sky.hxx>
 #include <Autopilot/autopilot.hxx>
 #include <Cockpit/hud.hxx>
 #include <GUI/gui.h>
-#include <Include/fg_constants.h>
-#include <Misc/fgpath.hxx>
 #include <Scenery/tilemgr.hxx>
 #include <Objects/materialmgr.hxx>
 #include <Time/fg_time.hxx>
@@ -63,6 +64,7 @@
 
 #include "keyboard.hxx"
 #include "options.hxx"
+#include "save.hxx"
 #include "views.hxx"
 
 extern void NewAltitude( puObject *cb );
@@ -119,6 +121,15 @@ void GLUTkey(unsigned char k, int x, int y) {
        case 20: // Ctrl-T key
            fgAPToggleTerrainFollow();
            return;
+       case 21: // Ctrl-U key
+           // add 1000' of emergency altitude.  Possibly good for 
+           // unflipping yourself :-)
+           {
+               double alt = cur_fdm_state->get_Altitude() + 1000;
+               fgFDMForceAltitude( current_options.get_flight_model(), 
+                                   alt * FEET_TO_METER );
+           }
+           return;
        case 49: // numeric keypad 1
            v->set_goal_view_offset( FG_PI * 0.75 );
            return;
@@ -374,6 +385,27 @@ void GLUTspecialkey(int k, int x, int y) {
     if ( GLUT_ACTIVE_SHIFT && glutGetModifiers() ) {
        FG_LOG( FG_INPUT, FG_DEBUG, " SHIFTED" );
        switch (k) {
+       case GLUT_KEY_F1: {
+           ifstream input("fgfs.sav");
+           if (input.good() && fgLoadFlight(input)) {
+               input.close();
+               FG_LOG(FG_INPUT, FG_INFO, "Restored flight from fgfs.sav");
+           } else {
+               FG_LOG(FG_INPUT, FG_ALERT, "Cannot load flight from fgfs.sav");
+           }
+           return;
+       }
+       case GLUT_KEY_F2: {
+           FG_LOG(FG_INPUT, FG_INFO, "Saving flight");
+           ofstream output("fgfs.sav");
+           if (output.good() && fgSaveFlight(output)) {
+               output.close();
+               FG_LOG(FG_INPUT, FG_INFO, "Saved flight to fgfs.sav");
+           } else {
+               FG_LOG(FG_INPUT, FG_ALERT, "Cannot save flight to fgfs.sav");
+           }
+           return;
+       }
        case GLUT_KEY_END: // numeric keypad 1
            v->set_goal_view_offset( FG_PI * 0.75 );
            return;
@@ -423,7 +455,7 @@ void GLUTspecialkey(int k, int x, int y) {
                    t->togglePauseMode();
                return;
            }
-       case GLUT_KEY_F3: // F2 Take a screen shot
+       case GLUT_KEY_F3: // F3 Take a screen shot
            fgDumpSnapShot();
            return;
         case GLUT_KEY_F6: // F6 toggles Autopilot target location