]> git.mxchange.org Git - flightgear.git/blobdiff - Cockpit/hud.hxx
C++ ifying ...
[flightgear.git] / Cockpit / hud.hxx
index c05260aa0ead2424947a0f820f1d5c10e158b782..e1b34e1e5bb2886b3a9abb58471a8b099fa30134 100644 (file)
@@ -1,27 +1,25 @@
-/**************************************************************************
- * hud.hxx -- hud defines and prototypes (initial draft)
- *
- * Written by Michele America, started September 1997.
- *
- * Copyright (C) 1997  Michele F. America  - nomimarketing@mail.telepac.pt
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id$
- * (Log is kept at end of this file)
- **************************************************************************/
+// hud.hxx -- hud defines and prototypes (initial draft)
+//
+// Written by Michele America, started September 1997.
+//
+// Copyright (C) 1997  Michele F. America  - nomimarketing@mail.telepac.pt
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+// $Id$
+// (Log is kept at end of this file)
 
 
 #ifndef _HUD_HXX
 
 #include <fg_typedefs.h>
 #include <fg_constants.h>
-#include <Aircraft/aircraft.h>
-#include <Flight/flight.h>
-#include <Controls/controls.h>
+#include <Aircraft/aircraft.hxx>
+#include <Flight/flight.hxx>
+#include <Controls/controls.hxx>
 
+#include <deque>        // STL double ended queue
 
-#include <deque>       // STL
 #ifdef NEEDNAMESPACESTD
 using namespace std;
 #endif
@@ -79,11 +77,12 @@ enum VIEW_MODES{ HUD_VIEW, PANEL_VIEW, CHASE_VIEW, TOWER_VIEW };
 // Hud general constants
 #define DAY                1
 #define NIGHT              2
-#define BRT_DARK           3
-#define BRT_MEDIUM         4
-#define BRT_LIGHT          5
-#define SIZE_SMALL         6
-#define SIZE_LARGE         7
+#define BRT_BLACK          3
+#define BRT_DARK           4
+#define BRT_MEDIUM         5
+#define BRT_LIGHT          6
+#define SIZE_SMALL         7
+#define SIZE_LARGE         8
 
 // Label constants
 #define SMALL              1
@@ -115,17 +114,17 @@ enum fgLabelJust{ LEFT_JUST, CENTER_JUST, RIGHT_JUST } ;
 #define LABEL_WARNING  2
 
 #define HUDS_AUTOTICKS           0x0001
-#define HUDS_VERT                0x0002\r
-#define HUDS_HORZ                0x0000\r
-#define HUDS_TOP                 0x0004\r
-#define HUDS_BOTTOM              0x0008\r
-#define HUDS_LEFT     HUDS_TOP\r
-#define HUDS_RIGHT    HUDS_BOTTOM\r
-#define HUDS_BOTH     (HUDS_LEFT | HUDS_RIGHT)\r
-#define HUDS_NOTICKS             0x0010\r
-#define HUDS_ARITHTIC            0x0020\r
-#define HUDS_DECITICS            0x0040\r
-#define HUDS_NOTEXT              0x0080\r
+#define HUDS_VERT                0x0002
+#define HUDS_HORZ                0x0000
+#define HUDS_TOP                 0x0004
+#define HUDS_BOTTOM              0x0008
+#define HUDS_LEFT     HUDS_TOP
+#define HUDS_RIGHT    HUDS_BOTTOM
+#define HUDS_BOTH     (HUDS_LEFT | HUDS_RIGHT)
+#define HUDS_NOTICKS             0x0010
+#define HUDS_ARITHTIC            0x0020
+#define HUDS_DECITICS            0x0040
+#define HUDS_NOTEXT              0x0080
 
 // Ladder orientaion
 // #define HUD_VERTICAL        1
@@ -164,6 +163,7 @@ extern double get_roll        ( void );
 extern double get_pitch       ( void );
 extern double get_heading     ( void );
 extern double get_altitude    ( void );
