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