]> git.mxchange.org Git - flightgear.git/blob - src/Cockpit/hud.hxx
Added Mach Number to hud.
[flightgear.git] / src / Cockpit / hud.hxx
1 // hud.hxx -- hud defines and prototypes (initial draft)
2 //
3 // Written by Michele America, started September 1997.
4 //
5 // Copyright (C) 1997  Michele F. America  - nomimarketing@mail.telepac.pt
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 //
21 // $Id$
22
23
24 #ifndef _HUD_HXX
25 #define _HUD_HXX
26
27 #ifndef __cplusplus
28 # error This library requires C++
29 #endif
30
31 #ifdef HAVE_CONFIG_H
32 #  include <config.h>
33 #endif
34
35 #ifdef HAVE_WINDOWS_H
36 #  include <windows.h>
37 #endif
38
39 #include <GL/glut.h>
40 #include <stdlib.h>
41 #include <string.h>
42
43 #ifdef HAVE_VALUES_H
44 #  include <values.h>  // for MAXINT
45 #endif
46
47 #include <vector>       // STL vector
48 #include <deque>        // STL double ended queue
49
50 #include <fg_typedefs.h>
51 #include <fg_constants.h>
52 #include <Aircraft/aircraft.hxx>
53 #include <FDM/flight.hxx>
54 #include <Controls/controls.hxx>
55 #include <GUI/gui.h>
56 #include <Math/mat3.h>
57
58 FG_USING_STD(deque);
59 FG_USING_STD(vector);
60 FG_USING_NAMESPACE(std);
61
62
63 #ifndef WIN32
64   typedef struct {
65       int x, y;
66   } POINT;
67  
68   typedef struct {
69       int top, bottom, left, right;
70   } RECT;
71 #endif
72
73 // View mode definitions
74
75 enum VIEW_MODES{ HUD_VIEW, PANEL_VIEW, CHASE_VIEW, TOWER_VIEW };
76
77 // DAY, NIGHT and brightness levels need to be visible where dialogs and
78 // controls can be used to set intensity and appropriate color. This will
79 // be moved.
80 // Hud general constants
81 #define DAY                1
82 #define NIGHT              2
83 #define BRT_BLACK          3
84 #define BRT_DARK           4
85 #define BRT_MEDIUM         5
86 #define BRT_LIGHT          6
87 #define SIZE_SMALL         7
88 #define SIZE_LARGE         8
89
90 // Label constants
91 #define SMALL              1
92 #define LARGE              2
93
94 #define BLINK              3
95 #define NOBLINK            4
96
97 enum fgLabelJust{ LEFT_JUST, CENTER_JUST, RIGHT_JUST } ;
98
99 // Ladder constants
100 #define NONE               1
101 #define UPPER_LEFT         2
102 #define UPPER_CENTER       3
103 #define UPPER_RIGHT        4
104 #define CENTER_RIGHT       5
105 #define LOWER_RIGHT        6
106 #define LOWER_CENTER       7
107 #define LOWER_LEFT         8
108 #define CENTER_LEFT        9
109 #define SOLID_LINES       10
110 #define DASHED_LINES      11
111 #define DASHED_NEG_LINES  12
112
113
114 #define HORIZON_FIXED   1
115 #define HORIZON_MOVING  2
116 #define LABEL_COUNTER   1
117 #define LABEL_WARNING   2
118
119 #define HUDS_AUTOTICKS           0x0001
120 #define HUDS_VERT                0x0002
121 #define HUDS_HORZ                0x0000
122 #define HUDS_TOP                 0x0004
123 #define HUDS_BOTTOM              0x0008
124 #define HUDS_LEFT     HUDS_TOP
125 #define HUDS_RIGHT    HUDS_BOTTOM
126 #define HUDS_BOTH     (HUDS_LEFT | HUDS_RIGHT)
127 #define HUDS_NOTICKS             0x0010
128 #define HUDS_ARITHTIC            0x0020
129 #define HUDS_DECITICS            0x0040
130 #define HUDS_NOTEXT              0x0080
131
132 // Ladder orientaion
133 // #define HUD_VERTICAL        1
134 // #define HUD_HORIZONTAL       2
135 // #define HUD_FREEFLOAT        3
136
137 // Ladder orientation modes
138 // #define HUD_LEFT         1
139 // #define HUD_RIGHT            2
140 // #define HUD_TOP              1
141 // #define HUD_BOTTOM           2
142 // #define HUD_V_LEFT           1
143 // #define HUD_V_RIGHT          2
144 // #define HUD_H_TOP            1
145 // #define HUD_H_BOTTOM         2
146
147
148 // Ladder sub-types
149 // #define HUD_LIM              1
150 // #define HUD_NOLIM            2
151 // #define HUD_CIRC         3
152
153 // #define HUD_INSTR_LADDER 1
154 // #define HUD_INSTR_CLADDER    2
155 // #define HUD_INSTR_HORIZON    3
156 // #define HUD_INSTR_LABEL      4
157
158 // in cockpit.cxx
159 extern float get_throttleval ( void );
160 extern float get_aileronval  ( void );
161 extern float get_elevatorval ( void );
162 extern float get_elev_trimval( void );
163 extern float get_rudderval   ( void );
164 extern float get_speed       ( void );
165 extern float get_aoa         ( void );
166 extern float get_roll        ( void );
167 extern float get_pitch       ( void );
168 extern float get_heading     ( void );
169 extern float get_view_direction( void );
170 extern float get_altitude    ( void );
171 extern float get_agl         ( void );
172 extern float get_sideslip    ( void );
173 extern float get_frame_rate  ( void );
174 extern float get_latitude    ( void );
175 extern float get_lat_min     ( void );
176 extern float get_longitude   ( void );
177 extern float get_long_min    ( void );
178 extern float get_fov         ( void );
179 extern float get_vfc_ratio   ( void );
180 extern float get_vfc_tris_drawn   ( void );
181 extern float get_vfc_tris_culled   ( void );
182 extern float get_climb_rate  ( void );
183 extern float get_mach( void );
184 extern char *coord_format_lat(float);
185 extern char *coord_format_lon(float);
186 //extern char *coord_format_latlon(float latitude, float longitude);  // cockpit.cxx
187
188 extern char *get_formated_gmt_time( void );
189
190 enum  hudinstype{ HUDno_instr,
191               HUDscale,
192               HUDlabel,
193               HUDladder,
194               HUDcirc_ladder,
195               HUDhorizon,
196               HUDguage,
197               HUDdual_inst,
198               HUDmoving_scale,
199               HUDtbi
200               };
201
202 typedef struct gltagRGBTRIPLE { // rgbt
203     GLfloat Blue;
204     GLfloat Green;
205     GLfloat Red;
206 } glRGBTRIPLE;
207
208 class fgLineSeg2D {
209 private:
210     GLfloat x0, y0, x1, y1;
211
212 public:
213     fgLineSeg2D( GLfloat a = 0, GLfloat b =0, GLfloat c = 0, GLfloat d =0 )
214         : x0(a), y0(b),  x1(c), y1(d) {}
215
216     fgLineSeg2D( const fgLineSeg2D & image )
217         : x0(image.x0), y0(image.y0), x1(image.x1), y1(image.y1) {}
218
219     fgLineSeg2D& operator= ( const fgLineSeg2D & image ) {
220         x0 = image.x0; y0 = image.y0; x1 = image.x1; y1 = image.y1; return *this;
221     }
222
223     ~fgLineSeg2D() {}
224     
225     void draw()
226     {
227         glVertex2f(x0, y0);
228         glVertex2f(x1, y1);
229     }
230 };
231
232 #define USE_HUD_TextList
233 extern float              HUD_TextSize;
234 extern fntRenderer       *HUDtext;
235 extern float HUD_matrix[16];
236
237 class fgText {
238 private:
239     float x, y;
240     char msg[64];
241 public:
242     fgText( float x = 0, float y = 0, char *c = NULL )
243         : x(x), y(y) {strncpy(msg,c,64-1);}
244
245     fgText( const fgText & image )
246         : x(image.x), y(image.y) {strcpy(msg,image.msg);}
247
248     fgText& operator = ( const fgText & image ) {
249         strcpy(msg,image.msg); x = image.x; y = image.y;
250         return *this;
251     }
252
253     ~fgText() {msg[0]='\0';}
254
255     int getStringWidth ( char *str )
256     {
257         if ( HUDtext && str )
258         {
259             float r, l ;
260             guiFntHandle->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
261             return FloatToInt( r - l );
262         }
263         return 0 ;
264     }
265     
266     int StringWidth (void )
267     {
268         if ( HUDtext && strlen( msg ))
269         {
270             float r, l ;
271             guiFntHandle->getBBox ( msg, HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
272             return FloatToInt( r - l );
273         }
274         return 0 ;
275     }
276     
277     void Draw(fntRenderer *fnt)
278     {
279         fnt->start2f( x, y );
280         fnt->puts   ( msg ) ;
281     }
282
283     void Draw()
284     {
285         puDrawString ( guiFnt, msg, FloatToInt(x), FloatToInt(y) );
286     }
287 };
288
289 class fgLineList {
290     vector < fgLineSeg2D > List;
291 public:
292     fgLineList( void ) {}
293     ~fgLineList( void ) {}
294     void add( fgLineSeg2D seg ) { List.push_back(seg); }
295     void erase( void ) { List.erase( List.begin(), List.end() ); }
296     void draw( void ) {
297         vector < fgLineSeg2D > :: iterator curSeg;
298         vector < fgLineSeg2D > :: iterator lastSeg;
299         curSeg  = List.begin();
300         lastSeg = List.end();
301         glBegin(GL_LINES);
302         for ( ; curSeg != lastSeg; curSeg++ ) {
303             curSeg->draw();
304         }
305         glEnd();
306     }
307 };
308
309 class fgTextList {
310     fntRenderer *Font;
311     vector< fgText > List;
312 public:
313     fgTextList ( void ) { Font = 0; }
314     ~fgTextList( void ) {}
315     
316     void setFont( fntRenderer *Renderer ) { Font = Renderer; }
317     void add( fgText String ) { List.push_back(String); }
318     void erase( void ) { List.erase( List.begin(), List.end() ); }
319     
320     void draw( void ) {
321         vector < fgText > :: iterator curString;
322         vector < fgText > :: iterator lastString;
323         if( Font == 0 ) return;
324         curString  = List.begin();
325         lastString = List.end();
326         glPushAttrib( GL_COLOR_BUFFER_BIT );
327         glEnable    ( GL_ALPHA_TEST   ) ;
328         glEnable    ( GL_BLEND        ) ;
329         glAlphaFunc ( GL_GREATER, 0.1 ) ;
330         glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ;
331
332         Font->begin();
333         for( ; curString != lastString; curString++ ) {
334             curString->Draw(Font);
335         }
336         Font->end();
337
338         glDisable ( GL_TEXTURE_2D ) ;
339         glPopAttrib();
340     }
341 };
342
343
344 inline void Text( fgTextList &List, float x, float y, char *s)
345 {
346     List.add( fgText( x, y, s) );
347 }
348
349 inline void Text( fgTextList &List, fgText &me)
350 {
351     List.add(me);
352 }
353
354 inline void Line( fgLineList &List, float x1, float y1, float x2, float y2)
355 {
356     List.add(fgLineSeg2D(x1,y1,x2,y2));
357 }
358
359
360 // Declare our externals
361 extern fgTextList         HUD_TextList;
362 extern fgLineList         HUD_LineList;
363 extern fgLineList         HUD_StippleLineList;
364
365
366 class instr_item {  // An Abstract Base Class (ABC)
367   private:
368     static UINT        instances;     // More than 64K instruments? Nah!
369     static int         brightness;
370     static glRGBTRIPLE color;
371
372     UINT               handle;
373     RECT               scrn_pos;      // Framing - affects scale dimensions
374                                     // and orientation. Vert vs Horz, etc.
375     FLTFNPTR           load_value_fn;
376     float              disp_factor;   // Multiply by to get numbers shown on scale.
377     UINT               opts;
378     bool               is_enabled;
379     bool               broken;
380     UINT               scr_span;      // Working values for draw;
381     POINT              mid_span;      //
382
383   public:
384     instr_item( int            x,
385                 int            y,
386                 UINT           height,
387                 UINT           width,
388                 FLTFNPTR       data_source,
389                 float         data_scaling,
390                 UINT           options,
391                 bool           working      = true);
392
393     instr_item( const instr_item & image );
394
395     instr_item & operator = ( const instr_item & rhs );
396     virtual ~instr_item ();
397
398     int     get_brightness  ( void ) { return brightness;}
399     RECT    get_location    ( void ) { return scrn_pos;  }
400     bool    is_broken       ( void ) { return broken;    }
401     bool    enabled         ( void ) { return is_enabled;}
402     bool    data_available  ( void ) { return !!load_value_fn; }
403     float   get_value       ( void ) { return load_value_fn(); }
404     float   data_scaling    ( void ) { return disp_factor; }
405     UINT    get_span        ( void ) { return scr_span;  }
406     POINT   get_centroid    ( void ) { return mid_span;  }
407     UINT    get_options     ( void ) { return opts;      }
408
409     UINT    huds_vert     (UINT options) { return( options  & HUDS_VERT ); }
410     UINT    huds_left     (UINT options) { return( options  & HUDS_LEFT ); }
411     UINT    huds_right    (UINT options) { return( options  & HUDS_RIGHT ); }
412     UINT    huds_both     (UINT options) { return( (options & HUDS_BOTH) == HUDS_BOTH ); }
413     UINT    huds_noticks  (UINT options) { return( options  & HUDS_NOTICKS ); }
414     UINT    huds_notext   (UINT options) { return( options  & HUDS_NOTEXT ); }
415     UINT    huds_top      (UINT options) { return( options  & HUDS_TOP ); }
416     UINT    huds_bottom   (UINT options) { return( options  & HUDS_BOTTOM ); }
417   
418     virtual void display_enable( bool working ) { is_enabled = !! working;}
419
420     virtual void update( void );
421     virtual void break_display ( bool bad );
422     virtual void SetBrightness( int illumination_level ); // fgHUDSetBright...
423     void         SetPosition  ( int x, int y, UINT width, UINT height );
424     UINT         get_Handle( void );
425     virtual void draw( void ) = 0;   // Required method in derived classes
426     
427     void drawOneLine( float x1, float y1, float x2, float y2)
428     {
429         HUD_LineList.add(fgLineSeg2D(x1,y1,x2,y2));
430     }
431     void drawOneStippleLine( float x1, float y1, float x2, float y2)
432     {
433         HUD_StippleLineList.add(fgLineSeg2D(x1,y1,x2,y2));
434     }
435     void TextString( char *msg, float x, float y )
436     {
437         HUD_TextList.add(fgText(x, y, msg));        
438     }
439     int getStringWidth ( char *str )
440     {
441         if ( HUDtext && str )
442         {
443             float r, l ;
444             guiFntHandle->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
445             return FloatToInt( r - l );
446         }
447         return 0 ;
448     }
449     
450 };
451
452 typedef instr_item *HIptr;
453 //typedef deque <  instr_item * > hud_deque_type;
454 //typedef hud_deque_type::iterator hud_deque_iterator;
455 //typedef hud_deque_type::const_iterator hud_deque_const_iterator;
456
457 extern deque< instr_item *> HUD_deque;
458 extern int HUD_style;
459 //extern hud_deque_type HUD_deque;
460
461 // instr_item           This class has no other purpose than to maintain
462 //                      a linked list of instrument and derived class
463 // object pointers.
464
465
466 class instr_label : public instr_item {
467   private:
468     const char *pformat;
469     const char *pre_str;
470     const char *post_str;
471     fgLabelJust justify;
472     int         fontSize;
473     int         blink;
474     char format_buffer[80];
475
476   public:
477     instr_label( int          x,
478                  int          y,
479                  UINT         width,
480                  UINT         height,
481                  FLTFNPTR     data_source,
482                  const char  *label_format,
483                  const char  *pre_label_string  = 0,
484                  const char  *post_label_string = 0,
485                  float       scale_data        = 1.0,
486                  UINT         options           = HUDS_TOP,
487                  fgLabelJust  justification     = CENTER_JUST,
488                  int          font_size         = SMALL,
489                  int          blinking          = NOBLINK,
490                  bool         working           = true);
491
492     ~instr_label();
493
494     instr_label( const instr_label & image);
495     instr_label & operator = (const instr_label & rhs );
496     virtual void draw( void );       // Required method in base class
497 };
498
499 typedef instr_label * pInstlabel;
500
501
502 class lat_label : public instr_item {
503   private:
504     const char *pformat;
505     const char *pre_str;
506     const char *post_str;
507     fgLabelJust justify;
508     int         fontSize;
509     int         blink;
510     char format_buffer[80];
511
512   public:
513     lat_label( int          x,
514                  int          y,
515                  UINT         width,
516                  UINT         height,
517                  FLTFNPTR     data_source,
518                  const char  *label_format,
519                  const char  *pre_label_string  = 0,
520                  const char  *post_label_string = 0,
521                  float       scale_data        = 1.0,
522                  UINT         options           = HUDS_TOP,
523                  fgLabelJust  justification     = CENTER_JUST,
524                  int          font_size         = SMALL,
525                  int          blinking          = NOBLINK,
526                  bool         working           = true);
527
528     ~lat_label();
529
530     lat_label( const lat_label & image);
531     lat_label & operator = (const lat_label & rhs );
532     virtual void draw( void );       // Required method in base class
533 };
534
535 typedef lat_label * pLatlabel;
536
537 class lon_label : public instr_item {
538   private:
539     const char *pformat;
540     const char *pre_str;
541     const char *post_str;
542     fgLabelJust justify;
543     int         fontSize;
544     int         blink;
545     char format_buffer[80];
546
547   public:
548     lon_label( int          x,
549                  int          y,
550                  UINT         width,
551                  UINT         height,
552                  FLTFNPTR     data_source,
553                  const char  *label_format,
554                  const char  *pre_label_string  = 0,
555                  const char  *post_label_string = 0,
556                  float       scale_data        = 1.0,
557                  UINT         options           = HUDS_TOP,
558                  fgLabelJust  justification     = CENTER_JUST,
559                  int          font_size         = SMALL,
560                  int          blinking          = NOBLINK,
561                  bool         working           = true);
562
563     ~lon_label();
564
565     lon_label( const lon_label & image);
566     lon_label & operator = (const lon_label & rhs );
567     virtual void draw( void );       // Required method in base class
568 };
569
570 typedef lon_label * pLonlabel;
571
572 //
573 // instr_scale           This class is an abstract base class for both moving
574 //                       scale and moving needle (fixed scale) indicators. It
575 // does not draw itself, but is not instanciable.
576 //
577
578 class instr_scale : public instr_item {
579   private:
580     float range_shown;   // Width Units.
581     float Maximum_value; //                ceiling.
582     float Minimum_value; // Representation floor.
583     float scale_factor;  // factor => screen units/range values.
584     UINT   Maj_div;       // major division marker units
585     UINT   Min_div;       // minor division marker units
586     UINT   Modulo;        // Roll over point
587     int    signif_digits; // digits to show to the right.
588
589   public:
590     instr_scale( int          x,
591                  int          y,
592                  UINT         width,
593                  UINT         height,
594                  FLTFNPTR     load_fn,
595                  UINT         options,
596                  float       show_range,
597                  float       max_value    = 100.0,
598                  float       min_value    =   0.0,
599                  float       disp_scaling =   1.0,
600                  UINT         major_divs   =    10,
601                  UINT         minor_divs   =     5,
602                  UINT         rollover     =     0,
603                  int          dp_showing   =     2,
604                  bool         working      =  true);
605
606     virtual ~instr_scale();
607     instr_scale( const instr_scale & image);
608     instr_scale & operator = (const instr_scale & rhs);
609
610     virtual void draw   ( void ) {}; // No-op here. Defined in derived classes.
611     UINT   div_min      ( void ) { return Min_div;}
612     UINT   div_max      ( void ) { return Maj_div;}
613     float min_val      ( void ) { return Minimum_value;}
614     float max_val      ( void ) { return Maximum_value;}
615     UINT   modulo       ( void ) { return Modulo; }
616     float factor       ( void ) { return scale_factor;}
617     float range_to_show( void ) { return range_shown;}
618 };
619
620 // hud_card_               This class displays the indicated quantity on
621 //                         a scale that moves past the pointer. It may be
622 // horizontal or vertical, read above(left) or below(right) of the base
623 // line.
624
625 class hud_card : public instr_scale {
626   private:
627     float val_span;
628     float half_width_units;
629     
630   public:
631     hud_card( int      x,
632               int      y,
633               UINT     width,
634               UINT     height,
635               FLTFNPTR load_fn,
636               UINT     options,
637               float   maxValue      = 100.0,
638               float   minValue      =   0.0,
639               float   disp_scaling  =   1.0,
640               UINT     major_divs    =  10,
641               UINT     minor_divs    =   5,
642               UINT     modulator     = 100,
643               int      dp_showing    =   2,
644               float   value_span    = 100.0,
645               bool     working       = true);
646
647     ~hud_card();
648     hud_card( const hud_card & image);
649     hud_card & operator = (const hud_card & rhs );
650 //    virtual void display_enable( bool setting );
651     virtual void draw( void );       // Required method in base class
652 };
653
654 typedef hud_card * pCardScale;
655
656 class guage_instr : public instr_scale {
657   public:
658     guage_instr( int       x,
659                  int       y,
660                  UINT      width,
661                  UINT      height,
662                  FLTFNPTR  load_fn,
663                  UINT      options,
664                  float    disp_scaling = 1.0,
665                  float    maxValue     = 100,
666                  float    minValue     =   0,
667                  UINT      major_divs   =  50,
668                  UINT      minor_divs   =   0,
669                  int       dp_showing   =   2,
670                  UINT      modulus      =   0,
671                  bool      working      = true);
672
673     ~guage_instr();
674     guage_instr( const guage_instr & image);
675     guage_instr & operator = (const guage_instr & rhs );
676     virtual void draw( void );       // Required method in base class
677 };
678
679 typedef guage_instr * pGuageInst;
680 //
681 // dual_instr_item         This class was created to form the base class
682 //                         for both panel and HUD Turn Bank Indicators.
683
684 class dual_instr_item : public instr_item {
685   private:
686     FLTFNPTR alt_data_source;
687
688   public:
689     dual_instr_item ( int       x,
690                       int       y,
691                       UINT      width,
692                       UINT      height,
693                       FLTFNPTR  chn1_source,
694                       FLTFNPTR  chn2_source,
695                       bool      working     = true,
696                       UINT      options  = HUDS_TOP);
697
698     virtual ~dual_instr_item() {};
699     dual_instr_item( const dual_instr_item & image);
700     dual_instr_item & operator = (const dual_instr_item & rhs );
701
702     float current_ch1( void ) { return (float)alt_data_source();}
703     float current_ch2( void ) { return (float)get_value();}
704     virtual void draw ( void ) { }
705 };
706
707 class fgTBI_instr : public dual_instr_item {
708   private:
709     UINT BankLimit;
710     UINT SlewLimit;
711     UINT scr_hole;
712
713   public:
714     fgTBI_instr( int       x,
715                  int       y,
716                  UINT      width,
717                  UINT      height,
718                  FLTFNPTR  chn1_source  = get_roll,
719                  FLTFNPTR  chn2_source  = get_sideslip,
720                  float    maxBankAngle = 45.0,
721                  float    maxSlipAngle =  5.0,
722                  UINT      gap_width    =  5,
723                  bool      working      =  true);
724
725     fgTBI_instr( const fgTBI_instr & image);
726     fgTBI_instr & operator = (const fgTBI_instr & rhs );
727
728     ~fgTBI_instr();
729
730     UINT bank_limit( void ) { return BankLimit;}
731     UINT slew_limit( void ) { return SlewLimit;}
732
733     virtual void draw( void );       // Required method in base class
734 };
735
736 typedef fgTBI_instr * pTBI;
737
738 class HudLadder : public dual_instr_item {
739   private:
740     UINT   width_units;
741     int    div_units;
742     UINT   minor_div;
743     UINT   label_pos;
744     UINT   scr_hole;
745     UINT   minimal;
746     float vmax;
747     float vmin;
748     float factor;
749
750     fgTextList         TextList;
751     fgLineList         LineList;
752     fgLineList         StippleLineList;
753
754   public:
755     HudLadder( int       x,
756                int       y,
757                UINT      width,
758                UINT      height,
759                UINT      minimal        =    0,
760                FLTFNPTR  ptch_source    = get_roll,
761                FLTFNPTR  roll_source    = get_pitch,
762                float     span_units     = 45.0,
763                float     division_units = 10.0,
764                float     minor_division =  0.0,
765                UINT      screen_hole    =   70,
766                UINT      lbl_pos        =    0,
767                bool      working        = true );
768
769     ~HudLadder();
770
771     HudLadder( const HudLadder & image );
772     HudLadder & operator = ( const HudLadder & rhs );
773     virtual void draw( void );
774     
775     void Text( float x, float y, char *s)
776     {
777         TextList.add( fgText( x, y, s) );
778     }
779
780     void Line( float x1, float y1, float x2, float y2)
781     {
782         LineList.add(fgLineSeg2D(x1,y1,x2,y2));
783     }
784
785     void StippleLine( float x1, float y1, float x2, float y2)
786     {
787         StippleLineList.add(fgLineSeg2D(x1,y1,x2,y2));
788     }
789 };
790
791
792 //using namespace std;
793 //deque <instr_item>  * Hdeque_ptr;
794
795 extern void HUD_brightkey( bool incr_bright );
796 extern int  fgHUDInit( fgAIRCRAFT * /* current_aircraft */ );
797 extern int  fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ );
798 extern void fgUpdateHUD( void );
799
800 extern void drawOneLine ( UINT x1, UINT y1, UINT x2, UINT y2);
801 extern void drawOneLine ( RECT &rect);
802 extern void textString  ( int x,
803                           int y,
804                           char *msg,
805                           void *font = GLUT_BITMAP_8_BY_13);
806 extern void strokeString( int x,
807                           int y,
808                           char *msg,
809                           void *font = GLUT_STROKE_ROMAN,
810                           float theta = 0);
811 //extern void strokeString(float xx,
812 //                       float yy,
813 //                       char *msg,
814 //                       void *font = GLUT_STROKE_ROMAN)
815
816 /*
817 bool AddHUDInstrument( instr_item *pBlackBox );
818 void DrawHUD ( void );
819 bool DamageInstrument( INSTR_HANDLE unit );
820 bool RepairInstrument( INSTR_HANDLE unit );
821
822
823 void fgUpdateHUD ( Hptr hud );
824 void fgUpdateHUD2( Hptr hud ); // Future use?
825 void fgHUDSetTimeMode( Hptr hud, int time_of_day );
826 */
827
828 #endif // _HUD_H