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