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