]> git.mxchange.org Git - flightgear.git/blob - src/Cockpit/hud.hxx
make --enable-osgviewer the default
[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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 //
21 // $Id$
22
23
24 #ifndef _OLDHUD_HXX
25 #define _OLDHUD_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 #ifdef __CYGWIN__
42 #include <ieeefp.h>
43 #endif
44
45 #include <stdlib.h>
46 #include <string.h>
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 <osg/State>
54
55 #include <simgear/math/SGMath.hxx>
56 #include <simgear/constants.h>
57
58 #include <Include/fg_typedefs.h>
59 #include <Aircraft/aircraft.hxx>
60 #include <Aircraft/controls.hxx>
61 #include <FDM/flight.hxx>
62 #include <GUI/gui.h>
63 #include <Main/fg_props.hxx>
64 #include <Main/globals.hxx>
65 #include <Main/viewmgr.hxx>
66 #include <Airports/runways.hxx>
67
68 #include <plib/sg.h>
69
70 SG_USING_STD(deque);
71 SG_USING_STD(vector);
72 SG_USING_NAMESPACE(std);
73
74 #define float_to_int(v) SGMiscf::roundToInt(v)
75
76 // some of Norman's crazy optimizations. :-)
77
78 #ifndef WIN32
79 typedef struct {
80     int x, y;
81 } POINT;
82
83 typedef struct {
84     int top, bottom, left, right;
85 } RECT;
86 #endif
87
88 // View mode definitions
89
90 enum VIEW_MODES{ HUD_VIEW, PANEL_VIEW, CHASE_VIEW, TOWER_VIEW };
91
92 // Label constants
93 #define HUD_FONT_SMALL     1
94 #define HUD_FONT_LARGE     2
95
96 enum fgLabelJust{ LEFT_JUST, CENTER_JUST, RIGHT_JUST } ;
97
98 #define HUDS_AUTOTICKS           0x0001
99 #define HUDS_VERT                0x0002
100 #define HUDS_HORZ                0x0000
101 #define HUDS_TOP                 0x0004
102 #define HUDS_BOTTOM              0x0008
103 #define HUDS_LEFT     HUDS_TOP
104 #define HUDS_RIGHT    HUDS_BOTTOM
105 #define HUDS_BOTH     (HUDS_LEFT | HUDS_RIGHT)
106 #define HUDS_NOTICKS             0x0010
107 #define HUDS_ARITHTIC            0x0020
108 #define HUDS_DECITICS            0x0040
109 #define HUDS_NOTEXT              0x0080
110
111 // in cockpit.cxx
112 extern float get_throttleval ( void );
113 extern float get_aileronval  ( void );
114 extern float get_elevatorval ( void );
115 extern float get_elev_trimval( void );
116 extern float get_rudderval   ( void );
117 extern float get_speed       ( void );
118 extern float get_aoa         ( void );
119 extern float get_nlf         ( void );
120 extern float get_roll        ( void );
121 extern float get_pitch       ( void );
122 extern float get_heading     ( void );
123 extern float get_view_direction( void );
124 extern float get_altitude    ( void );
125 extern float get_agl         ( void );
126 extern float get_sideslip    ( void );
127 extern float get_frame_rate  ( void );
128 extern float get_latitude    ( void );
129 extern float get_lat_min     ( void );
130 extern float get_longitude   ( void );
131 extern float get_long_min    ( void );
132 extern float get_fov         ( void );
133 extern float get_vfc_ratio   ( void );
134 extern float get_vfc_tris_drawn   ( void );
135 extern float get_vfc_tris_culled   ( void );
136 extern float get_climb_rate  ( void );
137 extern float get_mach( void );
138 extern char *coord_format_lat(float);
139 extern char *coord_format_lon(float);
140
141 // $$$ begin - added, VS Renganathan, 13 Oct 2K
142 extern float get_anzg (void);
143 extern float get_Vx (void);
144 extern float get_Vy (void);
145 extern float get_Vz (void);
146 extern float get_Ax (void);
147 extern float get_Ay (void);
148 extern float get_Az (void);
149 extern int get_iaux1 (void);
150 extern int get_iaux2 (void);
151 extern int get_iaux3 (void);
152 extern int get_iaux4 (void);
153 extern int get_iaux5 (void);
154 extern int get_iaux6 (void);
155 extern int get_iaux7 (void);
156 extern int get_iaux8 (void);
157 extern int get_iaux9 (void);
158 extern int get_iaux10 (void);
159 extern int get_iaux11 (void);
160 extern int get_iaux12 (void);
161 extern float get_aux1(void);
162 extern float get_aux2(void);
163 extern float get_aux3(void);
164 extern float get_aux4(void);
165 extern float get_aux5 (void);
166 extern float get_aux6 (void);
167 extern float get_aux7 (void);
168 extern float get_aux8(void);
169 extern float get_aux9(void);
170 extern float get_aux10(void);
171 extern float get_aux11(void);
172 extern float get_aux12(void);
173 extern float get_aux13(void);
174 extern float get_aux14(void);
175 extern float get_aux15(void);
176 extern float get_aux16(void);
177 extern float get_aux17(void);
178 extern float get_aux18(void);
179 // $$$ end - added, VS Renganathan, 13 Oct 2K
180
181 extern char *get_formated_gmt_time( void );
182
183 enum  hudinstype{ HUDno_instr,
184                   HUDscale,
185                   HUDlabel,
186                   HUDladder,
187                   HUDcirc_ladder,
188                   HUDhorizon,
189                   HUDgauge,
190                   HUDdual_inst,
191                   HUDmoving_scale,
192                   HUDtbi
193 };
194
195 typedef struct gltagRGBTRIPLE { // rgbt
196     GLfloat Blue;
197     GLfloat Green;
198     GLfloat Red;
199 } glRGBTRIPLE;
200
201 class fgLineSeg2D {
202 private:
203     GLfloat x0, y0, x1, y1;
204
205 public:
206     fgLineSeg2D( GLfloat a = 0, GLfloat b =0, GLfloat c = 0, GLfloat d =0 )
207         : x0(a), y0(b),  x1(c), y1(d) {}
208
209     fgLineSeg2D( const fgLineSeg2D & image )
210         : x0(image.x0), y0(image.y0), x1(image.x1), y1(image.y1) {}
211
212     fgLineSeg2D& operator= ( const fgLineSeg2D & image ) { // seems unused
213         x0 = image.x0; y0 = image.y0; x1 = image.x1; y1 = image.y1; return *this;
214     }
215
216     void draw() const
217     {
218         glVertex2f(x0, y0);
219         glVertex2f(x1, y1);
220     }
221 };
222
223 class DrawLineSeg2D {
224     public:
225         void operator() (const fgLineSeg2D& elem) const {
226             elem.draw();
227         }
228 };
229
230
231 #define USE_HUD_TextList
232 extern fntTexFont        *HUD_Font;
233 extern float              HUD_TextSize;
234 extern fntRenderer       *HUDtext;
235 extern float HUD_matrix[16];
236
237 class fgText {
238 private:
239     float x, y;
240     string msg;
241         bool digit;
242     // seems unused   
243         
244 public:
245         fgText(float x, float y, const string& c, bool digits=false): x(x), y(y), msg( c), digit( digits) {};   
246
247     fgText( const fgText & image )
248                 : x(image.x), y(image.y), msg(image.msg), digit(image.digit) { }
249
250         fgText& operator = ( const fgText & image ) {
251                 x = image.x; y = image.y; msg= image.msg; digit = image.digit;
252                 return *this;
253         }
254         
255     static int getStringWidth ( const char *str )
256     {
257         if ( HUDtext && str ) {
258             float r, l ;
259             HUD_Font->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
260             return float_to_int( r - l );
261         }
262         return 0 ;
263     }
264
265     int StringWidth ()
266     {
267         if ( HUDtext && msg != "") {
268             float r, l ;
269             HUD_Font->getBBox ( msg.c_str(), HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
270             return float_to_int( r - l );
271         }
272         return 0 ;
273     }
274
275     // this code is changed to display Numbers with big/small digits
276     // according to MIL Standards for example Altitude above 10000 ft
277     // is shown as 10ooo.
278
279     void Draw(fntRenderer *fnt) {
280         if (digit) {
281             int c=0,i=0;
282             
283             int p=4;
284
285             if (msg[0]=='-') {
286                 //if negative value then increase the c and p values
287                 //for '-' sign.  c++;
288                 p++;
289             }
290                         
291                         for (string::size_type i = 0; i < msg.size(); i++) {
292                 if ((msg[i]>='0') && (msg[i]<='9'))
293                     c++;
294             }
295             float orig_size = fnt->getPointSize();
296             if (c>p) {
297                 fnt->setPointSize(HUD_TextSize * 0.8);
298                 int p2=(c-3)*8;  //advance to the last 3 digits
299
300                 fnt->start2f(x+p2,y);
301                 fnt->puts(msg.c_str() + c - 3); // display last 3 digits
302
303                 fnt->setPointSize(HUD_TextSize * 1.2);
304               
305                 fnt->start2f(x,y);
306                                 fnt->puts(msg.substr(0,c-3).c_str());
307             } else {
308                 fnt->setPointSize(HUD_TextSize * 1.2);
309                 fnt->start2f( x, y );
310                 fnt->puts(msg.c_str());
311             }
312             fnt->setPointSize(orig_size);
313         } else {
314             //if digits not true
315             fnt->start2f( x, y );
316             fnt->puts( msg.c_str()) ;
317         }
318     }
319
320     void Draw()
321     {
322                 guiFnt.drawString( msg.c_str(), float_to_int(x), float_to_int(y) );
323     }
324 };
325
326 class fgLineList {
327     vector < fgLineSeg2D > List;
328 public:
329     fgLineList( void ) {}
330     void add( const fgLineSeg2D& seg ) { List.push_back(seg); }
331         void erase( void ) { List.clear();}
332     void draw( void ) {
333         glBegin(GL_LINES);
334         for_each( List.begin(), List.end(), DrawLineSeg2D());
335         glEnd();
336     }
337 };
338
339 class fgTextList {
340     fntRenderer *Font;
341     vector< fgText > List;
342 public:
343     fgTextList ( void ) { Font = 0; }
344
345     void setFont( fntRenderer *Renderer ) { Font = Renderer; }
346     void add( const fgText& String ) { List.push_back(String); }
347     void erase( void ) { List.clear(); }
348     void draw( void );
349 };
350
351
352 inline void Text( fgTextList &List, float x, float y, char *s)
353 {
354     List.add( fgText( x, y, s) );
355 }
356
357 inline void Text( fgTextList &List, const fgText &me)
358 {
359     List.add(me);
360 }
361
362 inline void Line( fgLineList &List, float x1, float y1, float x2, float y2)
363 {
364     List.add(fgLineSeg2D(x1,y1,x2,y2));
365 }
366
367
368 // Declare our externals
369 extern fgTextList         HUD_TextList;
370 extern fgLineList         HUD_LineList;
371 extern fgLineList         HUD_StippleLineList;
372
373
374 class instr_item : public SGReferenced {  // An Abstract Base Class (ABC)
375 private:
376     static UINT        instances;     // More than 64K instruments? Nah!
377     static int         brightness;
378     static glRGBTRIPLE color;
379
380     UINT               handle;
381     RECT               scrn_pos;      // Framing - affects scale dimensions
382                                       // and orientation. Vert vs Horz, etc.
383     FLTFNPTR           load_value_fn;
384     float              disp_factor;   // Multiply by to get numbers shown on scale.
385     UINT               opts;
386     bool               is_enabled;
387     bool               broken;
388     UINT               scr_span;      // Working values for draw;
389     POINT              mid_span;      //
390     int                digits;
391
392 public:
393     instr_item( int            x,
394                 int            y,
395                 UINT           height,
396                 UINT           width,
397                 FLTFNPTR       data_source,
398                 float          data_scaling,
399                 UINT           options,
400                 bool           working = true,
401                 int            digit = 0);
402
403     virtual ~instr_item ();
404
405     void    set_data_source ( FLTFNPTR fn ) { load_value_fn = fn; }
406     int     get_brightness  ( void ) { return brightness;}
407     RECT    get_location    ( void ) { return scrn_pos;  }
408     bool    is_broken       ( void ) { return broken;    }
409     bool    enabled         ( void ) { return is_enabled;}
410     bool    data_available  ( void ) { return !!load_value_fn; }
411     float   get_value       ( void ) { return load_value_fn(); }
412     float   data_scaling    ( void ) { return disp_factor; }
413     UINT    get_span        ( void ) { return scr_span;  }
414     POINT   get_centroid    ( void ) { return mid_span;  }
415     UINT    get_options     ( void ) { return opts;      }
416     int     get_digits      ( void ) { return digits;         }
417     inline int get_x() const { return scrn_pos.left; }
418     inline int get_y() const { return scrn_pos.top; }
419     inline int get_width() const { return scrn_pos.right; }
420     inline int get_height() const { return scrn_pos.bottom; }
421
422     UINT    huds_vert     (UINT options) { return (options & HUDS_VERT); }
423     UINT    huds_left     (UINT options) { return (options & HUDS_LEFT); }
424     UINT    huds_right    (UINT options) { return (options & HUDS_RIGHT); }
425     UINT    huds_both     (UINT options) {
426         return ((options & HUDS_BOTH) == HUDS_BOTH);
427     }
428     UINT    huds_noticks  (UINT options) { return (options & HUDS_NOTICKS); }
429     UINT    huds_notext   (UINT options) { return (options & HUDS_NOTEXT); }
430     UINT    huds_top      (UINT options) { return (options & HUDS_TOP); }
431     UINT    huds_bottom   (UINT options) { return (options & HUDS_BOTTOM); }
432
433     virtual void display_enable( bool working ) { is_enabled = working;}
434
435     virtual void break_display ( bool bad );
436     virtual void SetBrightness( int illumination_level ); // fgHUDSetBright...
437     void         SetPosition  ( int x, int y, UINT width, UINT height );
438     UINT         get_Handle( void );
439     virtual void draw( void ) = 0;   // Required method in derived classes
440
441     void drawOneLine( float x1, float y1, float x2, float y2)
442     {
443         HUD_LineList.add(fgLineSeg2D(x1,y1,x2,y2));
444     }
445     void drawOneStippleLine( float x1, float y1, float x2, float y2)
446     {
447         HUD_StippleLineList.add(fgLineSeg2D(x1,y1,x2,y2));
448     }
449     void TextString( char *msg, float x, float y, bool digit )
450     {
451         HUD_TextList.add(fgText(x, y, msg,digit));
452     }
453     int getStringWidth ( char *str )
454     {
455         if ( HUDtext && str ) {
456             float r, l ;
457             HUD_Font->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
458             return float_to_int( r - l );
459         }
460         return 0 ;
461     }
462
463
464
465 };
466
467 typedef instr_item *HIptr;
468
469 class HUDdraw {
470     public:
471         void operator() (HIptr elem) const {
472             if ( elem->enabled())
473                 elem->draw();
474         }
475 };
476
477
478 extern int HUD_style;
479
480 // instr_item           This class has no other purpose than to maintain
481 //                      a linked list of instrument and derived class
482 // object pointers.
483
484
485 class instr_label : public instr_item {
486 private:
487     const char  *pformat;
488     
489     fgLabelJust justify;
490     int         fontSize;
491     int         blink;
492     string      format_buffer;
493     bool        lat;
494     bool        lon;
495     bool        lbox;
496     SGPropertyNode_ptr lon_node;
497     SGPropertyNode_ptr lat_node;
498
499 public:
500     instr_label(const SGPropertyNode *);
501     virtual void draw(void);
502 };
503
504
505 //
506 // fgRunway_instr   This class is responsible for rendering the active runway
507 //                  in the hud (if visible).
508 class runway_instr : public instr_item {
509 private:
510         void boundPoint(const sgdVec3& v, sgdVec3& m);
511         bool boundOutsidePoints(sgdVec3& v, sgdVec3& m);
512         bool drawLine(const sgdVec3& a1, const sgdVec3& a2,
513                 const sgdVec3& p1, const sgdVec3& p2);
514         void drawArrow();
515         bool get_active_runway(FGRunway& rwy);
516         void get_rwy_points(sgdVec3 *points);
517         void setLineWidth(void);
518
519         sgdVec3 points3d[6], points2d[6];
520         double mm[16],pm[16], arrowScale, arrowRad, lnScale;
521         double scaleDist, default_pitch, default_heading;
522         GLint view[4];
523         FGRunway runway;
524         FGViewer* cockpit_view;
525         unsigned short stippleOut, stippleCen;
526         bool drawIA, drawIAAlways;
527         RECT location;
528         POINT center;
529
530 public:
531     runway_instr(const SGPropertyNode *);
532
533     virtual void draw( void );
534     void setArrowRotationRadius(double radius);
535     // Scales the runway indication arrow
536     void setArrowScale(double scale);
537     // Draws arrow when runway is not visible in HUD if draw=true
538     void setDrawArrow(bool draw);
539     // Always draws arrow if draw=true;
540     void setDrawArrowAlways(bool draw);
541     // Sets the maximum line scale
542     void setLineScale(double scale);
543     // Sets the distance where to start scaling the lines
544     void setScaleDist(double dist_nm);
545     // Sets the stipple pattern of the outline of the runway
546     void setStippleOutline(unsigned short stipple);
547     // Sets the stipple patter of the center line of the runway
548     void setStippleCenterline(unsigned short stipple);
549 };
550
551
552 //
553 // instr_scale           This class is an abstract base class for both moving
554 //                       scale and moving needle (fixed scale) indicators. It
555 // does not draw itself, but is not instanciable.
556 //
557
558 class instr_scale : public instr_item {
559 private:
560     float range_shown;   // Width Units.
561     float Maximum_value; //                ceiling.
562     float Minimum_value; // Representation floor.
563     float scale_factor;  // factor => screen units/range values.
564     UINT   Maj_div;       // major division marker units
565     UINT   Min_div;       // minor division marker units
566     UINT   Modulo;        // Roll over point
567     int    signif_digits; // digits to show to the right.
568
569 public:
570     instr_scale( int          x,
571                  int          y,
572                  UINT         width,
573                  UINT         height,
574                  FLTFNPTR     load_fn,
575                  UINT         options,
576                  float        show_range,
577                  float        max_value,
578                  float        min_value,
579                  float        disp_scaling,
580                  UINT         major_divs,
581                  UINT         minor_divs,
582                  UINT         rollover,
583                  int          dp_showing,
584                  bool         working = true);
585
586     virtual void draw    ( void ) {}; // No-op here. Defined in derived classes.
587     UINT   div_min       ( void ) { return Min_div;}
588     UINT   div_max       ( void ) { return Maj_div;}
589     float  min_val       ( void ) { return Minimum_value;}
590     float  max_val       ( void ) { return Maximum_value;}
591     UINT   modulo        ( void ) { return Modulo; }
592     float  factor        ( void ) { return scale_factor;}
593     float  range_to_show ( void ) { return range_shown;}
594 };
595
596 // hud_card                This class displays the indicated quantity on
597 //                         a scale that moves past the pointer. It may be
598 // horizontal or vertical, read above(left) or below(right) of the base
599 // line.
600
601 class hud_card : public instr_scale {
602 private:
603     float  val_span;
604     string type;
605     float  half_width_units;
606     bool   draw_tick_bottom;
607     bool   draw_tick_top;
608     bool   draw_tick_right;
609     bool   draw_tick_left;
610     bool   draw_cap_bottom;
611     bool   draw_cap_top;
612     bool   draw_cap_right;
613     bool   draw_cap_left;
614     float  marker_offset;
615     bool   pointer;
616     string pointer_type;
617     string tick_type;
618     string tick_length;
619     float  radius;
620     float  maxValue;
621     float  minValue;
622     int    divisions;
623     int    zoom;
624     UINT   Maj_div;
625     UINT   Min_div;
626
627 public:
628     hud_card(const SGPropertyNode *);
629     //    virtual void display_enable( bool setting );                  // FIXME
630     virtual void draw(void);
631     void circles(float, float, float);
632     void fixed(float, float, float, float, float, float);
633     void zoomed_scale(int, int);
634 };
635
636
637 class gauge_instr : public instr_scale {
638 public:
639     gauge_instr(const SGPropertyNode *);
640     virtual void draw( void );       // Required method in base class
641 };
642
643
644 //
645 // dual_instr_item         This class was created to form the base class
646 //                         for both panel and HUD Turn Bank Indicators.
647
648 class dual_instr_item : public instr_item {
649 private:
650     FLTFNPTR alt_data_source;
651
652 public:
653     dual_instr_item ( int       x,
654                       int       y,
655                       UINT      width,
656                       UINT      height,
657                       FLTFNPTR  chn1_source,
658                       FLTFNPTR  chn2_source,
659                       bool      working,
660                       UINT      options );
661
662     float current_ch1( void ) { return (float)alt_data_source(); }
663     float current_ch2( void ) { return (float)get_value(); }
664     virtual void draw( void ) {}
665 };
666
667
668 class fgTBI_instr : public dual_instr_item {
669 private:
670     UINT BankLimit;
671     UINT SlewLimit;
672     UINT scr_hole;
673     bool tsi;
674     float rad;
675
676 public:
677     fgTBI_instr(const SGPropertyNode *);
678
679     UINT bank_limit(void) { return BankLimit; }
680     UINT slew_limit(void) { return SlewLimit; }
681
682     virtual void draw(void);
683 };
684
685
686 class HudLadder : public dual_instr_item {
687 private:
688     UINT   width_units;
689     int    div_units;
690     UINT   minor_div;
691     UINT   label_pos;
692     UINT   scr_hole;
693     float  vmax;
694     float  vmin;
695     float  factor;
696     string hudladder_type;
697     bool   frl;
698     bool   target_spot;
699     bool   velocity_vector;
700     bool   drift_marker;
701     bool   alpha_bracket;
702     bool   energy_marker;
703     bool   climb_dive_marker;
704     bool   glide_slope_marker;
705     float  glide_slope;
706     bool   energy_worm;
707     bool   waypoint_marker;
708     int    zenith;
709     int    nadir;
710     int    hat;
711
712     // The Ladder has it's own temporary display lists
713     fgTextList         TextList;
714     fgLineList         LineList;
715     fgLineList         StippleLineList;
716
717 public:
718     HudLadder(const SGPropertyNode *);
719
720     virtual void draw(void);
721     void drawZenith(float, float, float);
722     void drawNadir(float, float, float);
723
724     void Text(float x, float y, char *s)
725     {
726         TextList.add(fgText(x, y, s));
727     }
728
729     void Line(float x1, float y1, float x2, float y2)
730     {
731         LineList.add(fgLineSeg2D(x1, y1, x2, y2));
732     }
733
734     void StippleLine(float x1, float y1, float x2, float y2)
735     {
736         StippleLineList.add(fgLineSeg2D(x1, y1, x2, y2));
737     }
738 };
739
740
741 extern int  fgHUDInit( fgAIRCRAFT * /* current_aircraft */ );
742 extern int  fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ );
743 extern void fgUpdateHUD( osg::State* );
744 extern void fgUpdateHUD( osg::State*, GLfloat x_start, GLfloat y_start,
745                          GLfloat x_end, GLfloat y_end );
746
747
748
749
750 class HUD_Properties : public SGPropertyChangeListener {
751 public:
752     HUD_Properties();
753     void valueChanged(SGPropertyNode *n);
754     void setColor() const;
755     bool isVisible() const { return _visible; }
756     bool isAntialiased() const { return _antialiased; }
757     bool isTransparent() const { return _transparent; }
758     float alphaClamp() const { return _cl; }
759
760 private:
761     float clamp(float f) { return f < 0.0f ? 0.0f : f > 1.0f ? 1.0f : f; }
762     SGPropertyNode_ptr _current;
763     SGPropertyNode_ptr _visibility;
764     SGPropertyNode_ptr _antialiasing;
765     SGPropertyNode_ptr _transparency;
766     SGPropertyNode_ptr _red, _green, _blue, _alpha;
767     SGPropertyNode_ptr _alpha_clamp;
768     SGPropertyNode_ptr _brightness;
769     bool _visible;
770     bool _antialiased;
771     bool _transparent;
772     float _r, _g, _b, _a, _cl;
773 };
774
775 #endif // _OLDHUD_H