]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/hud_card.cxx
A couple more straggling instrumentation clean ups.
[flightgear.git] / src / Cockpit / hud_card.cxx
index 0a06d7b65ed07d2b23be04b4ec5468eeecd2067e..ee5fad245c41287b1ccf89c34465f083cba5f36b 100644 (file)
@@ -2,14 +2,13 @@
 #include "hud.hxx"
 
 #ifdef USE_HUD_TextList
-#define textString( x , y, text, font,digit)  TextString( text, x , y ,digit ) //suma
+#define textString( x , y, text, digit)  TextString( text, x , y ,digit ) //suma
 #else
-#define textString( x , y, text, font,digit )  puDrawString ( guiFnt, text, x, y ); //suma
+#define textString( x , y, text, digit )  puDrawString ( guiFnt, text, x, y ); //suma
 #endif
 
 //========== Top of hud_card class member definitions =============
 //begin suma
-#include<GL/glut.h> 
 #include<math.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -194,7 +193,6 @@ draw( void ) //  (HUD_scale * pscale )
     if(type=="gauge") {
         float x,y;
         float i;
-        int  decimal, sign;
         y=(float)(scrn_rect.top);
         x=(float)(scrn_rect.left);
         glEnable(GL_POINT_SMOOTH);
@@ -233,13 +231,15 @@ draw( void ) //  (HUD_scale * pscale )
             sprintf(TextScale,"%3.1f\n",theta);
                 
             // draw value
-            int l= abs((int)theta);
-            if((l>=0) && (l<=9))
-                textString (x,y,TextScale,GLUT_BITMAP_8_BY_13,0 );
-            if((l>=10) && (l<=99))
-                textString (x-1.0,y,TextScale,GLUT_BITMAP_8_BY_13,0 );
-            if((l>=100) && (l<=359))
-                textString (x-2.0,y,TextScale,GLUT_BITMAP_8_BY_13,0 ); 
+            int l = abs((int)theta);
+            if (l) {
+                if( l<10)
+                    textString (x,y,TextScale,0 );
+                else if(l<100)
+                    textString (x-1.0,y,TextScale,0 );
+                else if( l<360 )
+                    textString (x-2.0,y,TextScale,0 );
+            }
                         
         }
       
