]> git.mxchange.org Git - flightgear.git/blob - src/Cockpit/hud.hxx
Yank out all the glut dependencies and concentrate them in a (easily
[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 #include <simgear/compiler.h>
32
33 #ifdef HAVE_CONFIG_H
34 #  include <config.h>
35 #endif
36
37 #ifdef HAVE_WINDOWS_H
38 #  include <windows.h>
39 #endif
40
41 #include <stdlib.h>
42 #include <string.h>
43
44 //#ifdef HAVE_VALUES_H
45 //#  include <values.h>  // for MAXINT
46 //#endif
47
48 #include <algorithm>    // for_each()
49 #include <vector>       // STL vector
50 #include <deque>        // STL double ended queue
51 #include STL_FSTREAM
52
53 #include <simgear/constants.h>
54
55 #include <Include/fg_typedefs.h>
56 #include <Aircraft/aircraft.hxx>
57 #include <FDM/flight.hxx>
58 #include <Controls/controls.hxx>
59 #include <GUI/gui.h>
60 #include <Main/globals.hxx>
61 #include <Main/viewmgr.hxx>
62
63 #include "hud_opts.hxx"
64
65 SG_USING_STD(deque);
66 SG_USING_STD(vector);
67 SG_USING_NAMESPACE(std);
68
69
70 // some of Norman's crazy optimizations. :-)
71
72 #ifndef WIN32
73 typedef struct {
74     int x, y;
75 } POINT;
76  
77 typedef struct {
78     int top, bottom, left, right;
79 } RECT;
80 #endif
81
82 // View mode definitions
83
84 enum VIEW_MODES{ HUD_VIEW, PANEL_VIEW, CHASE_VIEW, TOWER_VIEW };
85
86 // DAY, NIGHT and brightness levels need to be visible where dialogs and
87 // controls can be used to set intensity and appropriate color. This will
88 // be moved.
89 // Hud general constants
90 #define HUD_DAY                1
91 #define HUD_NIGHT              2
92 #define HUD_BRT_BLACK          3
93 #define HUD_BRT_DARK           4
94 #define HUD_BRT_MEDIUM         5
95 #define HUD_BRT_LIGHT          6
96
97 // Label constants
98 #define HUD_FONT_SMALL     1
99 #define HUD_FONT_LARGE     2
100
101 enum fgLabelJust{ LEFT_JUST, CENTER_JUST, RIGHT_JUST } ;
102
103 #define HUDS_AUTOTICKS           0x0001
104 #define HUDS_VERT                0x0002
105 #define HUDS_HORZ                0x0000
106 #define HUDS_TOP                 0x0004
107 #define HUDS_BOTTOM              0x0008
108 #define HUDS_LEFT     HUDS_TOP
109 #define HUDS_RIGHT    HUDS_BOTTOM
110 #define HUDS_BOTH     (HUDS_LEFT | HUDS_RIGHT)
111 #define HUDS_NOTICKS             0x0010
112 #define HUDS_ARITHTIC            0x0020
113 #define HUDS_DECITICS            0x0040
114 #define HUDS_NOTEXT              0x0080
115
116 // Ladder orientaion
117 // #define HUD_VERTICAL        1
118 // #define HUD_HORIZONTAL       2
119 // #define HUD_FREEFLOAT        3
120
121 // Ladder orientation modes
122 // #define HUD_LEFT         1
123 // #define HUD_RIGHT            2
124 // #define HUD_TOP              1
125 // #define HUD_BOTTOM           2
126 // #define HUD_V_LEFT           1
127 // #define HUD_V_RIGHT          2
128 // #define HUD_H_TOP            1
129 // #define HUD_H_BOTTOM         2
130
131
132 // Ladder sub-types
133 // #define HUD_LIM              1
134 // #define HUD_NOLIM            2
135 // #define HUD_CIRC         3
136
137 // #define HUD_INSTR_LADDER 1
138 // #define HUD_INSTR_CLADDER    2
139 // #define HUD_INSTR_HORIZON    3
140 // #define HUD_INSTR_LABEL      4
141
142 // in cockpit.cxx
143 extern float get_throttleval ( void );
144 extern float get_aileronval  ( void );
145 extern float get_elevatorval ( void );
146 extern float get_elev_trimval( void );
147 extern float get_rudderval   ( void );
148 extern float get_speed       ( void );
149 extern float get_aoa         ( void );
150 extern float get_nlf         ( void );
151 extern float get_roll        ( void );
152 extern float get_pitch       ( void );
153 extern float get_heading     ( void );
154 extern float get_view_direction( void );
155 extern float get_altitude    ( void );
156 extern float get_agl         ( void );
157 extern float get_sideslip    ( void );
158 extern float get_frame_rate  ( void );
159 extern float get_latitude    ( void );
160 extern float get_lat_min     ( void );
161 extern float get_longitude   ( void );
162 extern float get_long_min    ( void );
163 extern float get_fov         ( void );
164 extern float get_vfc_ratio   ( void );
165 extern float get_vfc_tris_drawn   ( void );
166 extern float get_vfc_tris_culled   ( void );
167 extern float get_climb_rate  ( void );
168 extern float get_mach( void );
169 extern char *coord_format_lat(float);
170 extern char *coord_format_lon(float);
171 //extern char *coord_format_latlon(float latitude, float longitude);  // cockpit.cxx
172
173 // $$$ begin - added, VS Renganathan, 13 Oct 2K
174 // #define FIGHTER_HUD
175 extern float get_anzg (void);
176 extern float get_Vx (void);
177 extern float get_Vy (void);
178 extern float get_Vz (void);
179 extern float get_Ax (void);
180 extern float get_Ay (void);
181 extern float get_Az (void);
182 extern int get_iaux1 (void);
183 extern int get_iaux2 (void);
184 extern int get_iaux3 (void);
185 extern int get_iaux4 (void);
186 extern int get_iaux5 (void);
187 extern int get_iaux6 (void);
188 extern int get_iaux7 (void);
189 extern int get_iaux8 (void);
190 extern int get_iaux9 (void);
191 extern int get_iaux10 (void);
192 extern int get_iaux11 (void);
193 extern int get_iaux12 (void);
194 extern float get_aux1(void);
195 extern float get_aux2(void);
196 extern float get_aux3(void);
197 extern float get_aux4(void);
198 extern float get_aux5 (void);
199 extern float get_aux6 (void);
200 extern float get_aux7 (void);
201 extern float get_aux8(void);
202 extern float get_aux9(void);
203 extern float get_aux10(void);
204 extern float get_aux11(void);
205 extern float get_aux12(void);
206 extern float get_aux13(void);
207 extern float get_aux14(void);
208 extern float get_aux15(void);
209 extern float get_aux16(void);
210 extern float get_aux17(void);
211 extern float get_aux18(void);
212 // $$$ end - added, VS Renganathan, 13 Oct 2K
213
214 extern char *get_formated_gmt_time( void );
215 extern void fgHUDReshape(void);
216
217 enum  hudinstype{ HUDno_instr,
218                   HUDscale,
219                   HUDlabel,
220                   HUDladder,
221                   HUDcirc_ladder,
222                   HUDhorizon,
223                   HUDgauge,
224                   HUDdual_inst,
225                   HUDmoving_scale,
226                   HUDtbi
227 };
228
229 typedef struct gltagRGBTRIPLE { // rgbt
230     GLfloat Blue;
231     GLfloat Green;
232     GLfloat Red;
233 } glRGBTRIPLE;
234
235 class fgLineSeg2D {
236 private:
237     GLfloat x0, y0, x1, y1;
238
239 public:
240     fgLineSeg2D( GLfloat a = 0, GLfloat b =0, GLfloat c = 0, GLfloat d =0 )
241         : x0(a), y0(b),  x1(c), y1(d) {}
242
243     fgLineSeg2D( const fgLineSeg2D & image )
244         : x0(image.x0), y0(image.y0), x1(image.x1), y1(image.y1) {}
245
246     fgLineSeg2D& operator= ( const fgLineSeg2D & image ) {
247         x0 = image.x0; y0 = image.y0; x1 = image.x1; y1 = image.y1; return *this;
248     }
249
250     ~fgLineSeg2D() {}
251     
252     void draw()
253     {
254         glVertex2f(x0, y0);
255         glVertex2f(x1, y1);
256     }
257 };
258
259 class DrawLineSeg2D {
260     public:
261         void operator() (fgLineSeg2D elem) const {
262             elem.draw();
263         }
264 };
265
266
267 #define USE_HUD_TextList
268 extern float              HUD_TextSize;
269 extern fntRenderer       *HUDtext;
270 extern float HUD_matrix[16];
271
272 class fgText {
273 private:
274     float x, y;
275     char msg[64];
276 public:
277     int digit; //suma
278     fgText(float x = 0, float y = 0, char *c = NULL,int digits=0): x(x), y(y) //suma
279     { 
280         strcpy(msg,c);
281         digit=digits; //suma
282     }
283                    
284     fgText( const fgText & image )
285         : x(image.x), y(image.y),digit(image.digit) {strcpy(msg,image.msg);} //suma
286
287     fgText& operator = ( const fgText & image ) {
288         strcpy(msg,image.msg); x = image.x; y = image.y;digit=image.digit; //suma
289         return *this;   
290     }
291
292     ~fgText() {msg[0]='\0';}
293
294     int getStringWidth ( char *str )
295     {
296         if ( HUDtext && str ) {
297             float r, l ;
298             guiFntHandle->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
299             return FloatToInt( r - l );
300         }
301         return 0 ;
302     }
303     
304     int StringWidth (void )
305     {
306         if ( HUDtext && strlen( msg )) {
307             float r, l ;
308             guiFntHandle->getBBox ( msg, HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
309             return FloatToInt( r - l );
310         }
311         return 0 ;
312     }
313    
314     // this code is changed to display Numbers with big/small digits
315     // according to MIL Standards for example Altitude above 10000 ft
316     // is shown as 10ooo.  begin suma
317
318     void Draw(fntRenderer *fnt,int digits) {
319         if(digits==1) {
320             int c=0,i=0;
321             char *t=msg;
322             int p=4;
323
324             if(t[0]=='-') {
325                 //if negative value then increase the c and p values
326                 //for '-' sign.  c++;
327                 p++;
328             }
329             char *tmp=msg;
330             while(tmp[i]!='\0') {
331                 if((tmp[i]>='0') && (tmp[i]<='9'))  
332                     c++;
333                 i++;
334             }
335             if(c>p) {
336                 fnt->setPointSize(8);
337                 int p1=c-3;
338                 char *tmp1=msg+p1;
339                 int p2=p1*8;
340                           
341                 fnt->start2f(x+p2,y);
342                 fnt->puts(tmp1);
343
344                 fnt->setPointSize(12);
345                 char tmp2[64];
346                 strncpy(tmp2,msg,p1);
347                 tmp2[p1]='\0';
348                          
349                 fnt->start2f(x,y);
350                 fnt->puts(tmp2);
351             } else {
352                 fnt->setPointSize(12);                                  
353                 fnt->start2f( x, y );
354                 fnt->puts(tmp);
355             }
356         } else {
357             //if digits not equal to 1
358             fnt->setPointSize(8);         
359             fnt->start2f( x, y );
360             fnt->puts( msg ) ;
361         }
362     }
363     //end suma
364
365     void Draw()
366     {
367         guiFnt.drawString( msg, FloatToInt(x), FloatToInt(y) );
368     }
369 };
370
371 class fgLineList {
372     vector < fgLineSeg2D > List;
373 public:
374     fgLineList( void ) {}
375     ~fgLineList( void ) {}
376     void add( fgLineSeg2D seg ) { List.push_back(seg); }
377     void erase( void ) { List.erase( List.begin(), List.end() ); }
378     void draw( void ) {
379         glBegin(GL_LINES);
380         for_each( List.begin(), List.end(), DrawLineSeg2D());
381         glEnd();
382     }
383 };
384
385 class fgTextList {
386     fntRenderer *Font;
387     vector< fgText > List;
388 public:
389     fgTextList ( void ) { Font = 0; }
390     ~fgTextList( void ) {}
391     
392     void setFont( fntRenderer *Renderer ) { Font = Renderer; }
393     void add( fgText String ) { List.push_back(String); }
394     void erase( void ) { List.erase( List.begin(), List.end() ); }
395     
396     void draw( void ) {
397         if( Font == 0 )
398             return;
399         vector < fgText > :: iterator curString = List.begin();
400         vector < fgText > :: iterator lastString = List.end();
401
402         glPushAttrib( GL_COLOR_BUFFER_BIT );
403         glEnable    ( GL_ALPHA_TEST   ) ;
404         glEnable    ( GL_BLEND        ) ;
405         glAlphaFunc ( GL_GREATER, 0.1 ) ;
406         glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ;
407
408         Font->begin();
409         for( ; curString != lastString; curString++ ) {
410             curString->Draw(Font,curString->digit); //suma
411         }
412         Font->end();
413
414         glDisable ( GL_TEXTURE_2D ) ;
415         glPopAttrib();
416     }
417 };
418
419
420 inline void Text( fgTextList &List, float x, float y, char *s)
421 {
422     List.add( fgText( x, y, s) );
423 }
424
425 inline void Text( fgTextList &List, fgText &me)
426 {
427     List.add(me);
428 }
429
430 inline void Line( fgLineList &List, float x1, float y1, float x2, float y2)
431 {
432     List.add(fgLineSeg2D(x1,y1,x2,y2));
433 }
434
435
436 // Declare our externals
437 extern fgTextList         HUD_TextList;
438 extern fgLineList         HUD_LineList;
439 extern fgLineList         HUD_StippleLineList;
440
441
442 class instr_item {  // An Abstract Base Class (ABC)
443 private:
444     static UINT        instances;     // More than 64K instruments? Nah!
445     static int         brightness;
446     static glRGBTRIPLE color;
447
448     UINT               handle;
449     RECT               scrn_pos;      // Framing - affects scale dimensions
450                                       // and orientation. Vert vs Horz, etc.
451     FLTFNPTR           load_value_fn;
452     float              disp_factor;   // Multiply by to get numbers shown on scale.
453     UINT               opts;
454     bool               is_enabled;
455     bool               broken;
456     UINT               scr_span;      // Working values for draw;
457     POINT              mid_span;      //
458     int                digits;        //suma
459   
460 public:
461     instr_item( int            x,
462                 int            y,
463                 UINT           height,
464                 UINT           width,
465                 FLTFNPTR       data_source,
466                 float          data_scaling,
467                 UINT           options,
468                 bool           working  = true,
469                 int            digit = 0); //suma
470
471     instr_item( const instr_item & image );
472
473     instr_item & operator = ( const instr_item & rhs );
474     virtual ~instr_item ();
475
476     int     get_brightness  ( void ) { return brightness;}
477     RECT    get_location    ( void ) { return scrn_pos;  }
478     bool    is_broken       ( void ) { return broken;    }
479     bool    enabled         ( void ) { return is_enabled;}
480     bool    data_available  ( void ) { return !!load_value_fn; }
481     float   get_value       ( void ) { return load_value_fn(); }
482     float   data_scaling    ( void ) { return disp_factor; }
483     UINT    get_span        ( void ) { return scr_span;  }
484     POINT   get_centroid    ( void ) { return mid_span;  }
485     UINT    get_options     ( void ) { return opts;      }
486     int     get_digits      ( void ) { return digits;    } //suma
487
488     UINT    huds_vert     (UINT options) { return( options  & HUDS_VERT ); }
489     UINT    huds_left     (UINT options) { return( options  & HUDS_LEFT ); }
490     UINT    huds_right    (UINT options) { return( options  & HUDS_RIGHT ); }
491     UINT    huds_both     (UINT options) {
492         return( (options & HUDS_BOTH) == HUDS_BOTH );
493     }
494     UINT    huds_noticks  (UINT options) { return( options  & HUDS_NOTICKS ); }
495     UINT    huds_notext   (UINT options) { return( options  & HUDS_NOTEXT ); }
496     UINT    huds_top      (UINT options) { return( options  & HUDS_TOP ); }
497     UINT    huds_bottom   (UINT options) { return( options  & HUDS_BOTTOM ); }
498   
499     virtual void display_enable( bool working ) { is_enabled = !! working;}
500
501     virtual void update( void );
502     virtual void break_display ( bool bad );
503     virtual void SetBrightness( int illumination_level ); // fgHUDSetBright...
504     void         SetPosition  ( int x, int y, UINT width, UINT height );
505     UINT         get_Handle( void );
506     virtual void draw( void ) = 0;   // Required method in derived classes
507     
508     void drawOneLine( float x1, float y1, float x2, float y2)
509     {
510         HUD_LineList.add(fgLineSeg2D(x1,y1,x2,y2));
511     }
512     void drawOneStippleLine( float x1, float y1, float x2, float y2)
513     {
514         HUD_StippleLineList.add(fgLineSeg2D(x1,y1,x2,y2));
515     }
516     void TextString( char *msg, float x, float y,int digit ) //suma
517     {
518         HUD_TextList.add(fgText(x, y, msg,digit)); //suma  
519     }
520     int getStringWidth ( char *str )
521     {
522         if ( HUDtext && str ) {
523             float r, l ;
524             guiFntHandle->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
525             return FloatToInt( r - l );
526         }
527         return 0 ;
528     }
529
530     //code to draw ticks as small circles
531     void drawOneCircle(float x1, float y1, float r)
532     {
533         glBegin(GL_LINE_LOOP);  // Use polygon to approximate a circle 
534         for(int count=0; count<25; count++) {             
535             float cosine = r * cos(count * 2 * SG_PI/10.0); 
536             float sine =   r * sin(count * 2 * SG_PI/10.0); 
537             glVertex2f(cosine+x1, sine+y1);
538         }     
539         glEnd(); 
540     }
541     
542 };
543
544 typedef instr_item *HIptr;
545
546 class HUDdraw {
547     public:
548         void operator() (HIptr elem) const {
549             if( elem->enabled())
550                 elem->draw();
551         }
552 };
553
554 //typedef deque <  instr_item * > hud_deque_type;
555 //typedef hud_deque_type::iterator hud_deque_iterator;
556 //typedef hud_deque_type::const_iterator hud_deque_const_iterator;
557
558 extern deque< instr_item *> HUD_deque;
559 extern int HUD_style;
560 //extern hud_deque_type HUD_deque;
561
562 // instr_item           This class has no other purpose than to maintain
563 //                      a linked list of instrument and derived class
564 // object pointers.
565
566
567 class instr_label : public instr_item {
568 private:
569     const char *pformat;
570     const char *pre_str;
571     const char *post_str;
572     fgLabelJust justify;
573     int         fontSize;
574     int         blink;
575     char format_buffer[80];
576     bool                lat;
577     bool                lon;
578     bool                lbox;
579
580 public:
581     instr_label( int          x,
582                  int          y,
583                  UINT         width,
584                  UINT         height,
585                  FLTFNPTR     data_source,
586                  const char  *label_format,
587                  const char  *pre_label_string,
588                  const char  *post_label_string,
589                  float        scale_data,
590                  UINT         options,
591                  fgLabelJust  justification,
592                  int          font_size,
593                  int          blinking,
594                  bool             latitude,
595                  bool             longitude,
596                  bool             label_box,
597                  bool         working,
598                  int          digit ); //suma);
599
600     ~instr_label();
601
602     instr_label( const instr_label & image);
603     instr_label & operator = (const instr_label & rhs );
604     virtual void draw( void );       // Required method in base class
605 };
606
607 typedef instr_label * pInstlabel;
608
609
610 class lat_label : public instr_item {
611 private:
612     const char *pformat;
613     const char *pre_str;
614     const char *post_str;
615     fgLabelJust justify;
616     int         fontSize;
617     int         blink;
618     char format_buffer[80];
619
620 public:
621     lat_label( int          x,
622                int          y,
623                UINT         width,
624                UINT         height,
625                FLTFNPTR     data_source,
626                const char  *label_format,
627                const char  *pre_label_string,
628                const char  *post_label_string,
629                float       scale_data,
630                UINT         options,
631                fgLabelJust  justification,
632                int          font_size,
633                int          blinking,
634                bool         working,
635                int          digits =0 );//suma
636
637     ~lat_label();
638
639     lat_label( const lat_label & image);
640     lat_label & operator = (const lat_label & rhs );
641     virtual void draw( void );       // Required method in base class
642 };
643
644 typedef lat_label * pLatlabel;
645
646 class lon_label : public instr_item {
647 private:
648     const char *pformat;
649     const char *pre_str;
650     const char *post_str;
651     fgLabelJust justify;
652     int         fontSize;
653     int         blink;
654     char format_buffer[80];
655
656 public:
657     lon_label( int          x,
658                int          y,
659                UINT         width,
660                UINT         height,
661                FLTFNPTR     data_source,
662                const char  *label_format,
663                const char  *pre_label_string,
664                const char  *post_label_string,
665                float       scale_data,
666                UINT         options,
667                fgLabelJust  justification,
668                int          font_size,
669                int          blinking,
670                bool         working,
671                int          digit=0); //suma
672
673
674     ~lon_label();
675
676     lon_label( const lon_label & image);
677     lon_label & operator = (const lon_label & rhs );
678     virtual void draw( void );       // Required method in base class
679 };
680
681 typedef lon_label * pLonlabel;
682
683 //
684 // instr_scale           This class is an abstract base class for both moving
685 //                       scale and moving needle (fixed scale) indicators. It
686 // does not draw itself, but is not instanciable.
687 //
688
689 class instr_scale : public instr_item {
690 private:
691     float range_shown;   // Width Units.
692     float Maximum_value; //                ceiling.
693     float Minimum_value; // Representation floor.
694     float scale_factor;  // factor => screen units/range values.
695     UINT   Maj_div;       // major division marker units
696     UINT   Min_div;       // minor division marker units
697     UINT   Modulo;        // Roll over point
698     int    signif_digits; // digits to show to the right.
699
700 public:
701     instr_scale( int          x,
702                  int          y,
703                  UINT         width,
704                  UINT         height,
705                  FLTFNPTR     load_fn,
706                  UINT         options,
707                  float       show_range,
708                  float       max_value,
709                  float       min_value,
710                  float       disp_scaling,
711                  UINT         major_divs,
712                  UINT         minor_divs,
713                  UINT         rollover,
714                  int          dp_showing,
715                  bool         working = true);
716
717     virtual ~instr_scale();
718     instr_scale( const instr_scale & image);
719     instr_scale & operator = (const instr_scale & rhs);
720
721     virtual void draw   ( void ) {}; // No-op here. Defined in derived classes.
722     UINT   div_min      ( void ) { return Min_div;}
723     UINT   div_max      ( void ) { return Maj_div;}
724     float min_val      ( void ) { return Minimum_value;}
725     float max_val      ( void ) { return Maximum_value;}
726     UINT   modulo       ( void ) { return Modulo; }
727     float factor       ( void ) { return scale_factor;}
728     float range_to_show( void ) { return range_shown;}
729 };
730
731 // hud_card_               This class displays the indicated quantity on
732 //                         a scale that moves past the pointer. It may be
733 // horizontal or vertical, read above(left) or below(right) of the base
734 // line.
735
736 class hud_card : public instr_scale {
737 private:
738     float val_span;
739     string type;
740     float half_width_units;
741     bool  draw_tick_bottom;
742     bool  draw_tick_top;
743     bool  draw_tick_right;
744     bool  draw_tick_left;
745     bool  draw_cap_bottom;
746     bool  draw_cap_top;
747     bool  draw_cap_right;
748     bool  draw_cap_left;
749     float marker_offset;
750     bool  pointer;
751     string  pointer_type;
752     string  tick_type;
753     string  tick_length;
754     float   radius; //suma
755     float   maxValue; //suma
756     float   minValue; //suma
757     int         divisions; //suma
758     int     zoom; //suma
759     UINT        Maj_div; //suma
760     UINT        Min_div; //suma
761         
762     
763 public:
764     hud_card( int      x,
765               int      y,
766               UINT     width,
767               UINT     height,
768               FLTFNPTR load_fn,
769               UINT     options,
770               float    maxValue,
771               float    minValue,
772               float    disp_scaling,
773               UINT     major_divs,
774               UINT     minor_divs,
775               UINT     modulator,
776               int      dp_showing,
777               float    value_span,
778               string   type,
779               bool     draw_tick_bottom,
780               bool     draw_tick_top,
781               bool     draw_tick_right,
782               bool     draw_tick_left,
783               bool     draw_cap_bottom,
784               bool     draw_cap_top,
785               bool     draw_cap_right,
786               bool     draw_cap_left,
787               float    marker_offset,
788               bool     pointer,
789               string   pointer_type,
790               string  tick_type,
791               string  tick_length,
792               bool     working,
793               float    radius, //suma
794               int      divisions, //suma
795               int       zoom //suma
796             );
797
798
799     ~hud_card();
800     hud_card( const hud_card & image);
801     hud_card & operator = (const hud_card & rhs );
802     //    virtual void display_enable( bool setting );
803     virtual void draw( void );       // Required method in base class
804     void circles(float,float,float); // suma
805     void fixed(float,float,float,float,float,float); //suma
806     void zoomed_scale(int,int); //suma
807 };
808
809 typedef hud_card * pCardScale;
810
811 class gauge_instr : public instr_scale {
812 public:
813     gauge_instr( int       x,
814                  int       y,
815                  UINT      width,
816                  UINT      height,
817                  FLTFNPTR  load_fn,
818                  UINT      options,
819                  float     disp_scaling,
820                  float     maxValue,
821                  float     minValue,
822                  UINT      major_divs,
823                  UINT      minor_divs,
824                  int       dp_showing,
825                  UINT      modulus,
826                  bool      working);
827
828     ~gauge_instr();
829     gauge_instr( const gauge_instr & image);
830     gauge_instr & operator = (const gauge_instr & rhs );
831     virtual void draw( void );       // Required method in base class
832 };
833
834 typedef gauge_instr * pGaugeInst;
835 //
836 // dual_instr_item         This class was created to form the base class
837 //                         for both panel and HUD Turn Bank Indicators.
838
839 class dual_instr_item : public instr_item {
840 private:
841     FLTFNPTR alt_data_source;
842
843 public:
844     dual_instr_item ( int       x,
845                       int       y,
846                       UINT      width,
847                       UINT      height,
848                       FLTFNPTR  chn1_source,
849                       FLTFNPTR  chn2_source,
850                       bool      working,
851                       UINT      options );
852
853     virtual ~dual_instr_item() {};
854     dual_instr_item( const dual_instr_item & image);
855     dual_instr_item & operator = (const dual_instr_item & rhs );
856
857     float current_ch1( void ) { return (float)alt_data_source();}
858     float current_ch2( void ) { return (float)get_value();}
859     virtual void draw ( void ) { }
860 };
861
862 class fgTBI_instr : public dual_instr_item 
863 {
864 private:
865     UINT BankLimit;
866     UINT SlewLimit;
867     UINT scr_hole;
868     bool tsi;  //suma
869     float rad; //suma
870
871 public:
872     fgTBI_instr( int       x,
873                  int       y,
874                  UINT      width,
875                  UINT      height,
876                  FLTFNPTR  chn1_source,
877                  FLTFNPTR  chn2_source,
878                  float    maxBankAngle,
879                  float    maxSlipAngle,
880                  UINT      gap_width,
881                  bool      working,
882                  bool      tsi, //suma
883                  float     rad); //suma
884
885     fgTBI_instr( const fgTBI_instr & image);
886     fgTBI_instr & operator = (const fgTBI_instr & rhs );
887
888     ~fgTBI_instr();
889
890     UINT bank_limit( void ) { return BankLimit;}
891     UINT slew_limit( void ) { return SlewLimit;}
892
893     virtual void draw( void );       // Required method in base class
894 };
895
896 typedef fgTBI_instr * pTBI;
897
898 class HudLadder : public dual_instr_item {
899 private:
900     UINT   width_units;
901     int    div_units;
902     UINT   minor_div;
903     UINT   label_pos;
904     UINT   scr_hole;
905     float  vmax;
906     float  vmin;
907     float  factor;
908     string hudladder_type;
909     bool   frl;
910     bool   target_spot;
911     bool   velocity_vector;
912     bool   drift_marker;
913     bool   alpha_bracket;
914     bool        energy_marker;
915     bool        climb_dive_marker;
916     bool        glide_slope_marker;
917     float       glide_slope;
918     bool        energy_worm;
919     bool        waypoint_marker;
920     int     zenith; //suma
921     int     nadir; //suma
922     int         hat; //suma
923     
924
925     // The Ladder has it's own temporary display lists
926     fgTextList         TextList;
927     fgLineList         LineList;
928     fgLineList         StippleLineList;
929
930 public:
931     HudLadder( string    name,
932                int       x,
933                int       y,
934                UINT      width,
935                UINT      height,
936                float     factor,
937                FLTFNPTR  ptch_source,
938                FLTFNPTR  roll_source,
939                float     span_units,
940                float     division_units,
941                float     minor_division,
942                UINT      screen_hole,
943                UINT      lbl_pos,
944                bool      frl,
945                bool      target_spot,
946                bool     velocity_vector,
947                bool     drift_marker,
948                bool     alpha_bracket,
949                bool      energy_marker,
950                bool      climb_dive_marker,
951                bool      glide_slope_marker,
952                float     glide_slope,
953                bool      energy_worm,
954                bool      waypoint_marker,
955                bool  working,
956                int   zenith, //suma
957                int   nadir, //suma
958                int      hat
959              ); //suma
960
961
962     ~HudLadder();
963
964     HudLadder( const HudLadder & image );
965     HudLadder & operator = ( const HudLadder & rhs );
966     virtual void draw( void );
967     void drawZenith(float,float,float); //suma
968     void drawNadir(float, float, float); //suma
969
970     void Text( float x, float y, char *s)
971     {
972         TextList.add( fgText( x, y, s) );
973     }
974
975     void Line( float x1, float y1, float x2, float y2)
976     {
977         LineList.add(fgLineSeg2D(x1,y1,x2,y2));
978     }
979
980     void StippleLine( float x1, float y1, float x2, float y2)
981     {
982         StippleLineList.add(fgLineSeg2D(x1,y1,x2,y2));
983     }
984 };
985
986
987 //using namespace std;
988 //deque <instr_item>  * Hdeque_ptr;
989
990 extern void HUD_masterswitch( bool incr );
991 extern void HUD_brightkey( bool incr_bright );
992 extern int  fgHUDInit( fgAIRCRAFT * /* current_aircraft */ );
993 extern int  fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ );
994 extern void fgUpdateHUD( void );
995 extern void fgUpdateHUD( GLfloat x_start, GLfloat y_start,
996                          GLfloat x_end, GLfloat y_end );
997
998 /*
999 bool AddHUDInstrument( instr_item *pBlackBox );
1000 void DrawHUD ( void );
1001 bool DamageInstrument( INSTR_HANDLE unit );
1002 bool RepairInstrument( INSTR_HANDLE unit );
1003
1004
1005 void fgUpdateHUD ( Hptr hud );
1006 void fgUpdateHUD2( Hptr hud ); // Future use?
1007 void fgHUDSetTimeMode( Hptr hud, int time_of_day );
1008 */
1009
1010 #endif // _HUD_H