]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/hud.hxx
remove the rest of the static variables (except one); cleanup
[flightgear.git] / src / Cockpit / hud.hxx
index 8591bb9b2927583921ebeb344f00319286bc666f..00069c9578c7b52cdedae3a2dbeaea8f5253c632 100644 (file)
@@ -436,7 +436,7 @@ public:
                 FLTFNPTR       data_source,
                 float          data_scaling,
                 UINT           options,
-                bool           working  = true,
+                bool           working = true,
                 int            digit = 0);
 
     instr_item( const instr_item & image );
@@ -455,19 +455,23 @@ public:
     POINT   get_centroid    ( void ) { return mid_span;  }
     UINT    get_options     ( void ) { return opts;      }
     int     get_digits      ( void ) { return digits;         }
-
-    UINT    huds_vert     (UINT options) { return( options  & HUDS_VERT ); }
-    UINT    huds_left     (UINT options) { return( options  & HUDS_LEFT ); }
-    UINT    huds_right    (UINT options) { return( options  & HUDS_RIGHT ); }
+    inline int get_x() const { return scrn_pos.left; }
+    inline int get_y() const { return scrn_pos.top; }
+    inline int get_width() const { return scrn_pos.right; }
+    inline int get_height() const { return scrn_pos.bottom; }
+
+    UINT    huds_vert     (UINT options) { return (options & HUDS_VERT); }
+    UINT    huds_left     (UINT options) { return (options & HUDS_LEFT); }
+    UINT    huds_right    (UINT options) { return (options & HUDS_RIGHT); }
     UINT    huds_both     (UINT options) {
-        return( (options & HUDS_BOTH) == HUDS_BOTH );
+        return ((options & HUDS_BOTH) == HUDS_BOTH);
     }
-    UINT    huds_noticks  (UINT options) { return( options  & HUDS_NOTICKS ); }
-    UINT    huds_notext   (UINT options) { return( options  & HUDS_NOTEXT ); }
-    UINT    huds_top      (UINT options) { return( options  & HUDS_TOP ); }
-    UINT    huds_bottom   (UINT options) { return( options  & HUDS_BOTTOM ); }
+    UINT    huds_noticks  (UINT options) { return (options & HUDS_NOTICKS); }
+    UINT    huds_notext   (UINT options) { return (options & HUDS_NOTEXT); }
+    UINT    huds_top      (UINT options) { return (options & HUDS_TOP); }
+    UINT    huds_bottom   (UINT options) { return (options & HUDS_BOTTOM); }
 
-    virtual void display_enable( bool working ) { is_enabled = !! working;}
+    virtual void display_enable( bool working ) { is_enabled = working;}
 
     virtual void update( void );
     virtual void break_display ( bool bad );
@@ -624,46 +628,49 @@ public:
 
 
 //
-// fgRunway_instr        This class is responsible for rendering the active runway
-//                        in the hud (if visible).
-class runway_instr : public instr_item
-{
+// fgRunway_instr   This class is responsible for rendering the active runway
+//                  in the hud (if visible).
+class runway_instr : public instr_item {
 private:
         void boundPoint(const sgdVec3& v, sgdVec3& m);
         bool boundOutsidePoints(sgdVec3& v, sgdVec3& m);
-        bool drawLine(const sgdVec3& a1, const sgdVec3& a2, const sgdVec3& p1, const sgdVec3& p2);
+        bool drawLine(const sgdVec3& a1, const sgdVec3& a2,
+                const sgdVec3& p1, const sgdVec3& p2);
         void drawArrow();
         bool get_active_runway(FGRunway& rwy);
         void get_rwy_points(sgdVec3 *points);
         void setLineWidth(void);
 
-        sgdVec3 points3d[6],points2d[6];
-        double mm[16],pm[16], arrowScale, arrowRad, lnScale, scaleDist, default_pitch, default_heading;
+        sgdVec3 points3d[6], points2d[6];
+        double mm[16],pm[16], arrowScale, arrowRad, lnScale;
+        double scaleDist, default_pitch, default_heading;
         GLint view[4];
         FGRunway runway;
         FGViewer* cockpit_view;
-        unsigned short stippleOut,stippleCen;
-        bool drawIA,drawIAAlways;
+        unsigned short stippleOut, stippleCen;
+        bool drawIA, drawIAAlways;
         RECT location;
         POINT center;
 
 public:
-    runway_instr( int    x,
-                  int    y,
-                  int    width,
-                  int    height,
-                  float  scale_data,
-                  bool   working = true);
-
-    virtual void draw( void );       // Required method in base class
-        void setArrowRotationRadius(double radius);
-        void setArrowScale(double scale); // Scales the runway indication arrow
-        void setDrawArrow(bool draw);         // Draws arrow when runway is not visible in HUD if draw=true
-        void setDrawArrowAlways(bool draw); //Always draws arrow if draw=true;
-        void setLineScale(double scale); //Sets the maximum line scale
-        void setScaleDist(double dist_nm); //Sets the distance where to start scaling the lines
-        void setStippleOutline(unsigned short stipple); //Sets the stipple pattern of the outline of the runway
-        void setStippleCenterline(unsigned short stipple); //Sets the stipple patter of the center line of the runway
+    runway_instr(const SGPropertyNode *);
+
+    virtual void draw( void );
+    void setArrowRotationRadius(double radius);
+    // Scales the runway indication arrow
+    void setArrowScale(double scale);
+    // Draws arrow when runway is not visible in HUD if draw=true
+    void setDrawArrow(bool draw);
+    //Always draws arrow if draw=true;
+    void setDrawArrowAlways(bool draw);
+    //Sets the maximum line scale
+    void setLineScale(double scale);
+    //Sets the distance where to start scaling the lines
+    void setScaleDist(double dist_nm);
+    //Sets the stipple pattern of the outline of the runway
+    void setStippleOutline(unsigned short stipple);
+    //Sets the stipple patter of the center line of the runway
+    void setStippleCenterline(unsigned short stipple);
 };
 
 
@@ -704,17 +711,17 @@ public:
     virtual ~instr_scale();
     instr_scale( const instr_scale & image);
 
-    virtual void draw   ( void ) {}; // No-op here. Defined in derived classes.
-    UINT   div_min      ( void ) { return Min_div;}
-    UINT   div_max      ( void ) { return Maj_div;}
-    float min_val       ( void ) { return Minimum_value;}
-    float max_val       ( void ) { return Maximum_value;}
-    UINT   modulo       ( void ) { return Modulo; }
-    float factor        ( void ) { return scale_factor;}
-    float range_to_show ( void ) { return range_shown;}
+    virtual void draw    ( void ) {}; // No-op here. Defined in derived classes.
+    UINT   div_min       ( void ) { return Min_div;}
+    UINT   div_max       ( void ) { return Maj_div;}
+    float  min_val       ( void ) { return Minimum_value;}
+    float  max_val       ( void ) { return Maximum_value;}
+    UINT   modulo        ( void ) { return Modulo; }
+    float  factor        ( void ) { return scale_factor;}
+    float  range_to_show ( void ) { return range_shown;}
 };
 
