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