#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>
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);
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 );
+ }
}
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)
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)
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
// 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;
// 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
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) ) {
marker_xe - 4, marker_ys );
}
}
- } //end huds both
+ } //end huds both
+ }
} //end draw minor ticks
} //end minor ticks
if( !huds_notext(options)) {
textString ( marker_xs + 2, marker_ys,
- TextScale, GLUT_BITMAP_8_BY_13,0 );
+ TextScale,0 );
}
} else {
//begin suma
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
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);
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);
// 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;
//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") {
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
// (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);
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,
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
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;
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++) {
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;
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++) {
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;
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++) {
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;
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++) {
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;