-// hud_card_               This class displays the indicated quantity on
+// hud_card                This class displays the indicated quantity on
 //                         a scale that moves past the pointer. It may be
 // horizontal or vertical, read above(left) or below(right) of the base
 // line.
@@ -745,72 +752,19 @@ private:
     UINT   Maj_div;
     UINT   Min_div;
 
-
 public:
-    hud_card( int      x,
-              int      y,
-              UINT     width,
-              UINT     height,
-              FLTFNPTR load_fn,
-              UINT     options,
-              float    maxValue,
-              float    minValue,
-              float    disp_scaling,
-              UINT     major_divs,
-              UINT     minor_divs,
-              UINT     modulator,
-              int      dp_showing,
-              float    value_span,
-              string   type,
-              bool     draw_tick_bottom,
-              bool     draw_tick_top,
-              bool     draw_tick_right,
-              bool     draw_tick_left,
-              bool     draw_cap_bottom,
-              bool     draw_cap_top,
-              bool     draw_cap_right,
-              bool     draw_cap_left,
-              float    marker_offset,
-              bool     pointer,
-              string   pointer_type,
-              string  tick_type,
-              string  tick_length,
-              bool     working,
-              float    radius,
-              int      divisions,
-              int      zoom
-            );
-
-
-    ~hud_card();
-    hud_card( const hud_card & image);
-    //    virtual void display_enable( bool setting );
-    virtual void draw( void );       // Required method in base class
-    void circles(float,float,float);
-    void fixed(float,float,float,float,float,float);
-    void zoomed_scale(int,int);
+    hud_card(const SGPropertyNode *);
+    //    virtual void display_enable( bool setting );                 // FIXME
+    virtual void draw(void);
+    void circles(float, float, float);
+    void fixed(float, float, float, float, float, float);
+    void zoomed_scale(int, int);
 };
 
 
 class gauge_instr : public instr_scale {
 public:
-    gauge_instr( int       x,
-                 int       y,
-                 UINT      width,
-                 UINT      height,
-                 FLTFNPTR  load_fn,
-                 UINT      options,
-                 float     disp_scaling,
-                 float     maxValue,
-                 float     minValue,
-                 UINT      major_divs,
-                 UINT      minor_divs,
-                 int       dp_showing,
-                 UINT      modulus,
-                 bool      working);
-
-    ~gauge_instr();
-    gauge_instr( const gauge_instr & image);
+    gauge_instr(const SGPropertyNode *);
     virtual void draw( void );       // Required method in base class
 };
 
@@ -841,8 +795,8 @@ public:
     virtual void draw( void ) { }
 };
 
-class fgTBI_instr : public dual_instr_item
-{
+
+class fgTBI_instr : public dual_instr_item {
 private:
     UINT BankLimit;
     UINT SlewLimit;
@@ -851,27 +805,12 @@ private:
     float rad;
 
 public:
-    fgTBI_instr( int       x,
-                 int       y,
-                 UINT      width,
-                 UINT      height,
-                 FLTFNPTR  chn1_source,
-                 FLTFNPTR  chn2_source,
-                 float     maxBankAngle,
-                 float     maxSlipAngle,
-                 UINT      gap_width,
-                 bool      working,
-                 bool      tsi,
-                 float     rad);
-
-    fgTBI_instr( const fgTBI_instr & image);
-
-    ~fgTBI_instr();
-
-    UINT bank_limit( void ) { return BankLimit;}
-    UINT slew_limit( void ) { return SlewLimit;}
+    fgTBI_instr(const SGPropertyNode *);
 
-    virtual void draw( void );       // Required method in base class
+    UINT bank_limit(void) { return BankLimit; }
+    UINT slew_limit(void) { return SlewLimit; }
+
+    virtual void draw(void);
 };