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