+extern double get_agl         ( void );
 extern double get_sideslip    ( void );
 extern double get_frame_rate  ( void );
 extern double get_latitude    ( void );
@@ -172,6 +172,8 @@ extern double get_longitude   ( void );
 extern double get_long_min    ( void );
 extern double get_fov         ( void );
 extern double get_vfc_ratio   ( void );
+extern double get_vfc_tris_drawn   ( void );
+extern double get_climb_rate  ( void );
 
 enum  hudinstype{ HUDno_instr,
               HUDscale,
@@ -185,19 +187,28 @@ enum  hudinstype{ HUDno_instr,
               HUDtbi
               };
 
+typedef struct gltagRGBTRIPLE { // rgbt
+    GLfloat Blue;
+    GLfloat Green;
+    GLfloat Red;
+} glRGBTRIPLE;
+
 class instr_item {  // An Abstract Base Class (ABC)
   private:
-    static UINT      instances;     // More than 64K instruments? Nah!
-    UINT             handle;
-    RECT             scrn_pos;      // Framing - affects scale dimensions
+    static UINT        instances;     // More than 64K instruments? Nah!
+    static int         brightness;
+    static glRGBTRIPLE color;
+
+    UINT               handle;
+    RECT               scrn_pos;      // Framing - affects scale dimensions
                                     // and orientation. Vert vs Horz, etc.
-    DBLFNPTR         load_value_fn;
-    UINT             opts;
-    bool             is_enabled;
-    bool             broken;
-    int              brightness;
-    UINT             scr_span;      // Working values for draw;
-    POINT            mid_span;      //
+    DBLFNPTR           load_value_fn;
+    double             disp_factor;   // Multiply by to get numbers shown on scale.
+    UINT               opts;
+    bool               is_enabled;
+    bool               broken;
+    UINT               scr_span;      // Working values for draw;
+    POINT              mid_span;      //
 
   public:
     instr_item( int            x,
@@ -205,6 +216,7 @@ class instr_item {  // An Abstract Base Class (ABC)
                 UINT           height,
                 UINT           width,
                 DBLFNPTR       data_source,
+                double         data_scaling,
                 UINT           options,
                 bool           working      = true);
 
@@ -217,7 +229,9 @@ class instr_item {  // An Abstract Base Class (ABC)
     RECT         get_location    ( void ) { return scrn_pos;  }
     bool         is_broken       ( void ) { return broken;    }
     bool         enabled         ( void ) { return is_enabled;}
-    double       get_value       ( void ) { return load_value_fn();}
+    bool         data_available  ( void ) { return !!load_value_fn; }
+    double       get_value       ( void ) { return load_value_fn(); }
+    double       data_scaling    ( void ) { return disp_factor; }
     UINT         get_span        ( void ) { return scr_span;  }
     POINT        get_centroid    ( void ) { return mid_span;  }
     UINT         get_options     ( void ) { return opts;      }
@@ -259,6 +273,7 @@ class instr_label : public instr_item {
                  const char  *label_format,
                  const char  *pre_label_string  = 0,
                  const char  *post_label_string = 0,
+                 double       scale_data        = 1.0,
                  UINT         options           = HUDS_TOP,
                  fgLabelJust  justification     = CENTER_JUST,
                  int          font_size         = SMALL,
@@ -269,7 +284,6 @@ class instr_label : public instr_item {
 
     instr_label( const instr_label & image);
     instr_label & operator = (const instr_label & rhs );
-
     virtual void draw( void );       // Required method in base class
 };
 
@@ -289,7 +303,6 @@ class instr_scale : public instr_item {
     double scale_factor;  // factor => screen units/range values.
     UINT   Maj_div;       // major division marker units
     UINT   Min_div;       // minor division marker units
-    double disp_factor;   // Multiply by to get numbers shown on scale.
     UINT   Modulo;        // Roll over point
     int    signif_digits; // digits to show to the right.
 
@@ -480,7 +493,9 @@ class HudLadder : public dual_instr_item {
 //using namespace std;
 //deque <instr_item>  * Hdeque_ptr;
 
+extern void HUD_brightkey( bool incr_bright );
 extern int  fgHUDInit( fgAIRCRAFT * /* current_aircraft */ );
+extern int  fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ );
 extern void fgUpdateHUD( void );
 
 extern void drawOneLine ( UINT x1, UINT y1, UINT x2, UINT y2);
@@ -508,80 +523,106 @@ void fgHUDSetTimeMode( Hptr hud, int time_of_day );
 
 #endif // _HUD_H
 
-/* $Log$
-/* Revision 1.8  1998/07/03 13:16:29  curt
-/* Added Charlie Hotchkiss's HUD updates and improvementes.
-/*
- * Revision 1.6  1998/06/03 00:43:28  curt
- * No .h when including stl stuff.
- *
- * Revision 1.5  1998/05/17 16:58:13  curt
- * Added a View Frustum Culling ratio display to the hud.
- *
- * Revision 1.4  1998/05/16 13:04:15  curt
- * New updates from Charlie Hotchkiss.
- *
- * Revision 1.3  1998/05/13 18:27:55  curt
- * Added an fov to hud display.
- *
- * Revision 1.2  1998/05/11 18:13:12  curt
- * Complete C++ rewrite of all cockpit code by Charlie Hotchkiss.
- *
- * Revision 1.15  1998/02/23 19:07:57  curt
- * Incorporated Durk's Astro/ tweaks.  Includes unifying the sun position
- * calculation code between sun display, and other FG sections that use this
- * for things like lighting.
- *
- * Revision 1.14  1998/02/21 14:53:14  curt
- * Added Charlie's HUD changes.
- *
- * Revision 1.13  1998/02/20 00:16:22  curt
- * Thursday's tweaks.
- *
- * Revision 1.12  1998/02/19 13:05:52  curt
- * Incorporated some HUD tweaks from Michelle America.
- * Tweaked the sky's sunset/rise colors.
- * Other misc. tweaks.
- *
- * Revision 1.11  1998/02/16 13:38:42  curt
- * Integrated changes from Charlie Hotchkiss.
- *
- * Revision 1.11  1998/02/16 13:38:42  curt
- * Integrated changes from Charlie Hotchkiss.
- *
- * Revision 1.10  1998/02/12 21:59:42  curt
- * Incorporated code changes contributed by Charlie Hotchkiss
- * <chotchkiss@namg.us.anritsu.com>
- *
- * Revision 1.8  1998/02/07 15:29:35  curt
- * Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
- * <chotchkiss@namg.us.anritsu.com>
- *
- * Revision 1.7  1998/02/03 23:20:15  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.6  1998/01/22 02:59:30  curt
- * Changed #ifdef FILE_H to #ifdef _FILE_H
- *
- * Revision 1.5  1998/01/19 19:27:01  curt
- * Merged in make system changes from Bob Kuehne <rpk@sgi.com>
- * This should simplify things tremendously.
- *
- * Revision 1.4  1998/01/19 18:40:21  curt
- * Tons of little changes to clean up the code and to remove fatal errors
- * when building with the c++ compiler.
- *
- * Revision 1.3  1997/12/30 16:36:41  curt
- * Merged in Durk's changes ...
- *
- * Revision 1.2  1997/12/10 22:37:40  curt
- * Prepended "fg" on the name of all global structures that didn't have it yet.
- * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
- *
- * Revision 1.1  1997/08/29 18:03:22  curt
- * Initial revision.
- *
- */
+// $Log$
+// Revision 1.16  1998/10/17 01:33:59  curt
+// C++ ifying ...
+//
+// Revision 1.15  1998/10/16 23:27:27  curt
+// C++-ifying.
+//
+// Revision 1.14  1998/09/29 14:56:33  curt
+// c++-ified comments.
+//
+// Revision 1.13  1998/09/29 02:01:09  curt
+// Added a "rate of climb" indicator.
+//
+// Revision 1.12  1998/08/24 20:05:17  curt
+// Added a second minimalistic HUD.
+// Added code to display the number of triangles rendered.
+//
+// Revision 1.11  1998/07/24 21:36:55  curt
+// Ran dos2unix to get rid of extraneous ^M's.  Tweaked parameter in
+// ImageGetRawData() to match usage.
+//
+// Revision 1.10  1998/07/13 21:28:02  curt
+// Converted the aoa scale to a radio altimeter.
+//
+// Revision 1.9  1998/07/13 21:00:48  curt
+// Integrated Charlies latest HUD updates.
+// Wrote access functions for current fgOPTIONS.
+//
+// Revision 1.8  1998/07/03 13:16:29  curt
+// Added Charlie Hotchkiss's HUD updates and improvementes.
+//
+// Revision 1.6  1998/06/03 00:43:28  curt
+// No .h when including stl stuff.
+//
+// Revision 1.5  1998/05/17 16:58:13  curt
+// Added a View Frustum Culling ratio display to the hud.
+//
+// Revision 1.4  1998/05/16 13:04:15  curt
+// New updates from Charlie Hotchkiss.
+//
+// Revision 1.3  1998/05/13 18:27:55  curt
+// Added an fov to hud display.
+//
+// Revision 1.2  1998/05/11 18:13:12  curt
+// Complete C++ rewrite of all cockpit code by Charlie Hotchkiss.
+//
+// Revision 1.15  1998/02/23 19:07:57  curt
+// Incorporated Durk's Astro/ tweaks.  Includes unifying the sun position
+// calculation code between sun display, and other FG sections that use this
+// for things like lighting.
+//
+// Revision 1.14  1998/02/21 14:53:14  curt
+// Added Charlie's HUD changes.
+//
+// Revision 1.13  1998/02/20 00:16:22  curt
+// Thursday's tweaks.
+//
+// Revision 1.12  1998/02/19 13:05:52  curt
+// Incorporated some HUD tweaks from Michelle America.
+// Tweaked the sky's sunset/rise colors.
+// Other misc. tweaks.
+//
+// Revision 1.11  1998/02/16 13:38:42  curt
+// Integrated changes from Charlie Hotchkiss.
+//
+// Revision 1.11  1998/02/16 13:38:42  curt
+// Integrated changes from Charlie Hotchkiss.
+//
+// Revision 1.10  1998/02/12 21:59:42  curt
+// Incorporated code changes contributed by Charlie Hotchkiss
+// <chotchkiss@namg.us.anritsu.com>
+//
+// Revision 1.8  1998/02/07 15:29:35  curt
+// Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
+// <chotchkiss@namg.us.anritsu.com>
+//
+// Revision 1.7  1998/02/03 23:20:15  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.6  1998/01/22 02:59:30  curt
+// Changed #ifdef FILE_H to #ifdef _FILE_H
+//
+// Revision 1.5  1998/01/19 19:27:01  curt
+// Merged in make system changes from Bob Kuehne <rpk@sgi.com>
+// This should simplify things tremendously.
+//
+// Revision 1.4  1998/01/19 18:40:21  curt
+// Tons of little changes to clean up the code and to remove fatal errors
+// when building with the c++ compiler.
+//
+// Revision 1.3  1997/12/30 16:36:41  curt
+// Merged in Durk's changes ...
+//
+// Revision 1.2  1997/12/10 22:37:40  curt
+// Prepended "fg" on the name of all global structures that didn't have it yet.
+// i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+//
+// Revision 1.1  1997/08/29 18:03:22  curt
+// Initial revision.
+//