]> git.mxchange.org Git - flightgear.git/blobdiff - Main/GLUTkey.c
Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
[flightgear.git] / Main / GLUTkey.c
index 8e178befba861df5daba4e1d6c70246b4cdabe6b..04636b4914de692e33d3716441d590615ded2b86 100644 (file)
 #endif
 
 #include <GL/glut.h>
-#include "../XGL/xgl.h"
+#include <XGL/xgl.h>
 #include <stdio.h>
+#include <stdlib.h>
 
-#include "GLUTkey.h"
-#include "views.h"
+#include <Main/GLUTkey.h>
+#include <Main/fg_debug.h>
+#include <Main/views.h>
 
-#include "../Include/constants.h"
+#include <Include/fg_constants.h>
 
-#include "../Aircraft/aircraft.h"
-#include "../Weather/weather.h"
+#include <Aircraft/aircraft.h>
+#include <Weather/weather.h>
 
 
 extern int show_hud;             /* HUD state */
@@ -47,18 +49,20 @@ extern int displayInstruments;
 
 /* Handle keyboard events */
 void GLUTkey(unsigned char k, int x, int y) {
-    struct fgCONTROLS *c;
+    fgCONTROLS *c;
+    struct fgTIME *t;
     struct fgVIEW *v;
     struct fgWEATHER *w;
 
-    c = &current_aircraft.controls;
+    c = current_aircraft.controls;
+    t = &cur_time_params;
     v = &current_view;
     w = &current_weather;
 
-    printf("Key hit = %d", k);
+    fgPrintf( FG_INPUT, FG_DEBUG, "Key hit = %d", k);
 
     if ( GLUT_ACTIVE_ALT && glutGetModifiers() ) {
-       printf(" SHIFTED\n");
+       fgPrintf( FG_INPUT, FG_DEBUG, " SHIFTED\n");
        switch (k) {
        case 49: /* numeric keypad 1 */
            v->goal_view_offset = FG_PI * 0.75;
@@ -87,17 +91,23 @@ void GLUTkey(unsigned char k, int x, int y) {
        case 72: /* H key */
            show_hud = !show_hud;
            return;
+       case 77: /* M key */
+           t->warp -= 60;
+           return;
+       case 84: /* T key */
+           t->warp_delta -= 30;
+           return;
        case 87: /* W key */
            displayInstruments = !displayInstruments;
            return;
        case 90: /* Z key */
            w->visibility /= 1.10;
            xglFogf(GL_FOG_END, w->visibility);
-           printf("Fog density = %.4f\n", w->visibility);
+           fgPrintf( FG_INPUT, FG_DEBUG, "Fog density = %.4f\n", w->visibility);
            return;
        }
     } else {
-       printf("\n");
+       fgPrintf( FG_INPUT, FG_DEBUG, "\n");
        switch (k) {
        case 50: /* numeric keypad 2 */
            fgElevMove(-0.05);
@@ -134,10 +144,16 @@ void GLUTkey(unsigned char k, int x, int y) {
        case 51: /* numeric keypad 3 (Pg Dn) */
            fgThrottleMove(0, -0.01);
            return;
+       case 109: /* m key */
+           t->warp += 60;
+           return;
+       case 116: /* t key */
+           t->warp_delta += 30;
+           return;
        case 122: /* z key */
            w->visibility *= 1.10;
            xglFogf(GL_FOG_END, w->visibility);
-           printf("Fog density = %.4f\n", w->visibility);
+           fgPrintf( FG_INPUT, FG_DEBUG, "Fog density = %.4f\n", w->visibility);
            return;
        case 27: /* ESC */
            exit(0);
@@ -149,16 +165,16 @@ void GLUTkey(unsigned char k, int x, int y) {
 
 /* Handle "special" keyboard events */
 void GLUTspecialkey(int k, int x, int y) {
-    struct fgCONTROLS *c;
+    fgCONTROLS *c;
     struct fgVIEW *v;
 
-    c = &current_aircraft.controls;
+    c = current_aircraft.controls;
     v = &current_view;
 
-    printf("Special key hit = %d", k);
+    fgPrintf( FG_INPUT, FG_DEBUG, "Special key hit = %d", k);
 
     if ( GLUT_ACTIVE_SHIFT && glutGetModifiers() ) {
-       printf(" SHIFTED\n");
+       fgPrintf( FG_INPUT, FG_DEBUG, " SHIFTED\n");
        switch (k) {
        case GLUT_KEY_END: /* numeric keypad 1 */
            v->goal_view_offset = FG_PI * 0.75;
@@ -186,7 +202,7 @@ void GLUTspecialkey(int k, int x, int y) {
            return;
        }
     } else {
-       printf("\n");
+        fgPrintf( FG_INPUT, FG_DEBUG, "\n");
        switch (k) {
        case GLUT_KEY_UP:
            fgElevMove(0.05);
@@ -229,9 +245,30 @@ void GLUTspecialkey(int k, int x, int y) {
 
 
 /* $Log$
-/* Revision 1.24  1997/12/30 16:36:46  curt
-/* Merged in Durk's changes ...
+/* Revision 1.29  1998/02/07 15:29:40  curt
+/* Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
+/* <chotchkiss@namg.us.anritsu.com>
 /*
+ * Revision 1.28  1998/02/03 23:20:23  curt
+ * Lots of little tweaks to fix various consistency problems discovered by
+ * Solaris' CC.  Fixed a bug in fg_debug.c with how the fgPrintf() wrapper
+ * passed arguments along to the real printf().  Also incorporated HUD changes
+ * by Michele America.
+ *
+ * Revision 1.27  1998/01/27 00:47:55  curt
+ * Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
+ * system and commandline/config file processing code.
+ *
+ * Revision 1.26  1998/01/19 19:27:07  curt
+ * Merged in make system changes from Bob Kuehne <rpk@sgi.com>
+ * This should simplify things tremendously.
+ *
+ * Revision 1.25  1998/01/05 18:44:34  curt
+ * Add an option to advance/decrease time from keyboard.
+ *
+ * Revision 1.24  1997/12/30 16:36:46  curt
+ * Merged in Durk's changes ...
+ *
  * Revision 1.23  1997/12/15 23:54:44  curt
  * Add xgl wrappers for debugging.
  * Generate terrain normals on the fly.