@@ -322,8 +322,8 @@ draw( void ) //  (HUD_scale * pscale )
                     if(pointer_type=="moving") {
                         if(zoom == 0) {
                             //Code for Moving Type Pointer included by suma.
-                            static float ycentre, ypoint,xpoint;
-                            static int range,wth;
+                            float ycentre, ypoint,xpoint;
+                            int range,wth;
                             if(cur_value > maxValue) cur_value = maxValue;
                             if(cur_value < minValue) cur_value = minValue;
                             if (minValue >= 0.0) 
@@ -378,10 +378,14 @@ draw( void ) //  (HUD_scale * pscale )
                         if(zoom == 0) {
                             //type-fixed & zoom=1, behaviour to be defined
                             // Code for Moving Type Pointer included by suma.
-                            static float ycentre, ypoint,xpoint;
-                            static int range,wth;
-                            if(cur_value > maxValue) cur_value = maxValue;
-                            if(cur_value < minValue) cur_value = minValue;
+                            float ycentre, ypoint,xpoint;
+                            int range;
+                                                       
+                            if(cur_value > maxValue)
+                                cur_value = maxValue;
+                            if(cur_value < minValue)
+                                cur_value = minValue;
+                                                       
                             if (minValue >= 0.0) 
                                 ycentre = scrn_rect.top;
                             else if (maxValue + minValue == 0.0)
@@ -392,6 +396,7 @@ draw( void ) //  (HUD_scale * pscale )
                                 else
                                     ycentre = scrn_rect.top + minValue*scrn_rect.bottom/(maxValue-minValue);
                             range = scrn_rect.bottom;
+                                                       
                             if (oddtype == 1)
                                 ypoint = ycentre + ((cur_value-1.0) * range / val_span);
                             else
@@ -424,11 +429,13 @@ draw( void ) //  (HUD_scale * pscale )
             
             // draw scale or tape
                
-            last = FloatToInt(vmax)+1;
-            i = FloatToInt(vmin);
+//            last = FloatToInt(vmax)+1;
+//            i = FloatToInt(vmin);
+            last = (int)vmax + 1; // N
+            i = (int)vmin; // N
 
             if(zoom ==1) { 
-                zoomed_scale(vmin,vmax); //suma
+                zoomed_scale((int)vmin,(int)vmax); //suma
             } else {
                 for( ; i <last ; i++ ) {
                     condition = true;
@@ -445,12 +452,12 @@ draw( void ) //  (HUD_scale * pscale )
                         // Block calculation artifact from drawing ticks below min coordinate.
                         // Calculation here accounts for text height.
 
-                        /* if(( marker_ys < (scrn_rect.top + 4)) |
+                        if(( marker_ys < (scrn_rect.top + 4)) |
                            ( marker_ys > (height - 4)))
-                           {
-                           // Magic numbers!!!
-                           continue;
-                           } */
+                        {
+                            // Magic numbers!!!
+                            continue;
+                        }
 
                         if (oddtype == 1) 
                             k = i+1; //enable ticks at odd values
@@ -461,8 +468,8 @@ draw( void ) //  (HUD_scale * pscale )
                         if( div_min()) { 
                             // if( (i%div_min()) == 0) {
                             if( !(k%(int)div_min())) {             
-                                /*    if((( marker_ys - 5) > scrn_rect.top ) &&
-                                      (( marker_ys + 5) < (height))){    */
+                                if((( marker_ys - 5) > scrn_rect.top ) &&
+                                   (( marker_ys + 5) < (height))) {
                             
                                 //vertical/left OR vertical/right
                                 if( huds_both(options) ) {
@@ -528,7 +535,8 @@ draw( void ) //  (HUD_scale * pscale )
                                                          marker_xe - 4, marker_ys );
                                         } 
                                     } 
-                                } //end huds both 
+                                } //end huds both
+                              }
                             } //end draw minor ticks
                         }  //end minor ticks
 
@@ -576,7 +584,7 @@ draw( void ) //  (HUD_scale * pscale )
                                                                
                                     if( !huds_notext(options)) {
                                         textString ( marker_xs + 2,  marker_ys,
-                                                     TextScale,  GLUT_BITMAP_8_BY_13,0 );
+                                                     TextScale,0 );
                                     } 
                                 } else { 
                                     //begin suma 
@@ -593,11 +601,11 @@ draw( void ) //  (HUD_scale * pscale )
                                         if( huds_left(options) ) { 
                                             textString( marker_xs -  8 * lenstr - 2,
                                                         marker_ys - 4,
-                                                        TextScale, GLUT_BITMAP_8_BY_13,0 );                                                                             
+                                                        TextScale, 0 );                                                                                 
                                         } else { 
                                             textString( marker_xe + 3 * lenstr,
                                                         marker_ys - 4,
-                                                        TextScale, GLUT_BITMAP_8_BY_13,0 );
+                                                        TextScale, 0 );
                                         } //End if huds_left
                                     } //End if !huds_notext
                                 }  //End if huds-both
