- fix more cases of scale tick aliasing to get smooth scale movements
- remove trailing spaces, fix indentation, unify coding style, ...
This commit is contained in:
parent
365546444c
commit
b674037a3c
2 changed files with 948 additions and 944 deletions
|
@ -7,21 +7,19 @@
|
||||||
#include "hud.hxx"
|
#include "hud.hxx"
|
||||||
|
|
||||||
#ifdef USE_HUD_TextList
|
#ifdef USE_HUD_TextList
|
||||||
#define textString( x , y, text, digit) TextString( text, x , y ,digit ) //suma
|
#define textString(x, y, text, digit) TextString(text, x , y ,digit)
|
||||||
#else
|
#else
|
||||||
#define textString( x , y, text, digit ) puDrawString ( guiFnt, text, x, y ); //suma
|
#define textString(x, y, text, digit) puDrawString(guiFnt, text, x, y)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//========== Top of hud_card class member definitions =============
|
//========== Top of hud_card class member definitions =============
|
||||||
//begin suma
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
//end suma
|
|
||||||
|
|
||||||
|
|
||||||
hud_card ::
|
hud_card::hud_card(
|
||||||
hud_card( int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
UINT width,
|
UINT width,
|
||||||
UINT height,
|
UINT height,
|
||||||
|
@ -50,10 +48,9 @@ hud_card( int x,
|
||||||
string type_tick,//hud
|
string type_tick,//hud
|
||||||
string length_tick,//hud
|
string length_tick,//hud
|
||||||
bool working,
|
bool working,
|
||||||
float rad,//suma
|
float rad,
|
||||||
int divs, //suma
|
int divs,
|
||||||
int zooms //suma
|
int zooms) :
|
||||||
) : //suma
|
|
||||||
instr_scale(x,y,width,height,
|
instr_scale(x,y,width,height,
|
||||||
data_source, options,
|
data_source, options,
|
||||||
value_span,
|
value_span,
|
||||||
|
@ -75,16 +72,16 @@ hud_card( int x,
|
||||||
pointer_type (type_pointer),
|
pointer_type (type_pointer),
|
||||||
tick_type (type_tick), //hud
|
tick_type (type_tick), //hud
|
||||||
tick_length (length_tick), //hud
|
tick_length (length_tick), //hud
|
||||||
Maj_div (major_divs), //suma
|
Maj_div (major_divs),
|
||||||
Min_div (minor_divs) //suma
|
Min_div (minor_divs)
|
||||||
|
|
||||||
{
|
{
|
||||||
half_width_units = range_to_show() / 2.0;
|
half_width_units = range_to_show() / 2.0;
|
||||||
radius=rad; //suma
|
radius = rad;
|
||||||
maxValue=max_value; //suma
|
maxValue = max_value;
|
||||||
minValue=min_value; //suma
|
minValue = min_value;
|
||||||
divisions=divs; //suma
|
divisions = divs;
|
||||||
zoom = zooms; //suma
|
zoom = zooms;
|
||||||
|
|
||||||
// UINT options = get_options();
|
// UINT options = get_options();
|
||||||
// huds_both = (options & HUDS_BOTH) == HUDS_BOTH;
|
// huds_both = (options & HUDS_BOTH) == HUDS_BOTH;
|
||||||
|
@ -96,11 +93,11 @@ hud_card( int x,
|
||||||
// huds_bottom = options & HUDS_BOTTOM;
|
// huds_bottom = options & HUDS_BOTTOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
hud_card ::
|
|
||||||
~hud_card() { }
|
|
||||||
|
|
||||||
hud_card ::
|
hud_card::~hud_card() { }
|
||||||
hud_card( const hud_card & image):
|
|
||||||
|
|
||||||
|
hud_card::hud_card(const hud_card & image) :
|
||||||
instr_scale((const instr_scale &) image),
|
instr_scale((const instr_scale &) image),
|
||||||
val_span(image.val_span),
|
val_span(image.val_span),
|
||||||
type(image.type),
|
type(image.type),
|
||||||
|
@ -118,8 +115,8 @@ hud_card( const hud_card & image):
|
||||||
pointer_type (image.pointer_type),
|
pointer_type (image.pointer_type),
|
||||||
tick_type(image.tick_type), //hud
|
tick_type(image.tick_type), //hud
|
||||||
tick_length(image.tick_length), //hud
|
tick_length(image.tick_length), //hud
|
||||||
Maj_div(image.Maj_div), //suma
|
Maj_div(image.Maj_div),
|
||||||
Min_div(image.Min_div)//suma
|
Min_div(image.Min_div)
|
||||||
|
|
||||||
{
|
{
|
||||||
// UINT options = get_options();
|
// UINT options = get_options();
|
||||||
|
@ -132,8 +129,8 @@ hud_card( const hud_card & image):
|
||||||
// huds_bottom = options & HUDS_BOTTOM;
|
// huds_bottom = options & HUDS_BOTTOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
hud_card & hud_card ::
|
|
||||||
operator = (const hud_card & rhs )
|
hud_card & hud_card::operator=(const hud_card & rhs)
|
||||||
{
|
{
|
||||||
if (!(this == &rhs)) {
|
if (!(this == &rhs)) {
|
||||||
instr_scale::operator = (rhs);
|
instr_scale::operator = (rhs);
|
||||||
|
@ -153,18 +150,16 @@ operator = (const hud_card & rhs )
|
||||||
pointer_type = rhs.pointer_type;
|
pointer_type = rhs.pointer_type;
|
||||||
tick_type = rhs.tick_type;
|
tick_type = rhs.tick_type;
|
||||||
tick_length = rhs.tick_length;
|
tick_length = rhs.tick_length;
|
||||||
Maj_div = rhs.Maj_div; //suma
|
Maj_div = rhs.Maj_div;
|
||||||
Min_div = rhs.Min_div; //suma
|
Min_div = rhs.Min_div;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void hud_card ::
|
|
||||||
draw( void ) // (HUD_scale * pscale )
|
|
||||||
{
|
|
||||||
|
|
||||||
|
void hud_card::draw(void) // (HUD_scale * pscale)
|
||||||
|
{
|
||||||
float vmin = 0.0, vmax = 0.0;
|
float vmin = 0.0, vmax = 0.0;
|
||||||
float marker_xs;
|
float marker_xs;
|
||||||
float marker_xe;
|
float marker_xe;
|
||||||
|
@ -193,7 +188,6 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
height = scrn_rect.top + scrn_rect.bottom;
|
height = scrn_rect.top + scrn_rect.bottom;
|
||||||
width = scrn_rect.left + scrn_rect.right;
|
width = scrn_rect.left + scrn_rect.right;
|
||||||
|
|
||||||
//begin suma
|
|
||||||
// if type=gauge then display dial
|
// if type=gauge then display dial
|
||||||
if (type == "gauge") {
|
if (type == "gauge") {
|
||||||
float x,y;
|
float x,y;
|
||||||
|
@ -245,16 +239,15 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
else if (l<360)
|
else if (l<360)
|
||||||
textString(x-2.0, y, TextScale, 0);
|
textString(x-2.0, y, TextScale, 0);
|
||||||
}
|
}
|
||||||
|
} //end type=gauge
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//end type=gauge
|
|
||||||
} else {
|
} else {
|
||||||
// if its not explicitly a gauge default to tape
|
// if its not explicitly a gauge default to tape
|
||||||
if (pointer) {
|
if (pointer) {
|
||||||
if (pointer_type=="moving") {
|
if (pointer_type=="moving") {
|
||||||
vmin = minValue;
|
vmin = minValue;
|
||||||
vmax = maxValue;
|
vmax = maxValue;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// default to fixed
|
// default to fixed
|
||||||
vmin = cur_value - half_width_units; // width units == needle travel
|
vmin = cur_value - half_width_units; // width units == needle travel
|
||||||
|
@ -262,6 +255,7 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
text_x = mid_scr.x;
|
text_x = mid_scr.x;
|
||||||
text_y = mid_scr.y;
|
text_y = mid_scr.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
vmin = cur_value - half_width_units; // width units == needle travel
|
vmin = cur_value - half_width_units; // width units == needle travel
|
||||||
vmax = cur_value + half_width_units; // or picture unit span.
|
vmax = cur_value + half_width_units; // or picture unit span.
|
||||||
|
@ -278,6 +272,7 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
width,
|
width,
|
||||||
scrn_rect.top);
|
scrn_rect.top);
|
||||||
} // endif draw_tick_bottom
|
} // endif draw_tick_bottom
|
||||||
|
|
||||||
if (draw_tick_top) {
|
if (draw_tick_top) {
|
||||||
drawOneLine(scrn_rect.left, // Top tick bar
|
drawOneLine(scrn_rect.left, // Top tick bar
|
||||||
height,
|
height,
|
||||||
|
@ -310,7 +305,6 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
if (huds_left(options)) { // Calculate x marker offset
|
if (huds_left(options)) { // Calculate x marker offset
|
||||||
|
|
||||||
if (draw_cap_right) {
|
if (draw_cap_right) {
|
||||||
|
|
||||||
drawOneLine(marker_xe, scrn_rect.top,
|
drawOneLine(marker_xe, scrn_rect.top,
|
||||||
marker_xe, marker_ye); // Cap right side
|
marker_xe, marker_ye); // Cap right side
|
||||||
} //endif cap_right
|
} //endif cap_right
|
||||||
|
@ -326,11 +320,14 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
if (pointer) {
|
if (pointer) {
|
||||||
if (pointer_type=="moving") {
|
if (pointer_type=="moving") {
|
||||||
if (zoom == 0) {
|
if (zoom == 0) {
|
||||||
//Code for Moving Type Pointer included by suma.
|
//Code for Moving Type Pointer
|
||||||
float ycentre, ypoint,xpoint;
|
float ycentre, ypoint,xpoint;
|
||||||
int range,wth;
|
int range,wth;
|
||||||
if(cur_value > maxValue) cur_value = maxValue;
|
if (cur_value > maxValue)
|
||||||
if(cur_value < minValue) cur_value = minValue;
|
cur_value = maxValue;
|
||||||
|
if (cur_value < minValue)
|
||||||
|
cur_value = minValue;
|
||||||
|
|
||||||
if (minValue >= 0.0)
|
if (minValue >= 0.0)
|
||||||
ycentre = scrn_rect.top;
|
ycentre = scrn_rect.top;
|
||||||
else if (maxValue + minValue == 0.0)
|
else if (maxValue + minValue == 0.0)
|
||||||
|
@ -340,25 +337,28 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
ycentre = scrn_rect.top + (1.0-minValue)*scrn_rect.bottom/(maxValue-minValue);
|
ycentre = scrn_rect.top + (1.0-minValue)*scrn_rect.bottom/(maxValue-minValue);
|
||||||
else
|
else
|
||||||
ycentre = scrn_rect.top + minValue*scrn_rect.bottom/(maxValue-minValue);
|
ycentre = scrn_rect.top + minValue*scrn_rect.bottom/(maxValue-minValue);
|
||||||
|
|
||||||
range = scrn_rect.bottom;
|
range = scrn_rect.bottom;
|
||||||
wth = scrn_rect.left + scrn_rect.right;
|
wth = scrn_rect.left + scrn_rect.right;
|
||||||
|
|
||||||
if (oddtype == 1)
|
if (oddtype == 1)
|
||||||
ypoint = ycentre + ((cur_value-1.0) * range / val_span);
|
ypoint = ycentre + ((cur_value-1.0) * range / val_span);
|
||||||
else
|
else
|
||||||
ypoint = ycentre + (cur_value * range / val_span);
|
ypoint = ycentre + (cur_value * range / val_span);
|
||||||
|
|
||||||
xpoint = wth + marker_offset;
|
xpoint = wth + marker_offset;
|
||||||
drawOneLine(xpoint,ycentre,xpoint,ypoint);
|
drawOneLine(xpoint,ycentre,xpoint,ypoint);
|
||||||
drawOneLine(xpoint,ypoint,xpoint-marker_offset,ypoint);
|
drawOneLine(xpoint,ypoint,xpoint-marker_offset,ypoint);
|
||||||
drawOneLine(xpoint-marker_offset,ypoint,xpoint-5.0,ypoint+5.0);
|
drawOneLine(xpoint-marker_offset,ypoint,xpoint-5.0,ypoint+5.0);
|
||||||
drawOneLine(xpoint-marker_offset,ypoint,xpoint-5.0,ypoint-5.0);
|
drawOneLine(xpoint-marker_offset,ypoint,xpoint-5.0,ypoint-5.0);
|
||||||
} //zoom=0
|
} //zoom=0
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// default to fixed
|
// default to fixed
|
||||||
fixed(marker_offset+marker_xe, text_y + scrn_rect.right / 6,
|
fixed(marker_offset+marker_xe, text_y + scrn_rect.right / 6,
|
||||||
marker_offset+marker_xs, text_y,marker_offset+marker_xe,
|
marker_offset+marker_xs, text_y,marker_offset+marker_xe,
|
||||||
text_y - scrn_rect.right / 6);
|
text_y - scrn_rect.right / 6);
|
||||||
}//end pointer type
|
}//end pointer type
|
||||||
|
|
||||||
} //if pointer
|
} //if pointer
|
||||||
} //end vertical/left
|
} //end vertical/left
|
||||||
|
|
||||||
|
@ -382,7 +382,7 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
if (pointer_type == "moving") {
|
if (pointer_type == "moving") {
|
||||||
if (zoom == 0) {
|
if (zoom == 0) {
|
||||||
//type-fixed & zoom=1, behaviour to be defined
|
//type-fixed & zoom=1, behaviour to be defined
|
||||||
// Code for Moving Type Pointer included by suma.
|
// Code for Moving Type Pointer
|
||||||
float ycentre, ypoint,xpoint;
|
float ycentre, ypoint,xpoint;
|
||||||
int range;
|
int range;
|
||||||
|
|
||||||
|
@ -400,18 +400,21 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
ycentre = scrn_rect.top + (1.0-minValue)*scrn_rect.bottom/(maxValue-minValue);
|
ycentre = scrn_rect.top + (1.0-minValue)*scrn_rect.bottom/(maxValue-minValue);
|
||||||
else
|
else
|
||||||
ycentre = scrn_rect.top + minValue*scrn_rect.bottom/(maxValue-minValue);
|
ycentre = scrn_rect.top + minValue*scrn_rect.bottom/(maxValue-minValue);
|
||||||
|
|
||||||
range = scrn_rect.bottom;
|
range = scrn_rect.bottom;
|
||||||
|
|
||||||
if (oddtype == 1)
|
if (oddtype == 1)
|
||||||
ypoint = ycentre + ((cur_value-1.0) * range / val_span);
|
ypoint = ycentre + ((cur_value-1.0) * range / val_span);
|
||||||
else
|
else
|
||||||
ypoint = ycentre + (cur_value * range / val_span);
|
ypoint = ycentre + (cur_value * range / val_span);
|
||||||
|
|
||||||
xpoint = scrn_rect.left - marker_offset;
|
xpoint = scrn_rect.left - marker_offset;
|
||||||
drawOneLine(xpoint,ycentre,xpoint,ypoint);
|
drawOneLine(xpoint,ycentre,xpoint,ypoint);
|
||||||
drawOneLine(xpoint,ypoint,xpoint+marker_offset,ypoint);
|
drawOneLine(xpoint,ypoint,xpoint+marker_offset,ypoint);
|
||||||
drawOneLine(xpoint+marker_offset,ypoint,xpoint+5.0,ypoint+5.0);
|
drawOneLine(xpoint+marker_offset,ypoint,xpoint+5.0,ypoint+5.0);
|
||||||
drawOneLine(xpoint+marker_offset,ypoint,xpoint+5.0,ypoint-5.0);
|
drawOneLine(xpoint+marker_offset,ypoint,xpoint+5.0,ypoint-5.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// default to fixed
|
// default to fixed
|
||||||
fixed(-marker_offset+scrn_rect.left, text_y + scrn_rect.right / 6,
|
fixed(-marker_offset+scrn_rect.left, text_y + scrn_rect.right / 6,
|
||||||
|
@ -440,7 +443,7 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
i = (int)vmin; // N
|
i = (int)vmin; // N
|
||||||
|
|
||||||
if (zoom == 1) {
|
if (zoom == 1) {
|
||||||
zoomed_scale((int)vmin,(int)vmax); //suma
|
zoomed_scale((int)vmin, (int)vmax);
|
||||||
} else {
|
} else {
|
||||||
for (; i < last; i++) {
|
for (; i < last; i++) {
|
||||||
condition = true;
|
condition = true;
|
||||||
|
@ -452,14 +455,13 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
|
|
||||||
if (condition) { // Show a tick if necessary
|
if (condition) { // Show a tick if necessary
|
||||||
// Calculate the location of this tick
|
// Calculate the location of this tick
|
||||||
marker_ys = scrn_rect.top + (i - vmin) * factor()/*+.5f*/;
|
marker_ys = scrn_rect.top + ((i - vmin) * factor()/*+.5f*/);
|
||||||
// marker_ys = scrn_rect.top + (int)((i - vmin) * factor() + .5);
|
// marker_ys = scrn_rect.top + (int)((i - vmin) * factor() + .5);
|
||||||
// Block calculation artifact from drawing ticks below min coordinate.
|
// Block calculation artifact from drawing ticks below min coordinate.
|
||||||
// Calculation here accounts for text height.
|
// Calculation here accounts for text height.
|
||||||
|
|
||||||
if(( marker_ys < (scrn_rect.top + 4)) |
|
if ((marker_ys < (scrn_rect.top + 4))
|
||||||
( marker_ys > (height - 4)))
|
| (marker_ys > (height - 4))) {
|
||||||
{
|
|
||||||
// Magic numbers!!!
|
// Magic numbers!!!
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -473,8 +475,8 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
if (div_min()) {
|
if (div_min()) {
|
||||||
// if ((i%div_min()) == 0) {
|
// if ((i%div_min()) == 0) {
|
||||||
if (!(k%(int)div_min())) {
|
if (!(k%(int)div_min())) {
|
||||||
if((( marker_ys - 5) > scrn_rect.top ) &&
|
if (((marker_ys - 5) > scrn_rect.top)
|
||||||
(( marker_ys + 5) < (height))) {
|
&& ((marker_ys + 5) < (height))) {
|
||||||
|
|
||||||
//vertical/left OR vertical/right
|
//vertical/left OR vertical/right
|
||||||
if (huds_both(options)) {
|
if (huds_both(options)) {
|
||||||
|
@ -490,8 +492,8 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
drawOneLine(marker_xe, marker_ys,
|
drawOneLine(marker_xe, marker_ys,
|
||||||
width, marker_ys);
|
width, marker_ys);
|
||||||
}
|
}
|
||||||
} else if(tick_type=="circle") // begin suma this func. is written below
|
} else if (tick_type == "circle")
|
||||||
circles(scrn_rect.left,(float)marker_ys,3.0); //end suma
|
circles(scrn_rect.left,(float)marker_ys,3.0);
|
||||||
|
|
||||||
else {
|
else {
|
||||||
// if neither line nor circle draw default as line
|
// if neither line nor circle draw default as line
|
||||||
|
@ -507,6 +509,7 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
// glVertex2f(scrn_rect.left + scrn_rect.right, marker_ys);
|
// glVertex2f(scrn_rect.left + scrn_rect.right, marker_ys);
|
||||||
// glEnd();
|
// glEnd();
|
||||||
// anything other than huds_both
|
// anything other than huds_both
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (huds_left(options)) {
|
if (huds_left(options)) {
|
||||||
if (tick_type=="line") {
|
if (tick_type=="line") {
|
||||||
|
@ -517,8 +520,8 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
drawOneLine(marker_xs , marker_ys,
|
drawOneLine(marker_xs , marker_ys,
|
||||||
marker_xe, marker_ys);
|
marker_xe, marker_ys);
|
||||||
}
|
}
|
||||||
} else if(tick_type=="circle") // begin suma
|
} else if (tick_type=="circle")
|
||||||
circles((float)marker_xs + 4, (float)marker_ys,3.0); //end suma
|
circles((float)marker_xs + 4, (float)marker_ys,3.0);
|
||||||
|
|
||||||
else {
|
else {
|
||||||
drawOneLine(marker_xs + 4, marker_ys,
|
drawOneLine(marker_xs + 4, marker_ys,
|
||||||
|
@ -533,8 +536,8 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
drawOneLine(marker_xs, marker_ys,
|
drawOneLine(marker_xs, marker_ys,
|
||||||
marker_xe , marker_ys);
|
marker_xe , marker_ys);
|
||||||
}
|
}
|
||||||
} else if(tick_type=="circle") //begin suma
|
} else if (tick_type=="circle")
|
||||||
circles((float)marker_xe - 4, (float)marker_ys,3.0); //end suma
|
circles((float)marker_xe - 4, (float)marker_ys,3.0);
|
||||||
else {
|
else {
|
||||||
drawOneLine(marker_xs, marker_ys,
|
drawOneLine(marker_xs, marker_ys,
|
||||||
marker_xe - 4, marker_ys);
|
marker_xe - 4, marker_ys);
|
||||||
|
@ -547,7 +550,6 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
|
|
||||||
// Major ticks
|
// Major ticks
|
||||||
if (div_max()) {
|
if (div_max()) {
|
||||||
|
|
||||||
if (!(k%(int)div_max())) {
|
if (!(k%(int)div_max())) {
|
||||||
if (modulo()) {
|
if (modulo()) {
|
||||||
disp_val = i % (int) modulo(); // ?????????
|
disp_val = i % (int) modulo(); // ?????????
|
||||||
|
@ -563,7 +565,7 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
FloatToInt(disp_val * data_scaling()/*+.5*/));
|
FloatToInt(disp_val * data_scaling()/*+.5*/));
|
||||||
// (int)(disp_val * data_scaling() +.5));
|
// (int)(disp_val * data_scaling() +.5));
|
||||||
/* if (((marker_ys - 8) > scrn_rect.top) &&
|
/* if (((marker_ys - 8) > scrn_rect.top) &&
|
||||||
( (marker_ys + 8) < (height))){ */ //suma
|
((marker_ys + 8) < (height))){ */
|
||||||
// huds_both
|
// huds_both
|
||||||
if (huds_both(options)) {
|
if (huds_both(options)) {
|
||||||
// drawOneLine(scrn_rect.left, marker_ys,
|
// drawOneLine(scrn_rect.left, marker_ys,
|
||||||
|
@ -577,9 +579,9 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
glVertex2f(marker_xs, marker_ys);
|
glVertex2f(marker_xs, marker_ys);
|
||||||
glVertex2f(width, marker_ys);
|
glVertex2f(width, marker_ys);
|
||||||
glEnd();
|
glEnd();
|
||||||
} else if(tick_type=="circle") //begin suma
|
} else if (tick_type == "circle") {
|
||||||
circles(scrn_rect.left, (float)marker_ys,5.0); //end suma
|
circles(scrn_rect.left, (float)marker_ys,5.0);
|
||||||
else {
|
} else {
|
||||||
glBegin(GL_LINE_STRIP);
|
glBegin(GL_LINE_STRIP);
|
||||||
glVertex2f(scrn_rect.left, marker_ys);
|
glVertex2f(scrn_rect.left, marker_ys);
|
||||||
glVertex2f(marker_xs, marker_ys);
|
glVertex2f(marker_xs, marker_ys);
|
||||||
|
@ -591,17 +593,18 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
textString (marker_xs + 2, marker_ys,
|
textString (marker_xs + 2, marker_ys,
|
||||||
TextScale,0);
|
TextScale,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//begin suma
|
|
||||||
/* Changes are made to draw a circle when tick_type="circle" */
|
/* Changes are made to draw a circle when tick_type="circle" */
|
||||||
// anything other than huds_both
|
// anything other than huds_both
|
||||||
if (tick_type=="line") {
|
if (tick_type=="line") {
|
||||||
drawOneLine(marker_xs, marker_ys, marker_xe, marker_ys);
|
drawOneLine(marker_xs, marker_ys, marker_xe, marker_ys);
|
||||||
} else if(tick_type=="circle")
|
} else if (tick_type=="circle") {
|
||||||
circles((float)marker_xs + 4, (float)marker_ys,5.0);//end suma
|
circles((float)marker_xs + 4, (float)marker_ys,5.0);
|
||||||
else {
|
} else {
|
||||||
drawOneLine(marker_xs, marker_ys, marker_xe, marker_ys);
|
drawOneLine(marker_xs, marker_ys, marker_xe, marker_ys);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!huds_notext(options)) {
|
if (!huds_notext(options)) {
|
||||||
if (huds_left(options)) {
|
if (huds_left(options)) {
|
||||||
textString(marker_xs - 8 * lenstr - 2,
|
textString(marker_xs - 8 * lenstr - 2,
|
||||||
|
@ -620,6 +623,7 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
} // End for
|
} // End for
|
||||||
} //end of zoom
|
} //end of zoom
|
||||||
// End if VERTICAL SCALE TYPE (tape loop yet to be closed)
|
// End if VERTICAL SCALE TYPE (tape loop yet to be closed)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Horizontal scale by default
|
// Horizontal scale by default
|
||||||
// left tick bar
|
// left tick bar
|
||||||
|
@ -637,8 +641,7 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
marker_ys = scrn_rect.top; // Starting point for
|
marker_ys = scrn_rect.top; // Starting point for
|
||||||
marker_ye = height; // tick y location calcs
|
marker_ye = height; // tick y location calcs
|
||||||
marker_xe = width;
|
marker_xe = width;
|
||||||
marker_xs = scrn_rect.left + FloatToInt((cur_value - vmin) * factor() /*+ .5f*/);
|
marker_xs = scrn_rect.left + ((cur_value - vmin) * factor() /*+ .5f*/);
|
||||||
|
|
||||||
|
|
||||||
// glBegin(GL_LINES);
|
// glBegin(GL_LINES);
|
||||||
// left tick bar
|
// left tick bar
|
||||||
|
@ -670,11 +673,14 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
if (pointer) {
|
if (pointer) {
|
||||||
if (pointer_type == "moving") {
|
if (pointer_type == "moving") {
|
||||||
if (zoom == 0) {
|
if (zoom == 0) {
|
||||||
//Code for Moving Type Pointer included by suma.
|
//Code for Moving Type Pointer
|
||||||
// static float xcentre,xpoint,ypoint;
|
// static float xcentre,xpoint,ypoint;
|
||||||
// static int range;
|
// static int range;
|
||||||
if(cur_value > maxValue) cur_value = maxValue;
|
if (cur_value > maxValue)
|
||||||
if(cur_value < minValue) cur_value = minValue;
|
cur_value = maxValue;
|
||||||
|
if (cur_value < minValue)
|
||||||
|
cur_value = minValue;
|
||||||
|
|
||||||
float xcentre = mid_scr.x;
|
float xcentre = mid_scr.x;
|
||||||
int range = scrn_rect.right;
|
int range = scrn_rect.right;
|
||||||
float xpoint = xcentre + (cur_value * range / val_span);
|
float xpoint = xcentre + (cur_value * range / val_span);
|
||||||
|
@ -713,11 +719,14 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
if (pointer) {
|
if (pointer) {
|
||||||
if (pointer_type =="moving") {
|
if (pointer_type =="moving") {
|
||||||
if (zoom == 0) {
|
if (zoom == 0) {
|
||||||
//Code for Moving Type Pointer included by suma.
|
//Code for Moving Type Pointer
|
||||||
// static float xcentre,xpoint,ypoint;
|
// static float xcentre,xpoint,ypoint;
|
||||||
// static int range,hgt;
|
// static int range,hgt;
|
||||||
if(cur_value > maxValue) cur_value = maxValue;
|
if (cur_value > maxValue)
|
||||||
if(cur_value < minValue) cur_value = minValue;
|
cur_value = maxValue;
|
||||||
|
if (cur_value < minValue)
|
||||||
|
cur_value = minValue;
|
||||||
|
|
||||||
float xcentre = mid_scr.x ;
|
float xcentre = mid_scr.x ;
|
||||||
int range = scrn_rect.right;
|
int range = scrn_rect.right;
|
||||||
int hgt = scrn_rect.top + scrn_rect.bottom;
|
int hgt = scrn_rect.top + scrn_rect.bottom;
|
||||||
|
@ -747,7 +756,7 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
// i = FloatToInt(vmin);
|
// i = FloatToInt(vmin);
|
||||||
|
|
||||||
if (zoom == 1) {
|
if (zoom == 1) {
|
||||||
zoomed_scale((int)vmin,(int)vmax); //suma
|
zoomed_scale((int)vmin,(int)vmax);
|
||||||
} else {
|
} else {
|
||||||
//default to zoom=0
|
//default to zoom=0
|
||||||
last = (int)vmax + 1;
|
last = (int)vmax + 1;
|
||||||
|
@ -764,7 +773,7 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
// printf("<**> i = %d\n", i);
|
// printf("<**> i = %d\n", i);
|
||||||
if (condition) {
|
if (condition) {
|
||||||
// marker_xs = scrn_rect.left + (int)((i - vmin) * factor() + .5);
|
// marker_xs = scrn_rect.left + (int)((i - vmin) * factor() + .5);
|
||||||
marker_xs = scrn_rect.left + FloatToInt(((i - vmin) * factor()/*+ .5f*/));
|
marker_xs = scrn_rect.left + (((i - vmin) * factor()/*+ .5f*/));
|
||||||
|
|
||||||
if (oddtype == 1)
|
if (oddtype == 1)
|
||||||
k = i+1; //enable ticks at odd values
|
k = i+1; //enable ticks at odd values
|
||||||
|
@ -776,8 +785,8 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
//draw minor ticks
|
//draw minor ticks
|
||||||
if (!(k%(int)div_min())) {
|
if (!(k%(int)div_min())) {
|
||||||
// draw in ticks only if they aren't too close to the edge.
|
// draw in ticks only if they aren't too close to the edge.
|
||||||
if((( marker_xs - 5) > scrn_rect.left ) &&
|
if (((marker_xs - 5) > scrn_rect.left)
|
||||||
(( marker_xs + 5 )< (scrn_rect.left + scrn_rect.right))){
|
&& ((marker_xs + 5)< (scrn_rect.left + scrn_rect.right))) {
|
||||||
|
|
||||||
if (huds_both(options)) {
|
if (huds_both(options)) {
|
||||||
if (tick_length == "variable") {
|
if (tick_length == "variable") {
|
||||||
|
@ -797,6 +806,7 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
// glVertex2f(marker_xs, marker_ye + 4);
|
// glVertex2f(marker_xs, marker_ye + 4);
|
||||||
// glVertex2f(marker_xs, scrn_rect.top + scrn_rect.bottom);
|
// glVertex2f(marker_xs, scrn_rect.top + scrn_rect.bottom);
|
||||||
// glEnd();
|
// glEnd();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (huds_top(options)) {
|
if (huds_top(options)) {
|
||||||
//draw minor ticks
|
//draw minor ticks
|
||||||
|
@ -804,6 +814,7 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye-4);
|
drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye-4);
|
||||||
else
|
else
|
||||||
drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye);
|
drawOneLine(marker_xs,marker_ys,marker_xs,marker_ye);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
if (tick_length=="variable")
|
if (tick_length=="variable")
|
||||||
drawOneLine(marker_xs,marker_ys+4,marker_xs,marker_ye);
|
drawOneLine(marker_xs,marker_ys+4,marker_xs,marker_ye);
|
||||||
|
@ -813,11 +824,13 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
}
|
}
|
||||||
} //end draw minor ticks
|
} //end draw minor ticks
|
||||||
} //end minor ticks
|
} //end minor ticks
|
||||||
|
|
||||||
//major ticks
|
//major ticks
|
||||||
if (div_max()) {
|
if (div_max()) {
|
||||||
// printf("i = %d\n", i);
|
// printf("i = %d\n", i);
|
||||||
// if ((i%(int)div_max())==0) {
|
// if ((i%(int)div_max())==0) {
|
||||||
// draw major ticks
|
// draw major ticks
|
||||||
|
|
||||||
if (!(k%(int)div_max())) {
|
if (!(k%(int)div_max())) {
|
||||||
if (modulo()) {
|
if (modulo()) {
|
||||||
disp_val = i % (int) modulo(); // ?????????
|
disp_val = i % (int) modulo(); // ?????????
|
||||||
|
@ -833,9 +846,10 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
lenstr = sprintf(TextScale, "%d",
|
lenstr = sprintf(TextScale, "%d",
|
||||||
// (int)(disp_val * data_scaling() +.5));
|
// (int)(disp_val * data_scaling() +.5));
|
||||||
FloatToInt(disp_val * data_scaling()/*+.5*/));
|
FloatToInt(disp_val * data_scaling()/*+.5*/));
|
||||||
|
|
||||||
// Draw major ticks and text only if far enough from the edge.
|
// Draw major ticks and text only if far enough from the edge.
|
||||||
if(( (marker_xs - 10)> scrn_rect.left ) &&
|
if (((marker_xs - 10)> scrn_rect.left)
|
||||||
( (marker_xs + 10) < (scrn_rect.left + scrn_rect.right))){
|
&& ((marker_xs + 10) < (scrn_rect.left + scrn_rect.right))) {
|
||||||
if (huds_both(options)) {
|
if (huds_both(options)) {
|
||||||
// drawOneLine(marker_xs, scrn_rect.top,
|
// drawOneLine(marker_xs, scrn_rect.top,
|
||||||
// marker_xs, marker_ys);
|
// marker_xs, marker_ys);
|
||||||
|
@ -846,23 +860,22 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
glVertex2f(marker_xs, marker_ye);
|
glVertex2f(marker_xs, marker_ye);
|
||||||
glVertex2f(marker_xs, height);
|
glVertex2f(marker_xs, height);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
if (!huds_notext(options)) {
|
if (!huds_notext(options)) {
|
||||||
textString(marker_xs - 4 * lenstr,
|
textString(marker_xs - 4 * lenstr,
|
||||||
marker_ys + 4,
|
marker_ys + 4, TextScale, 0);
|
||||||
TextScale, 0 ); //suma
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
drawOneLine( marker_xs, marker_ys,
|
drawOneLine(marker_xs, marker_ys, marker_xs, marker_ye);
|
||||||
marker_xs, marker_ye );
|
|
||||||
if (!huds_notext(options)) {
|
if (!huds_notext(options)) {
|
||||||
if (huds_top(options)) {
|
if (huds_top(options)) {
|
||||||
textString(marker_xs - 4 * lenstr,
|
textString(marker_xs - 4 * lenstr,
|
||||||
height - 10,
|
height - 10, TextScale, 0);
|
||||||
TextScale, 0 ); //suma
|
|
||||||
} else {
|
} else {
|
||||||
textString(marker_xs - 4 * lenstr,
|
textString(marker_xs - 4 * lenstr,
|
||||||
scrn_rect.top,
|
scrn_rect.top, TextScale, 0);
|
||||||
TextScale, 0 ); //suma
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -877,10 +890,8 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
} //draw
|
} //draw
|
||||||
|
|
||||||
|
|
||||||
//begin suma
|
|
||||||
|
|
||||||
void hud_card ::
|
void hud_card::circles(float x,float y,float size)
|
||||||
circles(float x,float y,float size)
|
|
||||||
{
|
{
|
||||||
glEnable(GL_POINT_SMOOTH);
|
glEnable(GL_POINT_SMOOTH);
|
||||||
glPointSize(size);
|
glPointSize(size);
|
||||||
|
@ -893,10 +904,8 @@ circles(float x,float y,float size)
|
||||||
glDisable(GL_POINT_SMOOTH);
|
glDisable(GL_POINT_SMOOTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
//end suma
|
|
||||||
|
|
||||||
void hud_card ::
|
void hud_card::fixed(float x1, float y1, float x2, float y2, float x3, float y3)
|
||||||
fixed(float x1, float y1, float x2, float y2, float x3, float y3)
|
|
||||||
{
|
{
|
||||||
glBegin(GL_LINE_STRIP);
|
glBegin(GL_LINE_STRIP);
|
||||||
glVertex2f(x1, y1);
|
glVertex2f(x1, y1);
|
||||||
|
@ -906,10 +915,8 @@ fixed(float x1, float y1, float x2, float y2, float x3, float y3)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void hud_card ::
|
void hud_card::zoomed_scale(int first, int last)
|
||||||
zoomed_scale(int first, int last)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
POINT mid_scr = get_centroid();
|
POINT mid_scr = get_centroid();
|
||||||
RECT scrn_rect = get_location();
|
RECT scrn_rect = get_location();
|
||||||
UINT options = get_options();
|
UINT options = get_options();
|
||||||
|
@ -919,8 +926,10 @@ zoomed_scale(int first, int last)
|
||||||
|
|
||||||
float x,y,w,h,bottom;
|
float x,y,w,h,bottom;
|
||||||
float cur_value=get_value();
|
float cur_value=get_value();
|
||||||
if(cur_value > maxValue) cur_value = maxValue;
|
if (cur_value > maxValue)
|
||||||
if(cur_value < minValue) cur_value = minValue;
|
cur_value = maxValue;
|
||||||
|
if (cur_value < minValue)
|
||||||
|
cur_value = minValue;
|
||||||
|
|
||||||
int a=0;
|
int a=0;
|
||||||
|
|
||||||
|
@ -933,9 +942,7 @@ zoomed_scale(int first, int last)
|
||||||
}
|
}
|
||||||
int centre =a/2;
|
int centre =a/2;
|
||||||
|
|
||||||
|
|
||||||
if (huds_vert(options)) {
|
if (huds_vert(options)) {
|
||||||
|
|
||||||
x=scrn_rect.left;
|
x=scrn_rect.left;
|
||||||
y=scrn_rect.top;
|
y=scrn_rect.top;
|
||||||
w=scrn_rect.left+scrn_rect.right;
|
w=scrn_rect.left+scrn_rect.right;
|
||||||
|
@ -958,8 +965,6 @@ zoomed_scale(int first, int last)
|
||||||
int incr = incrs / 2;
|
int incr = incrs / 2;
|
||||||
float factors = hgt1 / incr;
|
float factors = hgt1 / incr;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// begin
|
// begin
|
||||||
//this is for moving type pointer
|
//this is for moving type pointer
|
||||||
static float ycent, ypoint,xpoint;
|
static float ycent, ypoint,xpoint;
|
||||||
|
@ -987,7 +992,6 @@ zoomed_scale(int first, int last)
|
||||||
ypoint = ycent - hgt - val;
|
ypoint = ycent - hgt - val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (cur_value > data[centre+1])
|
if (cur_value > data[centre+1])
|
||||||
if (cur_value <= maxValue) {
|
if (cur_value <= maxValue) {
|
||||||
float diff = maxValue - data[centre+1];
|
float diff = maxValue - data[centre+1];
|
||||||
|
@ -1031,11 +1035,11 @@ zoomed_scale(int first, int last)
|
||||||
if (!huds_notext(options))
|
if (!huds_notext(options))
|
||||||
textString (x, ysecond, TextScale, 0);
|
textString (x, ysecond, TextScale, 0);
|
||||||
|
|
||||||
|
|
||||||
yfirst -= factors;
|
yfirst -= factors;
|
||||||
ysecond += factors;
|
ysecond += factors;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//to draw moving type pointer for left option
|
//to draw moving type pointer for left option
|
||||||
//begin
|
//begin
|
||||||
xpoint = wth + 10.0;
|
xpoint = wth + 10.0;
|
||||||
|
@ -1101,6 +1105,7 @@ zoomed_scale(int first, int last)
|
||||||
//end
|
//end
|
||||||
}//end huds_right /left
|
}//end huds_right /left
|
||||||
//end of vertical scale
|
//end of vertical scale
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//horizontal scale
|
//horizontal scale
|
||||||
x=scrn_rect.left;
|
x=scrn_rect.left;
|
||||||
|
@ -1200,7 +1205,6 @@ zoomed_scale(int first, int last)
|
||||||
|
|
||||||
xfirst -= factors;
|
xfirst -= factors;
|
||||||
xsecond += factors;
|
xsecond += factors;
|
||||||
|
|
||||||
}
|
}
|
||||||
//this is for moving pointer for top option
|
//this is for moving pointer for top option
|
||||||
//begin
|
//begin
|
||||||
|
@ -1214,6 +1218,7 @@ zoomed_scale(int first, int last)
|
||||||
drawOneLine(xpoint,ypoint-10.0,xpoint-5.0,ypoint-5.0);
|
drawOneLine(xpoint,ypoint-10.0,xpoint-5.0,ypoint-5.0);
|
||||||
}
|
}
|
||||||
//end of top option
|
//end of top option
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//else huds_bottom
|
//else huds_bottom
|
||||||
ystart = (y + h) / 2;
|
ystart = (y + h) / 2;
|
||||||
|
@ -1265,11 +1270,8 @@ zoomed_scale(int first, int last)
|
||||||
drawOneLine(xpoint,ypoint+10.0,xpoint+5.0,ypoint+5.0);
|
drawOneLine(xpoint,ypoint+10.0,xpoint+5.0,ypoint+5.0);
|
||||||
drawOneLine(xpoint,ypoint+10.0,xpoint-5.0,ypoint+5.0);
|
drawOneLine(xpoint,ypoint+10.0,xpoint-5.0,ypoint+5.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//end
|
|
||||||
}//end hud_top or hud_bottom
|
}//end hud_top or hud_bottom
|
||||||
|
|
||||||
} //end of horizontal/vertical scales
|
} //end of horizontal/vertical scales
|
||||||
|
|
||||||
}//end draw
|
}//end draw
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,15 +3,15 @@
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_HUD_TextList
|
#ifdef USE_HUD_TextList
|
||||||
#define textString( x , y, text, digit ) TextString( text, x , y,digit ) //suma
|
#define textString( x , y, text, digit ) TextString( text, x , y,digit )
|
||||||
#else
|
#else
|
||||||
#define textString( x , y, text, digit ) puDrawString ( guiFnt, text, x, y ); //suma
|
#define textString( x , y, text, digit ) puDrawString ( guiFnt, text, x, y )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//============== Top of gauge_instr class member definitions ==============
|
//============== Top of gauge_instr class member definitions ==============
|
||||||
|
|
||||||
gauge_instr ::
|
gauge_instr::gauge_instr(
|
||||||
gauge_instr( int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
UINT width,
|
UINT width,
|
||||||
UINT height,
|
UINT height,
|
||||||
|
@ -45,13 +45,13 @@ gauge_instr( int x,
|
||||||
// huds_bottom = options & HUDS_BOTTOM;
|
// huds_bottom = options & HUDS_BOTTOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
gauge_instr ::
|
|
||||||
~gauge_instr()
|
gauge_instr::~gauge_instr()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
gauge_instr ::
|
|
||||||
gauge_instr( const gauge_instr & image):
|
gauge_instr::gauge_instr( const gauge_instr & image) :
|
||||||
instr_scale( (instr_scale &) image)
|
instr_scale( (instr_scale &) image)
|
||||||
{
|
{
|
||||||
// UINT options = get_options();
|
// UINT options = get_options();
|
||||||
|
@ -65,8 +65,8 @@ gauge_instr( const gauge_instr & image):
|
||||||
// huds_bottom = options & HUDS_BOTTOM;
|
// huds_bottom = options & HUDS_BOTTOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
gauge_instr & gauge_instr ::
|
|
||||||
operator = (const gauge_instr & rhs )
|
gauge_instr & gauge_instr::operator=(const gauge_instr & rhs)
|
||||||
{
|
{
|
||||||
if (!(this == &rhs)) {
|
if (!(this == &rhs)) {
|
||||||
instr_scale::operator = (rhs);
|
instr_scale::operator = (rhs);
|
||||||
|
@ -74,6 +74,7 @@ operator = (const gauge_instr & rhs )
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// As implemented, draw only correctly draws a horizontal or vertical
|
// As implemented, draw only correctly draws a horizontal or vertical
|
||||||
// scale. It should contain a variation that permits clock type displays.
|
// scale. It should contain a variation that permits clock type displays.
|
||||||
// Now is supports "tickless" displays such as control surface indicators.
|
// Now is supports "tickless" displays such as control surface indicators.
|
||||||
|
@ -82,8 +83,8 @@ operator = (const gauge_instr & rhs )
|
||||||
|
|
||||||
void gauge_instr::draw (void)
|
void gauge_instr::draw (void)
|
||||||
{
|
{
|
||||||
int marker_xs, marker_xe;
|
float marker_xs, marker_xe;
|
||||||
int marker_ys, marker_ye;
|
float marker_ys, marker_ye;
|
||||||
int text_x, text_y;
|
int text_x, text_y;
|
||||||
int width, height, bottom_4;
|
int width, height, bottom_4;
|
||||||
int lenstr;
|
int lenstr;
|
||||||
|
@ -123,7 +124,7 @@ void gauge_instr :: draw (void)
|
||||||
width,
|
width,
|
||||||
height);
|
height);
|
||||||
|
|
||||||
marker_xs = marker_xe - scrn_rect.right / 3; // Adjust tick xs
|
marker_xs = marker_xe - scrn_rect.right / 3.0; // Adjust tick xs
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( huds_right(options) ) { // Read right, so down left sides
|
if ( huds_right(options) ) { // Read right, so down left sides
|
||||||
|
@ -132,7 +133,7 @@ void gauge_instr :: draw (void)
|
||||||
scrn_rect.left,
|
scrn_rect.left,
|
||||||
height);
|
height);
|
||||||
|
|
||||||
marker_xe = scrn_rect.left + scrn_rect.right / 3; // Adjust tick xe
|
marker_xe = scrn_rect.left + scrn_rect.right / 3.0; // Adjust tick xe
|
||||||
}
|
}
|
||||||
|
|
||||||
// At this point marker x_start and x_end values are transposed.
|
// At this point marker x_start and x_end values are transposed.
|
||||||
|
@ -154,7 +155,7 @@ void gauge_instr :: draw (void)
|
||||||
// for ( i = (int)vmin; i <= (int)vmax; i++ ) {
|
// for ( i = (int)vmin; i <= (int)vmax; i++ ) {
|
||||||
|
|
||||||
// Calculate the location of this tick
|
// 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*/;
|
||||||
|
|
||||||
// We compute marker_ys even though we don't know if we will use
|
// We compute marker_ys even though we don't know if we will use
|
||||||
// either major or minor divisions. Simpler.
|
// either major or minor divisions. Simpler.
|
||||||
|
@ -206,15 +207,15 @@ void gauge_instr :: draw (void)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ( huds_left(options) ) {
|
if ( huds_left(options) ) {
|
||||||
text_x = marker_xs - lenstr;
|
text_x = FloatToInt(marker_xs - lenstr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
text_x = marker_xe - lenstr;
|
text_x = FloatToInt(marker_xe - lenstr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Now we know where to put the text.
|
// Now we know where to put the text.
|
||||||
text_y = marker_ys;
|
text_y = FloatToInt(marker_ys);
|
||||||
textString( text_x, text_y, TextScale, 0 ); //suma
|
textString( text_x, text_y, TextScale, 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} //
|
} //
|
||||||
|
@ -230,19 +231,20 @@ void gauge_instr :: draw (void)
|
||||||
if ( huds_right(options) ) {
|
if ( huds_right(options) ) {
|
||||||
glBegin(GL_LINE_STRIP);
|
glBegin(GL_LINE_STRIP);
|
||||||
glVertex2f( scrn_rect.left, text_y + 5);
|
glVertex2f( scrn_rect.left, text_y + 5);
|
||||||
glVertex2f( marker_xe, text_y);
|
glVertex2f( FloatToInt(marker_xe), text_y);
|
||||||
glVertex2f( scrn_rect.left, text_y - 5);
|
glVertex2f( scrn_rect.left, text_y - 5);
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
if ( huds_left(options) ) {
|
if ( huds_left(options) ) {
|
||||||
glBegin(GL_LINE_STRIP);
|
glBegin(GL_LINE_STRIP);
|
||||||
glVertex2f( width, text_y + 5);
|
glVertex2f( width, text_y + 5);
|
||||||
glVertex2f( marker_xs, text_y);
|
glVertex2f( FloatToInt(marker_xs), text_y);
|
||||||
glVertex2f( width, text_y - 5);
|
glVertex2f( width, text_y - 5);
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
} // End if VERTICAL SCALE TYPE
|
// End if VERTICAL SCALE TYPE
|
||||||
else { // Horizontal scale by default
|
|
||||||
|
} else { // Horizontal scale by default
|
||||||
drawOneLine( scrn_rect.left, // left tick bar
|
drawOneLine( scrn_rect.left, // left tick bar
|
||||||
scrn_rect.top,
|
scrn_rect.top,
|
||||||
scrn_rect.left,
|
scrn_rect.left,
|
||||||
|
@ -255,7 +257,7 @@ void gauge_instr :: draw (void)
|
||||||
|
|
||||||
marker_ys = scrn_rect.top; // Starting point for
|
marker_ys = scrn_rect.top; // Starting point for
|
||||||
marker_ye = height; // tick y location calcs
|
marker_ye = height; // tick y location calcs
|
||||||
marker_xs = scrn_rect.left + FloatToInt((cur_value - vmin) * factor() /*+ .5f*/);
|
marker_xs = scrn_rect.left + (cur_value - vmin) * factor() /*+ .5f*/;
|
||||||
|
|
||||||
if ( huds_top(options) ) {
|
if ( huds_top(options) ) {
|
||||||
drawOneLine( scrn_rect.left,
|
drawOneLine( scrn_rect.left,
|
||||||
|
@ -263,7 +265,7 @@ void gauge_instr :: draw (void)
|
||||||
width,
|
width,
|
||||||
scrn_rect.top); // Bottom box line
|
scrn_rect.top); // Bottom box line
|
||||||
|
|
||||||
marker_ye = scrn_rect.top + scrn_rect.bottom / 2; // Tick point adjust
|
marker_ye = scrn_rect.top + scrn_rect.bottom / 2.0; // Tick point adjust
|
||||||
// Bottom arrow
|
// Bottom arrow
|
||||||
glBegin(GL_LINE_STRIP);
|
glBegin(GL_LINE_STRIP);
|
||||||
glVertex2f( marker_xs - bottom_4, scrn_rect.top);
|
glVertex2f( marker_xs - bottom_4, scrn_rect.top);
|
||||||
|
@ -275,7 +277,7 @@ void gauge_instr :: draw (void)
|
||||||
// Top box line
|
// Top box line
|
||||||
drawOneLine( scrn_rect.left, height, width, height);
|
drawOneLine( scrn_rect.left, height, width, height);
|
||||||
// Tick point adjust
|
// Tick point adjust
|
||||||
marker_ys = height - scrn_rect.bottom / 2;
|
marker_ys = height - scrn_rect.bottom / 2.0;
|
||||||
|
|
||||||
// Top arrow
|
// Top arrow
|
||||||
glBegin(GL_LINE_STRIP);
|
glBegin(GL_LINE_STRIP);
|
||||||
|
@ -296,7 +298,7 @@ void gauge_instr :: draw (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( condition ) {
|
if ( condition ) {
|
||||||
marker_xs = scrn_rect.left + FloatToInt((i - vmin) * factor()/* +.5f*/);
|
marker_xs = scrn_rect.left + (i - vmin) * factor()/* +.5f*/;
|
||||||
// marker_xs = scrn_rect.left + (int)((i - vmin) * factor() + .5f);
|
// marker_xs = scrn_rect.left + (int)((i - vmin) * factor() + .5f);
|
||||||
if ( div_min()){
|
if ( div_min()){
|
||||||
if ( !(i%(int)div_min()) ) {
|
if ( !(i%(int)div_min()) ) {
|
||||||
|
@ -350,7 +352,7 @@ void gauge_instr :: draw (void)
|
||||||
|
|
||||||
if ( !huds_notext(options) ) {
|
if ( !huds_notext(options) ) {
|
||||||
textString ( marker_xs - lenstr, marker_ys + 4,
|
textString ( marker_xs - lenstr, marker_ys + 4,
|
||||||
TextScale ,0); //suma
|
TextScale ,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -361,11 +363,11 @@ void gauge_instr :: draw (void)
|
||||||
if ( huds_top(options) ) {
|
if ( huds_top(options) ) {
|
||||||
textString ( marker_xs - lenstr,
|
textString ( marker_xs - lenstr,
|
||||||
height - 10,
|
height - 10,
|
||||||
TextScale, 0 ); //suma
|
TextScale, 0 );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
textString( marker_xs - lenstr, scrn_rect.top,
|
textString( marker_xs - lenstr, scrn_rect.top,
|
||||||
TextScale, 0 ); //suma
|
TextScale, 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue