]> git.mxchange.org Git - flightgear.git/blobdiff - Cockpit/hud.h
Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
[flightgear.git] / Cockpit / hud.h
index 0e34464d898cec39ba1c675e485829b28d67b4bb..1fe479e486127a0d70fe57a6a51af77d70e47963 100644 (file)
 
 /* Instrument types */
 #define ARTIFICIAL_HORIZON     1
-#define SCALE                          2
-#define LADDER                         3
-#define LABEL                          4
-#define CONTROL_SURFACES               5
+#define SCALE              2
+#define LADDER             3
+#define LABEL              4
 
 /* Scale constants */
-#define HORIZONTAL                     1
-#define TOP                                    2
-#define        BOTTOM                          3
-#define VERTICAL                       4
-#define LEFT                           5
-#define RIGHT                          6
-#define        LIMIT                           7
-#define NOLIMIT                                8
+#define HORIZONTAL         1
+#define TOP                2
+#define BOTTOM             3
+#define VERTICAL           4
+#define LEFT               5
+#define RIGHT              6
+#define LIMIT              7
+#define NOLIMIT            8
 
 /* Label constants */
-#define SMALL                          1
-#define LARGE                          2
-#define BLINK                          3
-#define NOBLINK                                4
-#define LEFT_JUST                      5
-#define CENTER_JUST                    6
-#define RIGHT_JUST                     7
+#define SMALL              1
+#define LARGE              2
+#define BLINK              3
+#define NOBLINK            4
+#define LEFT_JUST          5
+#define CENTER_JUST        6
+#define RIGHT_JUST         7
 
 /* Ladder constants */
-#define NONE                           1
-#define UPPER_LEFT                     2
-#define UPPER_CENTER           3
-#define UPPER_RIGHT                    4
-#define CENTER_RIGHT           5
-#define LOWER_RIGHT                    6
-#define LOWER_CENTER           7
-#define LOWER_LEFT                     8
-#define CENTER_LEFT                    9
-#define SOLID_LINES                    10
-#define DASHED_LINES           11
-#define DASHED_NEG_LINES       12
+#define NONE               1
+#define UPPER_LEFT         2
+#define UPPER_CENTER       3
+#define UPPER_RIGHT        4
+#define CENTER_RIGHT       5
+#define LOWER_RIGHT        6
+#define LOWER_CENTER       7
+#define LOWER_LEFT         8
+#define CENTER_LEFT        9
+#define SOLID_LINES       10
+#define DASHED_LINES      11
+#define DASHED_NEG_LINES  12
 
 /* Ladder orientaion */
 // #define HUD_VERTICAL        1
 // #define HUD_INSTR_HORIZON   3
 // #define HUD_INSTR_LABEL             4
 
-struct HUD_scale {
-       int type;
-       int scr_pos;
-       int scr_min;
-       int scr_max;
-       int div_min;
-       int div_max;
-       int orientation;
-       int with_minimum;
-       int minimum_value;
-       int width_units;
-       double (*load_value)( void );
-};
-
-struct HUD_circular_scale {
+// The following structs will become classes with a derivation from
+// an ABC instrument_pack. Eventually the instruments may well become
+// dll's. This would open the instrumentation issue to all commers.
+//
+// Methods Needed:
+//    Constructor()
+//    Initialization();  // For dynamic scenario settups?
+//    Update();          // Follow the data changes.
+//    Repaint();         // Respond to uncover/panel repaints.
+//    Break();           // Show a frown.
+//    Fix();             // Return to normal appearance and function.
+//    Night_Day();       // Illumination changes appearance/bitmaps.
+//
+
+typedef struct  {
+  int type;
+  int sub_type;
+  int scr_pos;
+  int scr_min;
+  int scr_max;
+  int div_min;
+  int div_max;
+  int orientation;
+  int with_minimum;
+  int minimum_value;
+  int maximum_value;
+  int width_units;
+  double (*load_value)( void );
+}HUD_scale,  *pHUDscale;
+
+typedef struct  {
        int type;
        int scr_pos;
        int scr_min;
@@ -124,9 +139,9 @@ struct HUD_circular_scale {
        int label_position;
        int width_units;
        double (*load_value)( void );
-};
+}HUD_circular_scale, *pHUD_circscale;
 
-struct HUD_ladder {
+typedef struct  {
        int type;
        int x_pos;
        int y_pos;
@@ -138,9 +153,9 @@ struct HUD_ladder {
        int width_units;
        double (*load_roll)( void );
        double (*load_pitch)( void );
-};
+}HUD_ladder, *pHUDladder;
 
-struct HUD_circular_ladder {
+typedef struct {
        int scr_min;
        int scr_max;
        int div_min;
@@ -149,31 +164,30 @@ struct HUD_circular_ladder {
        int label_position;
        int width_units;
        double (*load_value)( void );
-};
+} HUD_circular_ladder, *pHUDcircladder;
 
 #define HORIZON_FIXED  1
 #define HORIZON_MOVING 2
 
-struct HUD_horizon {
+typedef struct{
        int type;
        int x_pos;
        int y_pos;
        int scr_width;
        int scr_hole;
        double (*load_value)( void );
-};
+} HUD_horizon, *pHUDhorizon;
 
-struct HUD_control_surfaces {
+typedef struct {
        int type;
        int x_pos;
        int y_pos;
        double (*load_value)();
-};
-
+} HUD_control_surfaces, *pHUDControlSurface;
 #define LABEL_COUNTER  1
 #define LABEL_WARNING  2
 
-struct HUD_label {
+typedef struct {
        int type;
        int x_pos;
        int y_pos;
@@ -183,71 +197,133 @@ struct HUD_label {
        char *pre_str;
        char *post_str;
        char *format;
-       double (*load_value)( void );
-};
-
-union HUD_instr_data {
-       struct HUD_scale scale;
-       struct HUD_circular_scale circ_scale;
-       struct HUD_ladder ladder;
-       struct HUD_circular_ladder circ_ladder;
-       struct HUD_horizon horizon;
-       struct HUD_label label;
-       struct HUD_control_surfaces control_surfaces;
-};
-
-typedef struct HUD_instr *HIptr;
-
-struct HUD_instr {
-       int type;
-       int sub_type;
-       int orientation;
-       union HUD_instr_data instr;
-       int color;
-       HIptr next;
-};
-
-struct HUD {
+       double (*load_value)( void ); // pointer to routine to get the data
+} HUD_label, *pHUDlabel;
+
+// Removed union HUD_instr_data to evolve this to oop code.
+
+enum hudinstypes { HUDno_instr,
+                   HUDscale,
+                   HUDcirc_scale,
+                   HUDladder,
+                   HUDcirc_ladder,
+                   HUDhorizon,
+                   HUDlabel,
+                   HUDcontrols
+                   };
+
+typedef struct HUD_INSTR_STRUCT{
+  int type;
+  int sub_type;
+  int orientation;
+  void *instr;   // For now we will cast this pointer accoring to the value
+                 // of the type member.
+  struct HUD_INSTR_STRUCT *next;
+} HUD_instr, *HIptr;
+
+typedef struct  {
        int code;
-       // struct HUD_instr *instruments;
        HIptr instruments;
        int status;
-};
-
-typedef struct HUD *Hptr;
-
-Hptr fgHUDInit( struct fgAIRCRAFT cur_aircraft, int color );
-Hptr fgHUDAddHorizon( Hptr hud, int x_pos, int y_pos, int length, int hole_len, double (*load_value)( void ) );
-Hptr fgHUDAddScale( Hptr hud, int type, int scr_pos, int scr_min, int scr_max, int div_min, int div_max, \
-                                       int orientation, int with_min, int min_value, int width_units, double (*load_value)( void ) );
-Hptr fgHUDAddLabel( Hptr hud, int x_pos, int y_pos, int size, int blink, int justify, \
-                                       char *pre_str, char *post_str, char *format, double (*load_value)( void ) );
-Hptr fgHUDAddLadder( Hptr hud, int x_pos, int y_pos, int scr_width, int scr_height, \
-                                       int hole_len, int div_units, int label_pos, int max_value, \
-                                       double (*load_roll)( void ), double (*load_pitch)( void ) );
-Hptr fgHUDAddControlSurfaces( Hptr hud, int x_pos, int y_pos, double (*get_heading)() );                                       
-                                       
-                                       
-/* struct HUD *fgHUDAddLadder( Hptr hud, int scr_min, int scr_max, int div_min, int div_max, \
-                                       int orientation, int max_value, double *(load_value);
-struct HUD *fgHUDAddCircularLadder( Hptr hud, int scr_min, int scr_max, int div_min, int div_max, \
-                                       int max_value, double *(load_value) );
-struct HUD *fgHUDAddNumDisp( Hptr hud, int x_pos, int y_pos, int size, int blink, \
-                                       char *pre_str, char *post_str, double *(load_value) ); */
-void fgUpdateHUD( Hptr hud );
-void fgUpdateHUD2( struct HUD *hud );
+}HUD, *Hptr;
+
+Hptr fgHUDInit      ( fgAIRCRAFT *cur_aircraft );
+
+Hptr fgHUDAddHorizon( Hptr hud,
+                      int x_pos,
+                      int y_pos,
+                      int length,
+                      int hole_len,
+                      double (*load_value)( void ) );
+
+Hptr fgHUDAddScale  ( Hptr hud,                    \
+                      int type,                    \
+                      int subtype,                 \
+                      int scr_pos,                 \
+                      int scr_min,                 \
+                      int scr_max,                 \
+                      int div_min,                 \
+                      int div_max,                 \
+                      int orientation,             \
+                      int with_min,                \
+                      int min_value,               \
+                      int width_units,             \
+                      double (*load_value)( void ) );
+
+Hptr fgHUDAddLabel  ( Hptr hud,                    \
+                      int x_pos,                   \
+                      int y_pos,                   \
+                      int size,                    \
+                      int blink,                   \
+                      int justify,                 \
+                      char *pre_str,               \
+                      char *post_str,              \
+                      char *format,                \
+                      double (*load_value)( void ) );
+
+Hptr fgHUDAddLadder ( Hptr hud,                    \
+                      int x_pos,                   \
+                      int y_pos,                   \
+                      int scr_width,               \
+                      int scr_height,              \
+                      int hole_len,                \
+                      int div_units,               \
+                      int label_pos,               \
+                      int max_value,               \
+                      double (*load_roll)( void ), \
+                      double (*load_pitch)( void ) );
+
+Hptr fgHUDAddControlSurfaces( Hptr hud,
+                              int x_pos,
+                              int y_pos,
+                              double (*load_value)(void) );
+
+/*
+Hptr fgHUDAddLadder ( Hptr hud,
+                      int scr_min,
+                      int scr_max,
+                      int div_min,
+                      int div_max, \
+                                                   int orientation,
+                      int max_value,
+                      double *(load_value);
+
+Hptr fgHUDAddCircularLadder( Hptr hud,
+                             int scr_min,
+                             int scr_max,
+                             int div_min,
+                             int div_max, \
+                                                          int max_value,
+                             double *(load_value) );
+
+Hptr fgHUDAddNumDisp( Hptr hud,
+                      int x_pos,
+                      int y_pos,
+                      int size,
+                      int blink, \
+                                                   char *pre_str,
+                      char *post_str,
+                      double *(load_value) );
+*/
+
+void fgUpdateHUD ( Hptr hud );
+void fgUpdateHUD2( Hptr hud ); // Future use?
 
 
 #endif /* _HUD_H */
 
 
 /* $Log$
-/* 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.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
  *