@@ -658,14 +666,14 @@ draw( void ) //  (HUD_scale * pscale )
                     if(pointer_type=="moving") { 
                         if (zoom ==0) {
                             //Code for Moving Type Pointer included by suma.
-                            static float xcentre,xpoint,ypoint;
-                            static int range;
+                            // static float xcentre,xpoint,ypoint;
+                            // static int range;
                             if(cur_value > maxValue) cur_value = maxValue;
                             if(cur_value < minValue) cur_value = minValue;
-                            xcentre = mid_scr.x;
-                            range = scrn_rect.right;
-                            xpoint = xcentre + (cur_value * range / val_span);
-                            ypoint = scrn_rect.top - marker_offset;
+                            float xcentre = mid_scr.x;
+                            int range = scrn_rect.right;
+                            float xpoint = xcentre + (cur_value * range / val_span);
+                            float ypoint = scrn_rect.top - marker_offset;
                             drawOneLine(xcentre, ypoint,xpoint,ypoint);
                             drawOneLine(xpoint,ypoint,xpoint,ypoint+marker_offset);
                             drawOneLine(xpoint,ypoint+marker_offset,xpoint+5.0,ypoint+5.0);
@@ -701,15 +709,15 @@ draw( void ) //  (HUD_scale * pscale )
                     if(pointer_type=="moving") { 
                         if(zoom == 0) { 
                             //Code for Moving Type Pointer included by suma.
-                            static float xcentre,xpoint,ypoint;
-                            static int range,hgt;
+                            // static float xcentre,xpoint,ypoint;
+                            // static int range,hgt;
                             if(cur_value > maxValue) cur_value = maxValue;
                             if(cur_value < minValue) cur_value = minValue;
-                            xcentre = mid_scr.x ;
-                            range = scrn_rect.right;
-                            hgt   = scrn_rect.top + scrn_rect.bottom;
-                            xpoint = xcentre + (cur_value * range / val_span);
-                            ypoint = hgt + marker_offset;
+                            float xcentre = mid_scr.x ;
+                            int range = scrn_rect.right;
+                            int hgt   = scrn_rect.top + scrn_rect.bottom;
+                            float xpoint = xcentre + (cur_value * range / val_span);
+                            float ypoint = hgt + marker_offset;
                             drawOneLine(xcentre, ypoint,xpoint,ypoint);
                             drawOneLine(xpoint,ypoint,xpoint,ypoint-marker_offset);
                             drawOneLine(xpoint,ypoint-marker_offset,xpoint+5.0,ypoint-5.0);
@@ -734,7 +742,7 @@ draw( void ) //  (HUD_scale * pscale )
             //  i    = FloatToInt(vmin);
 
             if(zoom ==1) {  
-                zoomed_scale(vmin,vmax); //suma
+                zoomed_scale((int)vmin,(int)vmax); //suma
             } else  { 
                 //default to zoom=0
                 last = (int)vmax + 1;
@@ -763,8 +771,8 @@ draw( void ) //  (HUD_scale * pscale )
                             //draw minor ticks
                             if( !(k%(int)div_min() )) {           
                                 // draw in ticks only if they aren't too close to the edge.
-                                /*if((( marker_xs - 5) > scrn_rect.left ) &&
-                                  (( marker_xs + 5 )< (scrn_rect.left + scrn_rect.right))){ */ //suma
+                                if((( marker_xs - 5) > scrn_rect.left ) &&
+                                  (( marker_xs + 5 )< (scrn_rect.left + scrn_rect.right))){
                             
                                 if( huds_both(options) ) { 
                                     if(tick_length=="variable") { 
@@ -796,7 +804,8 @@ draw( void ) //  (HUD_scale * pscale )
                                             drawOneLine(marker_xs,marker_ys+4,marker_xs,marker_ye);
                                         else
                                             drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye);
-                                } 
+                                }
+                              }
                             } //end draw minor ticks
                         } //end minor ticks
                         //major ticks
@@ -820,8 +829,8 @@ draw( void ) //  (HUD_scale * pscale )
                                                   // (int)(disp_val  * data_scaling() +.5));
                                                   FloatToInt(disp_val * data_scaling()/*+.5*/));
                                 // Draw major ticks and text only if far enough from the edge.
-                                /*if(( (marker_xs - 10)> scrn_rect.left ) &&
-                                          ( (marker_xs + 10) < (scrn_rect.left + scrn_rect.right))){*/ //suma
+                                if(( (marker_xs - 10)> scrn_rect.left ) &&
+                                          ( (marker_xs + 10) < (scrn_rect.left + scrn_rect.right))){
                                 if( huds_both(options) ) {
                                     // drawOneLine( marker_xs, scrn_rect.top,
                                     //              marker_xs, marker_ys);
@@ -835,7 +844,7 @@ draw( void ) //  (HUD_scale * pscale )
                                     if( !huds_notext(options) ) {
                                         textString ( marker_xs - 4 * lenstr,
                                                      marker_ys + 4,
-                                                             TextScale,  GLUT_BITMAP_8_BY_13,0 ); //suma
+                                                             TextScale, 0 ); //suma
                                     } 
                                 } else {
                                     drawOneLine( marker_xs, marker_ys,
@@ -844,14 +853,15 @@ draw( void ) //  (HUD_scale * pscale )
                                         if( huds_top(options) )              {
                                             textString ( marker_xs - 4 * lenstr,
                                                          height - 10,
-                                                         TextScale, GLUT_BITMAP_8_BY_13,0 ); //suma
+                                                         TextScale, 0 ); //suma
                                         }  else  {
                                             textString( marker_xs - 4 * lenstr,
                                                         scrn_rect.top,
-                                                        TextScale, GLUT_BITMAP_8_BY_13,0 ); //suma
+                                                        TextScale, 0 ); //suma
                                         } 
                                     } 
-                                } 
+                                }
+                              }
                             }  //end draw major ticks
                         } //endif major ticks
                     }   //end condition
