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