]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/hud_card.cxx
fix ugly aliasing effects in moving scales (caused by integer calculation
[flightgear.git] / src / Cockpit / hud_card.cxx
index 255341f1223bbf78aa35147152a3ae35338b527a..b958b2cc0124c0290efc63ea7f36649e8783f21a 100644 (file)
@@ -1,15 +1,19 @@
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 #include <plib/sg.h>
 #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>
@@ -162,10 +166,10 @@ draw( void ) //  (HUD_scale * pscale )
 {
 
     float vmin = 0.0, vmax = 0.0;
-    int marker_xs;
-    int marker_xe;
-    int marker_ys;
-    int marker_ye;
+    float marker_xs;
+    float marker_xe;
+    float marker_ys;
+    float marker_ye;
     int text_x = 0, text_y = 0;
     int lenstr;
     int height, width;
@@ -194,7 +198,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);
@@ -236,11 +239,11 @@ draw( void ) //  (HUD_scale * pscale )
             int l = abs((int)theta);
             if (l) {
                 if( l<10)
-                    textString (x,y,TextScale,GLUT_BITMAP_8_BY_13,0 );
+                    textString (x,y,TextScale,0 );
                 else if(l<100)
-                    textString (x-1.0,y,TextScale,GLUT_BITMAP_8_BY_13,0 );
+                    textString (x-1.0,y,TextScale,0 );
                 else if( l<360 )
-                    textString (x-2.0,y,TextScale,GLUT_BITMAP_8_BY_13,0 );
+                    textString (x-2.0,y,TextScale,0 );
             }
                         
         }
@@ -381,7 +384,7 @@ draw( void ) //  (HUD_scale * pscale )
                             //type-fixed & zoom=1, behaviour to be defined
                             // Code for Moving Type Pointer included by suma.
                             float ycentre, ypoint,xpoint;
-                            int range,wth;
+                            int range;
                                                        
                             if(cur_value > maxValue)
                                 cur_value = maxValue;
@@ -437,7 +440,7 @@ draw( void ) //  (HUD_scale * pscale )
             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;
@@ -449,7 +452,7 @@ draw( void ) //  (HUD_scale * pscale )
 
                     if( condition ) {  // Show a tick if necessary
                         // Calculate the location of this tick
-                        marker_ys = scrn_rect.top + FloatToInt(((i - vmin) * factor()/*+.5f*/));
+                        marker_ys = scrn_rect.top + (i - vmin) * factor()/*+.5f*/;
                         // marker_ys = scrn_rect.top + (int)((i - vmin) * factor() + .5);
                         // Block calculation artifact from drawing ticks below min coordinate.
                         // Calculation here accounts for text height.
@@ -586,7 +589,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 
@@ -603,11 +606,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
@@ -744,7 +747,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;
@@ -846,7 +849,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,
@@ -855,11 +858,11 @@ 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
                                         } 
                                     } 
                                 }
@@ -911,7 +914,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;
@@ -1002,7 +1005,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++) {  
@@ -1021,12 +1024,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;
@@ -1054,7 +1057,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++) {  
@@ -1073,12 +1076,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;
@@ -1168,7 +1171,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++) {  
@@ -1187,12 +1190,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;
@@ -1221,7 +1224,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++) {  
@@ -1240,12 +1243,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;