@@ -899,7 +909,7 @@ zoomed_scale(int first, int last)
     RECT   scrn_rect = get_location();
     UINT options     = get_options();
     char TextScale[80];
-    int disp_val = 0;
+    // int disp_val = 0;
     int data[80];
  
     float x,y,w,h,bottom;
@@ -990,7 +1000,7 @@ zoomed_scale(int first, int last)
             sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
 
             if( !huds_notext(options)) { 
-                textString (x, ycentre, TextScale, GLUT_BITMAP_8_BY_13,0 );
+                textString (x, ycentre, TextScale, 0 );
             } 
        
             for(i=1;i<5;i++) {  
@@ -1009,12 +1019,12 @@ zoomed_scale(int first, int last)
                 sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
 
                 if( !huds_notext(options)) 
-                    textString (x, yfirst, TextScale, GLUT_BITMAP_8_BY_13,0 );
+                    textString (x, yfirst, TextScale, 0 );
                   
                 sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
 
                 if( !huds_notext(options)) 
-                    textString (x, ysecond, TextScale, GLUT_BITMAP_8_BY_13,0 );
+                    textString (x, ysecond, TextScale, 0 );
                   
 
                 yfirst    -= factors;
@@ -1042,7 +1052,7 @@ zoomed_scale(int first, int last)
             sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
 
             if( !huds_notext(options)) { 
-                textString (w, ycentre, TextScale, GLUT_BITMAP_8_BY_13,0 );
+                textString (w, ycentre, TextScale, 0 );
             } 
        
             for(i=1;i<5;i++) {  
@@ -1061,12 +1071,12 @@ zoomed_scale(int first, int last)
                 sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
 
                 if( !huds_notext(options)) 
-                    textString (w, yfirst, TextScale, GLUT_BITMAP_8_BY_13,0 );
+                    textString (w, yfirst, TextScale, 0 );
                   
                 sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
 
                 if( !huds_notext(options)) 
-                    textString (w, ysecond, TextScale, GLUT_BITMAP_8_BY_13,0 );
+                    textString (w, ysecond, TextScale, 0 );
                   
                 yfirst -= factors;
                 ysecond   += factors;
@@ -1156,7 +1166,7 @@ zoomed_scale(int first, int last)
             sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
 
             if( !huds_notext(options)) { 
-                textString (xcentre-10.0, y, TextScale, GLUT_BITMAP_8_BY_13,0 );
+                textString (xcentre-10.0, y, TextScale, 0 );
             } 
        
             for(i=1;i<5;i++) {  
@@ -1175,12 +1185,12 @@ zoomed_scale(int first, int last)
                 sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
 
                 if( !huds_notext(options)) 
-                    textString (xfirst-10.0, y, TextScale, GLUT_BITMAP_8_BY_13,0 );
+                    textString (xfirst-10.0, y, TextScale, 0 );
                   
                 sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
                             
                 if( !huds_notext(options)) 
-                    textString (xsecond-10.0, y, TextScale, GLUT_BITMAP_8_BY_13,0 );
+                    textString (xsecond-10.0, y, TextScale, 0 );
                   
 
                 xfirst -= factors;
@@ -1209,7 +1219,7 @@ zoomed_scale(int first, int last)
             sprintf(TextScale,"%3.0f\n",(float)(data[centre] * data_scaling()));
             
             if( !huds_notext(options)) { 
-                textString (xcentre-10.0, h, TextScale, GLUT_BITMAP_8_BY_13,0 );
+                textString (xcentre-10.0, h, TextScale, 0 );
             } 
        
             for(i=1;i<5;i++) {  
@@ -1228,12 +1238,12 @@ zoomed_scale(int first, int last)
                 sprintf(TextScale,"%3.0f\n",(float)(data[centre-i-1] * data_scaling()));
 
                 if( !huds_notext(options)) 
-                    textString (xfirst-10.0,h, TextScale, GLUT_BITMAP_8_BY_13,0 );
+                    textString (xfirst-10.0,h, TextScale, 0 );
                   
                 sprintf(TextScale,"%3.0f\n",(float)(data[centre+i+1] * data_scaling()));
 
                 if( !huds_notext(options)) 
-                    textString (xsecond-10.0,h, TextScale, GLUT_BITMAP_8_BY_13,0 );
+                    textString (xsecond-10.0,h, TextScale, 0 );
                   
 
                 xfirst -= factors;