Fixed some warnings, updated whitespace.
This commit is contained in:
parent
3d0ed99651
commit
d0126ec533
5 changed files with 515 additions and 524 deletions
|
@ -714,7 +714,7 @@ void fgCockpitUpdate( void ) {
|
||||||
int iwidth = xsize_node->getIntValue();
|
int iwidth = xsize_node->getIntValue();
|
||||||
int iheight = ysize_node->getIntValue();
|
int iheight = ysize_node->getIntValue();
|
||||||
float width = iwidth;
|
float width = iwidth;
|
||||||
float height = iheight;
|
// float height = iheight;
|
||||||
|
|
||||||
// FIXME: inefficient
|
// FIXME: inefficient
|
||||||
if ( hud_visibility_node->getBoolValue() ) {
|
if ( hud_visibility_node->getBoolValue() ) {
|
||||||
|
|
|
@ -831,131 +831,132 @@ static puSlider *HUDalphaHS0;
|
||||||
static char SliderText[2][ 8 ];
|
static char SliderText[2][ 8 ];
|
||||||
|
|
||||||
static void alpha_adj( puObject *hs ) {
|
static void alpha_adj( puObject *hs ) {
|
||||||
float val ;
|
float val ;
|
||||||
|
|
||||||
hs-> getValue ( &val ) ;
|
hs-> getValue ( &val ) ;
|
||||||
fgAP_CLAMP ( val, 0.1, 1.0 ) ;
|
fgAP_CLAMP ( val, 0.1, 1.0 ) ;
|
||||||
// printf ( "maxroll_adj( %p ) %f %f\n", hs, val, MaxRollAdjust * val ) ;
|
// printf ( "maxroll_adj( %p ) %f %f\n", hs, val, MaxRollAdjust * val ) ;
|
||||||
hud_trans_alpha = val;
|
hud_trans_alpha = val;
|
||||||
sprintf( SliderText[ 0 ], "%05.2f", hud_trans_alpha );
|
sprintf( SliderText[ 0 ], "%05.2f", hud_trans_alpha );
|
||||||
HUDalphaText -> setLabel ( SliderText[ 0 ] ) ;
|
HUDalphaText -> setLabel ( SliderText[ 0 ] ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fgHUDalphaAdjust( puObject * ) {
|
void fgHUDalphaAdjust( puObject * ) {
|
||||||
fgSetBool("/sim/hud/antialiased", true);
|
fgSetBool("/sim/hud/antialiased", true);
|
||||||
FG_PUSH_PUI_DIALOG( HUDalphaDialog );
|
FG_PUSH_PUI_DIALOG( HUDalphaDialog );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void goAwayHUDalphaAdjust (puObject *)
|
static void goAwayHUDalphaAdjust (puObject *)
|
||||||
{
|
{
|
||||||
FG_POP_PUI_DIALOG( HUDalphaDialog );
|
FG_POP_PUI_DIALOG( HUDalphaDialog );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cancelHUDalphaAdjust (puObject *)
|
static void cancelHUDalphaAdjust (puObject *)
|
||||||
{
|
{
|
||||||
fgSetBool("/sim/hud/antialiased", false);
|
fgSetBool("/sim/hud/antialiased", false);
|
||||||
FG_POP_PUI_DIALOG( HUDalphaDialog );
|
FG_POP_PUI_DIALOG( HUDalphaDialog );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done once at system initialization
|
// Done once at system initialization
|
||||||
void fgHUDalphaInit( void ) {
|
void fgHUDalphaInit( void ) {
|
||||||
|
|
||||||
// printf("fgHUDalphaInit\n");
|
// printf("fgHUDalphaInit\n");
|
||||||
#define HORIZONTAL FALSE
|
#define HORIZONTAL FALSE
|
||||||
|
|
||||||
int DialogX = 40;
|
int DialogX = 40;
|
||||||
int DialogY = 100;
|
int DialogY = 100;
|
||||||
int DialogWidth = 240;
|
int DialogWidth = 240;
|
||||||
|
|
||||||
char Label[] = "HUD Adjuster";
|
char Label[] = "HUD Adjuster";
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
int labelX = (DialogWidth / 2) -
|
int labelX = (DialogWidth / 2) -
|
||||||
(puGetStringWidth( puGetDefaultLabelFont(), Label ) / 2);
|
(puGetStringWidth( puGetDefaultLabelFont(), Label ) / 2);
|
||||||
|
|
||||||
int nSliders = 1;
|
int nSliders = 1;
|
||||||
int slider_x = 10;
|
int slider_x = 10;
|
||||||
int slider_y = 55;
|
int slider_y = 55;
|
||||||
int slider_width = 220;
|
int slider_width = 220;
|
||||||
int slider_title_x = 15;
|
int slider_title_x = 15;
|
||||||
int slider_value_x = 160;
|
int slider_value_x = 160;
|
||||||
float slider_delta = 0.05f;
|
float slider_delta = 0.05f;
|
||||||
|
|
||||||
puFont HUDalphaLegendFont;
|
puFont HUDalphaLegendFont;
|
||||||
puFont HUDalphaLabelFont;
|
puFont HUDalphaLabelFont;
|
||||||
puGetDefaultFonts ( &HUDalphaLegendFont, &HUDalphaLabelFont );
|
puGetDefaultFonts ( &HUDalphaLegendFont, &HUDalphaLabelFont );
|
||||||
|
|
||||||
HUDalphaDialog = new puDialogBox ( DialogX, DialogY ); {
|
HUDalphaDialog = new puDialogBox ( DialogX, DialogY ); {
|
||||||
int horiz_slider_height = puGetStringHeight (HUDalphaLabelFont) +
|
int horiz_slider_height = puGetStringHeight (HUDalphaLabelFont) +
|
||||||
puGetStringDescender (HUDalphaLabelFont) +
|
puGetStringDescender (HUDalphaLabelFont) +
|
||||||
PUSTR_TGAP + PUSTR_BGAP + 5;
|
PUSTR_TGAP + PUSTR_BGAP + 5;
|
||||||
|
|
||||||
puFrame *
|
/* puFrame *
|
||||||
HUDalphaFrame = new puFrame ( 0, 0,
|
HUDalphaFrame = new puFrame ( 0, 0, DialogWidth,
|
||||||
DialogWidth,
|
85 + nSliders
|
||||||
85 + nSliders * horiz_slider_height );
|
* horiz_slider_height ); */
|
||||||
|
|
||||||
puText *
|
puText *
|
||||||
HUDalphaDialogMessage = new puText ( labelX,
|
HUDalphaDialogMessage = new puText ( labelX,
|
||||||
52 + nSliders
|
52 + nSliders
|
||||||
* horiz_slider_height );
|
* horiz_slider_height );
|
||||||
HUDalphaDialogMessage -> setDefaultValue ( Label );
|
HUDalphaDialogMessage -> setDefaultValue ( Label );
|
||||||
HUDalphaDialogMessage -> getDefaultValue ( &s );
|
HUDalphaDialogMessage -> getDefaultValue ( &s );
|
||||||
HUDalphaDialogMessage -> setLabel ( s );
|
HUDalphaDialogMessage -> setLabel ( s );
|
||||||
|
|
||||||
HUDalphaHS0 = new puSlider ( slider_x, slider_y,
|
HUDalphaHS0 = new puSlider ( slider_x, slider_y,
|
||||||
slider_width, HORIZONTAL ) ;
|
slider_width, HORIZONTAL ) ;
|
||||||
HUDalphaHS0-> setDelta ( slider_delta ) ;
|
HUDalphaHS0-> setDelta ( slider_delta ) ;
|
||||||
HUDalphaHS0-> setValue ( hud_trans_alpha ) ;
|
HUDalphaHS0-> setValue ( hud_trans_alpha ) ;
|
||||||
HUDalphaHS0-> setCBMode ( PUSLIDER_DELTA ) ;
|
HUDalphaHS0-> setCBMode ( PUSLIDER_DELTA ) ;
|
||||||
HUDalphaHS0-> setCallback ( alpha_adj ) ;
|
HUDalphaHS0-> setCallback ( alpha_adj ) ;
|
||||||
|
|
||||||
puText *
|
puText *
|
||||||
HUDalphaTitle = new puText ( slider_title_x, slider_y ) ;
|
HUDalphaTitle = new puText ( slider_title_x, slider_y ) ;
|
||||||
HUDalphaTitle-> setDefaultValue ( "Alpha" ) ;
|
HUDalphaTitle-> setDefaultValue ( "Alpha" ) ;
|
||||||
HUDalphaTitle-> getDefaultValue ( &s ) ;
|
HUDalphaTitle-> getDefaultValue ( &s ) ;
|
||||||
HUDalphaTitle-> setLabel ( s ) ;
|
HUDalphaTitle-> setLabel ( s ) ;
|
||||||
|
|
||||||
HUDalphaText = new puText ( slider_value_x, slider_y ) ;
|
HUDalphaText = new puText ( slider_value_x, slider_y ) ;
|
||||||
sprintf( SliderText[ 0 ], "%05.2f", hud_trans_alpha );
|
sprintf( SliderText[ 0 ], "%05.2f", hud_trans_alpha );
|
||||||
HUDalphaText-> setLabel ( SliderText[ 0 ] ) ;
|
HUDalphaText-> setLabel ( SliderText[ 0 ] ) ;
|
||||||
|
|
||||||
|
puOneShot *
|
||||||
|
HUDalphaOkButton = new puOneShot ( 10, 10, 60, 45 );
|
||||||
|
HUDalphaOkButton-> setLegend ( gui_msg_OK );
|
||||||
|
HUDalphaOkButton-> makeReturnDefault ( TRUE );
|
||||||
|
HUDalphaOkButton-> setCallback ( goAwayHUDalphaAdjust );
|
||||||
|
|
||||||
puOneShot *
|
puOneShot *
|
||||||
HUDalphaOkButton = new puOneShot ( 10, 10, 60, 45 );
|
HUDalphaNoButton = new puOneShot ( 160, 10, 230, 45 );
|
||||||
HUDalphaOkButton-> setLegend ( gui_msg_OK );
|
HUDalphaNoButton-> setLegend ( gui_msg_CANCEL );
|
||||||
HUDalphaOkButton-> makeReturnDefault ( TRUE );
|
HUDalphaNoButton-> setCallback ( cancelHUDalphaAdjust );
|
||||||
HUDalphaOkButton-> setCallback ( goAwayHUDalphaAdjust );
|
}
|
||||||
|
FG_FINALIZE_PUI_DIALOG( HUDalphaDialog );
|
||||||
puOneShot *
|
|
||||||
HUDalphaNoButton = new puOneShot ( 160, 10, 230, 45 );
|
|
||||||
HUDalphaNoButton-> setLegend ( gui_msg_CANCEL );
|
|
||||||
HUDalphaNoButton-> setCallback ( cancelHUDalphaAdjust );
|
|
||||||
}
|
|
||||||
FG_FINALIZE_PUI_DIALOG( HUDalphaDialog );
|
|
||||||
|
|
||||||
#undef HORIZONTAL
|
#undef HORIZONTAL
|
||||||
}
|
}
|
||||||
|
|
||||||
void fgHUDReshape(void) {
|
|
||||||
if ( HUDtext )
|
|
||||||
delete HUDtext;
|
|
||||||
|
|
||||||
HUD_TextSize = fgGetInt("/sim/startup/xsize") / 60;
|
void fgHUDReshape(void) {
|
||||||
HUD_TextSize = 10;
|
if ( HUDtext )
|
||||||
HUDtext = new fntRenderer();
|
delete HUDtext;
|
||||||
HUDtext -> setFont ( guiFntHandle ) ;
|
|
||||||
HUDtext -> setPointSize ( HUD_TextSize ) ;
|
HUD_TextSize = fgGetInt("/sim/startup/xsize") / 60;
|
||||||
HUD_TextList.setFont( HUDtext );
|
HUD_TextSize = 10;
|
||||||
|
HUDtext = new fntRenderer();
|
||||||
|
HUDtext -> setFont ( guiFntHandle ) ;
|
||||||
|
HUDtext -> setPointSize ( HUD_TextSize ) ;
|
||||||
|
HUD_TextList.setFont( HUDtext );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void set_hud_color(float r, float g, float b) {
|
static void set_hud_color(float r, float g, float b) {
|
||||||
fgGetBool("/sim/hud/antialiased") ?
|
fgGetBool("/sim/hud/antialiased") ?
|
||||||
glColor4f(r,g,b,hud_trans_alpha) :
|
glColor4f(r,g,b,hud_trans_alpha) :
|
||||||
glColor3f(r,g,b);
|
glColor3f(r,g,b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// fgUpdateHUD
|
// fgUpdateHUD
|
||||||
//
|
//
|
||||||
// Performs a once around the list of calls to instruments installed in
|
// Performs a once around the list of calls to instruments installed in
|
||||||
|
|
|
@ -74,21 +74,21 @@ hud_card ::
|
||||||
|
|
||||||
hud_card ::
|
hud_card ::
|
||||||
hud_card( const hud_card & image):
|
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),
|
||||||
half_width_units (image.half_width_units),
|
type(image.type),
|
||||||
draw_tick_bottom (image.draw_tick_bottom),
|
half_width_units (image.half_width_units),
|
||||||
draw_tick_top (image.draw_tick_top),
|
draw_tick_bottom (image.draw_tick_bottom),
|
||||||
draw_tick_right (image.draw_tick_right),
|
draw_tick_top (image.draw_tick_top),
|
||||||
draw_tick_left (image.draw_tick_left),
|
draw_tick_right (image.draw_tick_right),
|
||||||
draw_cap_bottom (image.draw_cap_bottom),
|
draw_tick_left (image.draw_tick_left),
|
||||||
draw_cap_top (image.draw_cap_top),
|
draw_cap_bottom (image.draw_cap_bottom),
|
||||||
draw_cap_right (image.draw_cap_right),
|
draw_cap_top (image.draw_cap_top),
|
||||||
draw_cap_left (image.draw_cap_left),
|
draw_cap_right (image.draw_cap_right),
|
||||||
marker_offset (image.marker_offset),
|
draw_cap_left (image.draw_cap_left),
|
||||||
type(image.type),
|
marker_offset (image.marker_offset),
|
||||||
pointer (image.pointer),
|
pointer (image.pointer),
|
||||||
pointer_type (image.pointer_type)
|
pointer_type (image.pointer_type)
|
||||||
|
|
||||||
{
|
{
|
||||||
// UINT options = get_options();
|
// UINT options = get_options();
|
||||||
|
@ -104,10 +104,10 @@ hud_card( const hud_card & image):
|
||||||
hud_card & hud_card ::
|
hud_card & hud_card ::
|
||||||
operator = (const hud_card & rhs )
|
operator = (const hud_card & rhs )
|
||||||
{
|
{
|
||||||
if( !( this == &rhs)){
|
if( !( this == &rhs)){
|
||||||
instr_scale::operator = (rhs);
|
instr_scale::operator = (rhs);
|
||||||
val_span = rhs.val_span;
|
val_span = rhs.val_span;
|
||||||
half_width_units = rhs.half_width_units;
|
half_width_units = rhs.half_width_units;
|
||||||
draw_tick_bottom = rhs.draw_tick_bottom;
|
draw_tick_bottom = rhs.draw_tick_bottom;
|
||||||
draw_tick_top = rhs.draw_tick_top;
|
draw_tick_top = rhs.draw_tick_top;
|
||||||
draw_tick_right = rhs.draw_tick_right;
|
draw_tick_right = rhs.draw_tick_right;
|
||||||
|
@ -120,79 +120,75 @@ operator = (const hud_card & rhs )
|
||||||
type = rhs.type;
|
type = rhs.type;
|
||||||
pointer = rhs.pointer;
|
pointer = rhs.pointer;
|
||||||
pointer_type = rhs.pointer_type;
|
pointer_type = rhs.pointer_type;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
return *this;
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void hud_card ::
|
void hud_card ::
|
||||||
draw( void ) // (HUD_scale * pscale )
|
draw( void ) // (HUD_scale * pscale )
|
||||||
{
|
{
|
||||||
|
|
||||||
float vmin, vmax;
|
float vmin = 0.0, vmax = 0.0;
|
||||||
int marker_xs;
|
int marker_xs;
|
||||||
int marker_xe;
|
int marker_xe;
|
||||||
int marker_ys;
|
int marker_ys;
|
||||||
int marker_ye;
|
int marker_ye;
|
||||||
int text_x, text_y;
|
int text_x = 0, text_y = 0;
|
||||||
int lenstr;
|
int lenstr;
|
||||||
int height, width;
|
int height, width;
|
||||||
int i, last;
|
int i, last;
|
||||||
char TextScale[80];
|
char TextScale[80];
|
||||||
bool condition;
|
bool condition;
|
||||||
int disp_val = 0;
|
int disp_val = 0;
|
||||||
|
|
||||||
|
POINT mid_scr = get_centroid();
|
||||||
|
float cur_value = get_value();
|
||||||
|
RECT scrn_rect = get_location();
|
||||||
|
UINT options = get_options();
|
||||||
|
|
||||||
POINT mid_scr = get_centroid();
|
height = scrn_rect.top + scrn_rect.bottom;
|
||||||
float cur_value = get_value();
|
width = scrn_rect.left + scrn_rect.right;
|
||||||
RECT scrn_rect = get_location();
|
|
||||||
UINT options = get_options();
|
|
||||||
|
|
||||||
height = scrn_rect.top + scrn_rect.bottom;
|
if(type=="guage") {
|
||||||
width = scrn_rect.left + scrn_rect.right;
|
|
||||||
|
|
||||||
|
vmin = min_val();
|
||||||
|
vmax = max_val();
|
||||||
|
text_y = scrn_rect.top + FloatToInt((cur_value - vmin) * factor() /*+.5f*/);
|
||||||
|
text_x = marker_xs;
|
||||||
|
} else {
|
||||||
|
if(type=="tape") {
|
||||||
|
|
||||||
|
vmin = cur_value - half_width_units; // width units == needle travel
|
||||||
|
vmax = cur_value + half_width_units; // or picture unit span.
|
||||||
|
text_x = mid_scr.x;
|
||||||
|
text_y = mid_scr.y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(type=="guage") {
|
// Draw the basic markings for the scale...
|
||||||
|
|
||||||
vmin = min_val();
|
if( huds_vert(options) ) { // Vertical scale
|
||||||
vmax = max_val();
|
if (draw_tick_bottom) {
|
||||||
text_y = scrn_rect.top + FloatToInt((cur_value - vmin) * factor() /*+.5f*/);
|
drawOneLine( scrn_rect.left, // Bottom tick bar
|
||||||
text_x = marker_xs;
|
scrn_rect.top,
|
||||||
}
|
width,
|
||||||
else
|
scrn_rect.top);
|
||||||
if(type=="tape") {
|
} // endif draw_tick_bottom
|
||||||
|
if (draw_tick_top) {
|
||||||
|
drawOneLine( scrn_rect.left, // Top tick bar
|
||||||
|
height,
|
||||||
|
width,
|
||||||
|
height );
|
||||||
|
} // endif draw_tick_top
|
||||||
|
|
||||||
vmin = cur_value - half_width_units; // width units == needle travel
|
marker_xs = scrn_rect.left; // x start
|
||||||
vmax = cur_value + half_width_units; // or picture unit span.
|
marker_xe = width; // x extent
|
||||||
text_x = mid_scr.x;
|
marker_ye = height;
|
||||||
text_y = mid_scr.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Draw the basic markings for the scale...
|
|
||||||
|
|
||||||
if( huds_vert(options) ) { // Vertical scale
|
|
||||||
if (draw_tick_bottom) {
|
|
||||||
drawOneLine( scrn_rect.left, // Bottom tick bar
|
|
||||||
scrn_rect.top,
|
|
||||||
width,
|
|
||||||
scrn_rect.top);
|
|
||||||
} // endif draw_tick_bottom
|
|
||||||
if (draw_tick_top) {
|
|
||||||
drawOneLine( scrn_rect.left, // Top tick bar
|
|
||||||
height,
|
|
||||||
width,
|
|
||||||
height );
|
|
||||||
} // endif draw_tick_top
|
|
||||||
|
|
||||||
marker_xs = scrn_rect.left; // x start
|
|
||||||
marker_xe = width; // x extent
|
|
||||||
marker_ye = height;
|
|
||||||
|
|
||||||
// glBegin(GL_LINES);
|
// glBegin(GL_LINES);
|
||||||
|
|
||||||
// Bottom tick bar
|
// Bottom tick bar
|
||||||
// glVertex2f( marker_xs, scrn_rect.top);
|
// glVertex2f( marker_xs, scrn_rect.top);
|
||||||
// glVertex2f( marker_xe, scrn_rect.top);
|
// glVertex2f( marker_xe, scrn_rect.top);
|
||||||
|
|
||||||
|
@ -202,212 +198,208 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
// glEnd();
|
// glEnd();
|
||||||
|
|
||||||
|
|
||||||
// We do not use else in the following so that combining the two
|
// We do not use else in the following so that combining the
|
||||||
// options produces a "caged" display with double carrots. The
|
// two options produces a "caged" display with double
|
||||||
// same is done for horizontal card indicators.
|
// carrots. The same is done for horizontal card indicators.
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
marker_xs = marker_xe - scrn_rect.right / 3; // Adjust tick xs
|
marker_xs = marker_xe - scrn_rect.right / 3; // Adjust tick xs
|
||||||
|
|
||||||
// drawOneLine( marker_xs, mid_scr.y,
|
// drawOneLine( marker_xs, mid_scr.y,
|
||||||
// marker_xe, mid_scr.y + scrn_rect.right / 6);
|
// marker_xe, mid_scr.y + scrn_rect.right / 6);
|
||||||
// drawOneLine( marker_xs, mid_scr.y,
|
// drawOneLine( marker_xs, mid_scr.y,
|
||||||
// marker_xe, mid_scr.y - scrn_rect.right / 6);
|
// marker_xe, mid_scr.y - scrn_rect.right / 6);
|
||||||
|
|
||||||
// draw pointer
|
// draw pointer
|
||||||
if(pointer) {
|
if(pointer) {
|
||||||
if(pointer_type=="fixed") {
|
if(pointer_type=="fixed") {
|
||||||
glBegin(GL_LINE_STRIP);
|
glBegin(GL_LINE_STRIP);
|
||||||
glVertex2f( marker_offset+marker_xe, text_y + scrn_rect.right / 6);
|
glVertex2f( marker_offset+marker_xe, text_y + scrn_rect.right / 6);
|
||||||
glVertex2f( marker_offset+marker_xs, text_y);
|
glVertex2f( marker_offset+marker_xs, text_y);
|
||||||
glVertex2f( marker_offset+marker_xe, text_y - scrn_rect.right / 6);
|
glVertex2f( marker_offset+marker_xe, text_y - scrn_rect.right / 6);
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
} else {
|
||||||
else
|
if(pointer_type=="moving") {
|
||||||
if(pointer_type=="moving") {
|
//Code for Moving Type Pointer to be included.
|
||||||
//Code for Moving Type Pointer to be included.
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
if( huds_right(options) ) { // We'll default this for now.
|
||||||
|
if (draw_cap_left) {
|
||||||
|
drawOneLine( scrn_rect.left, scrn_rect.top,
|
||||||
|
scrn_rect.left, marker_ye ); // Cap left side
|
||||||
|
} //endif cap_left
|
||||||
|
|
||||||
if( huds_right(options) ) { // We'll default this for now.
|
marker_xe = scrn_rect.left + scrn_rect.right / 3; // Adjust tick xe
|
||||||
if (draw_cap_left) {
|
// Indicator carrot
|
||||||
drawOneLine( scrn_rect.left, scrn_rect.top,
|
// drawOneLine( scrn_rect.left, mid_scr.y + scrn_rect.right / 6,
|
||||||
scrn_rect.left, marker_ye ); // Cap left side
|
// marker_xe, mid_scr.y );
|
||||||
} //endif cap_left
|
// drawOneLine( scrn_rect.left, mid_scr.y - scrn_rect.right / 6,
|
||||||
|
// marker_xe, mid_scr.y);
|
||||||
|
|
||||||
marker_xe = scrn_rect.left + scrn_rect.right / 3; // Adjust tick xe
|
// draw pointer
|
||||||
// Indicator carrot
|
if(pointer) {
|
||||||
// drawOneLine( scrn_rect.left, mid_scr.y + scrn_rect.right / 6,
|
if(pointer_type=="fixed") {
|
||||||
// marker_xe, mid_scr.y );
|
glBegin(GL_LINE_STRIP);
|
||||||
// drawOneLine( scrn_rect.left, mid_scr.y - scrn_rect.right / 6,
|
glVertex2f( -marker_offset+scrn_rect.left, text_y + scrn_rect.right / 6);
|
||||||
// marker_xe, mid_scr.y);
|
glVertex2f( -marker_offset+marker_xe, text_y );
|
||||||
|
glVertex2f( -marker_offset+scrn_rect.left, text_y - scrn_rect.right / 6);
|
||||||
|
glEnd();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(pointer_type=="moving") {
|
||||||
|
// Code for Moving Type Pointer to be included.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// draw pointer
|
// At this point marker x_start and x_end values are transposed.
|
||||||
if(pointer) {
|
// To keep this from confusing things they are now interchanged.
|
||||||
if(pointer_type=="fixed") {
|
if(huds_both(options)) {
|
||||||
glBegin(GL_LINE_STRIP);
|
marker_ye = marker_xs;
|
||||||
glVertex2f( -marker_offset+scrn_rect.left, text_y + scrn_rect.right / 6);
|
marker_xs = marker_xe;
|
||||||
glVertex2f( -marker_offset+marker_xe, text_y );
|
marker_xe = marker_ye;
|
||||||
glVertex2f( -marker_offset+scrn_rect.left, text_y - scrn_rect.right / 6);
|
}
|
||||||
glEnd();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if(pointer_type=="moving") {
|
|
||||||
// Code for Moving Type Pointer to be included.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// At this point marker x_start and x_end values are transposed.
|
// Work through from bottom to top of scale. Calculating where to put
|
||||||
// To keep this from confusing things they are now interchanged.
|
// minor and major ticks.
|
||||||
if(huds_both(options)) {
|
|
||||||
marker_ye = marker_xs;
|
|
||||||
marker_xs = marker_xe;
|
|
||||||
marker_xe = marker_ye;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Work through from bottom to top of scale. Calculating where to put
|
// draw scale or tape
|
||||||
// minor and major ticks.
|
|
||||||
|
|
||||||
// draw scale or tape
|
|
||||||
// last = FloatToInt(vmax)+1;
|
// last = FloatToInt(vmax)+1;
|
||||||
// i = FloatToInt(vmin);
|
// i = FloatToInt(vmin);
|
||||||
last = (int)vmax + 1;
|
last = (int)vmax + 1;
|
||||||
i = (int)vmin;
|
i = (int)vmin;
|
||||||
for( ; i <last ; i++ )
|
for( ; i <last ; i++ ) {
|
||||||
{
|
condition = true;
|
||||||
condition = true;
|
if( !modulo()) {
|
||||||
if( !modulo()) {
|
if( i < min_val()) {
|
||||||
if( i < min_val()) {
|
condition = false;
|
||||||
condition = false;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
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 + FloatToInt(((i - vmin) * factor()/*+.5f*/));
|
marker_ys = scrn_rect.top + FloatToInt(((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!!!
|
{
|
||||||
continue;
|
// Magic numbers!!!
|
||||||
}
|
continue;
|
||||||
if( div_min()) {
|
}
|
||||||
// if( (i%div_min()) == 0) {
|
if( div_min()) {
|
||||||
if( !(i%(int)div_min())) {
|
// if( (i%div_min()) == 0) {
|
||||||
if((( marker_ys - 5) > scrn_rect.top ) &&
|
if( !(i%(int)div_min())) {
|
||||||
(( marker_ys + 5) < (height))){
|
if((( marker_ys - 5) > scrn_rect.top ) &&
|
||||||
if( huds_both(options) ) {
|
(( marker_ys + 5) < (height))){
|
||||||
drawOneLine( scrn_rect.left, marker_ys,
|
if( huds_both(options) ) {
|
||||||
marker_xs, marker_ys );
|
drawOneLine( scrn_rect.left, marker_ys,
|
||||||
drawOneLine( marker_xe, marker_ys,
|
marker_xs, marker_ys );
|
||||||
width, marker_ys );
|
drawOneLine( marker_xe, marker_ys,
|
||||||
// glBegin(GL_LINES);
|
width, marker_ys );
|
||||||
// glVertex2f( scrn_rect.left, marker_ys );
|
// glBegin(GL_LINES);
|
||||||
// glVertex2f( marker_xs, marker_ys );
|
// glVertex2f( scrn_rect.left, marker_ys );
|
||||||
// glVertex2f( marker_xe, marker_ys);
|
// glVertex2f( marker_xs, marker_ys );
|
||||||
// glVertex2f( scrn_rect.left + scrn_rect.right, marker_ys );
|
// glVertex2f( marker_xe, marker_ys);
|
||||||
// glEnd();
|
// glVertex2f( scrn_rect.left + scrn_rect.right, marker_ys );
|
||||||
}
|
// glEnd();
|
||||||
else {
|
} else {
|
||||||
if( huds_left(options) ) {
|
if( huds_left(options) ) {
|
||||||
drawOneLine( marker_xs + 4, marker_ys,
|
drawOneLine( marker_xs + 4, marker_ys,
|
||||||
marker_xe, marker_ys );
|
marker_xe, marker_ys );
|
||||||
}
|
} else {
|
||||||
else {
|
drawOneLine( marker_xs, marker_ys,
|
||||||
drawOneLine( marker_xs, marker_ys,
|
marker_xe - 4, marker_ys );
|
||||||
marker_xe - 4, marker_ys );
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if( div_max() ) {
|
|
||||||
if( !(i%(int)div_max()) )
|
|
||||||
{
|
|
||||||
if(modulo()) {
|
|
||||||
if( disp_val < 0) {
|
|
||||||
while(disp_val < 0)
|
|
||||||
disp_val += modulo();
|
|
||||||
// } else {
|
|
||||||
// disp_val = i % (int)modulo();
|
|
||||||
}
|
|
||||||
disp_val = i % (int) modulo(); // ?????????
|
|
||||||
} else {
|
|
||||||
disp_val = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
lenstr = sprintf( TextScale, "%d",
|
if( div_max() ) {
|
||||||
FloatToInt(disp_val * data_scaling()/*+.5*/));
|
if( !(i%(int)div_max()) ) {
|
||||||
// (int)(disp_val * data_scaling() +.5));
|
if(modulo()) {
|
||||||
if(( (marker_ys - 8 ) > scrn_rect.top ) &&
|
if( disp_val < 0) {
|
||||||
( (marker_ys + 8) < (height))){
|
while(disp_val < 0)
|
||||||
if( huds_both(options) ) {
|
disp_val += modulo();
|
||||||
// drawOneLine( scrn_rect.left, marker_ys,
|
// } else {
|
||||||
// marker_xs, marker_ys);
|
// disp_val = i % (int)modulo();
|
||||||
// drawOneLine( marker_xs, marker_ys,
|
}
|
||||||
// scrn_rect.left + scrn_rect.right,
|
disp_val = i % (int) modulo(); // ?????????
|
||||||
// marker_ys);
|
} else {
|
||||||
glBegin(GL_LINE_STRIP);
|
disp_val = i;
|
||||||
glVertex2f( scrn_rect.left, marker_ys );
|
}
|
||||||
glVertex2f( marker_xs, marker_ys);
|
|
||||||
glVertex2f( width, marker_ys);
|
lenstr = sprintf( TextScale, "%d",
|
||||||
glEnd();
|
FloatToInt(disp_val * data_scaling()/*+.5*/));
|
||||||
if( !huds_notext(options)) {
|
// (int)(disp_val * data_scaling() +.5));
|
||||||
textString ( marker_xs + 2, marker_ys,
|
if(( (marker_ys - 8 ) > scrn_rect.top ) &&
|
||||||
TextScale, GLUT_BITMAP_8_BY_13 );
|
( (marker_ys + 8) < (height))){
|
||||||
}
|
if( huds_both(options) ) {
|
||||||
}
|
// drawOneLine( scrn_rect.left, marker_ys,
|
||||||
else {
|
// marker_xs, marker_ys);
|
||||||
drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
|
// drawOneLine( marker_xs, marker_ys,
|
||||||
if( !huds_notext(options) ) {
|
// scrn_rect.left + scrn_rect.right,
|
||||||
if( huds_left(options) ) {
|
// marker_ys);
|
||||||
textString( marker_xs - 8 * lenstr - 2,
|
glBegin(GL_LINE_STRIP);
|
||||||
marker_ys - 4,
|
glVertex2f( scrn_rect.left, marker_ys );
|
||||||
TextScale, GLUT_BITMAP_8_BY_13 );
|
glVertex2f( marker_xs, marker_ys);
|
||||||
}
|
glVertex2f( width, marker_ys);
|
||||||
else {
|
glEnd();
|
||||||
textString( marker_xe + 3 * lenstr,
|
if( !huds_notext(options)) {
|
||||||
marker_ys - 4,
|
textString ( marker_xs + 2, marker_ys,
|
||||||
TextScale, GLUT_BITMAP_8_BY_13 );
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
}
|
drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
|
||||||
} // Else read oriented right
|
if( !huds_notext(options) ) {
|
||||||
} // End if modulo division by major interval is zero
|
if( huds_left(options) ) {
|
||||||
} // End if major interval divisor non-zero
|
textString( marker_xs - 8 * lenstr - 2,
|
||||||
} // End if condition
|
marker_ys - 4,
|
||||||
} // End for range of i from vmin to vmax
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
||||||
} // End if VERTICAL SCALE TYPE
|
} else {
|
||||||
else { // Horizontal scale by default
|
textString( marker_xe + 3 * lenstr,
|
||||||
// left tick bar
|
marker_ys - 4,
|
||||||
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // Else read oriented right
|
||||||
|
} // End if modulo division by major interval is zero
|
||||||
|
} // End if major interval divisor non-zero
|
||||||
|
} // End if condition
|
||||||
|
} // End for range of i from vmin to vmax
|
||||||
|
} // End if VERTICAL SCALE TYPE
|
||||||
|
else { // Horizontal scale by default
|
||||||
|
// left tick bar
|
||||||
if (draw_tick_left) {
|
if (draw_tick_left) {
|
||||||
drawOneLine( scrn_rect.left, scrn_rect.top,
|
drawOneLine( scrn_rect.left, scrn_rect.top,
|
||||||
scrn_rect.left, height);
|
scrn_rect.left, height);
|
||||||
} // endif draw_tick_left
|
} // endif draw_tick_left
|
||||||
// right tick bar
|
// right tick bar
|
||||||
if (draw_tick_right) {
|
if (draw_tick_right) {
|
||||||
drawOneLine( width, scrn_rect.top,
|
drawOneLine( width, scrn_rect.top,
|
||||||
width,
|
width,
|
||||||
height );
|
height );
|
||||||
} // endif draw_tick_right
|
} // endif draw_tick_right
|
||||||
|
|
||||||
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 + FloatToInt((cur_value - vmin) * factor() /*+ .5f*/);
|
||||||
|
|
||||||
|
|
||||||
// glBegin(GL_LINES);
|
// glBegin(GL_LINES);
|
||||||
|
@ -421,69 +413,68 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
// glEnd();
|
// glEnd();
|
||||||
|
|
||||||
if( huds_top(options) ) {
|
if( huds_top(options) ) {
|
||||||
if (draw_cap_bottom) {
|
if (draw_cap_bottom) {
|
||||||
// Bottom box line
|
// Bottom box line
|
||||||
drawOneLine( scrn_rect.left,
|
drawOneLine( scrn_rect.left,
|
||||||
scrn_rect.top,
|
scrn_rect.top,
|
||||||
width,
|
width,
|
||||||
scrn_rect.top);
|
scrn_rect.top);
|
||||||
} //endif cap_bottom
|
} //endif cap_bottom
|
||||||
|
|
||||||
// Tick point adjust
|
|
||||||
marker_ye = scrn_rect.top + scrn_rect.bottom / 2;
|
|
||||||
// Bottom arrow
|
|
||||||
// drawOneLine( mid_scr.x, marker_ye,
|
|
||||||
// mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
|
|
||||||
// drawOneLine( mid_scr.x, marker_ye,
|
|
||||||
// mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
|
|
||||||
// draw pointer
|
|
||||||
if(pointer) {
|
|
||||||
if(pointer_type=="fixed") {
|
|
||||||
glBegin(GL_LINE_STRIP);
|
|
||||||
glVertex2f( marker_xs - scrn_rect.bottom / 4, scrn_rect.top);
|
|
||||||
glVertex2f( marker_xs, marker_ye);
|
|
||||||
glVertex2f( marker_xs + scrn_rect.bottom / 4, scrn_rect.top);
|
|
||||||
glEnd();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if(pointer_type=="moving") {
|
|
||||||
// Code for Moving type Pointer to be included.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Tick point adjust
|
||||||
|
marker_ye = scrn_rect.top + scrn_rect.bottom / 2;
|
||||||
|
// Bottom arrow
|
||||||
|
// drawOneLine( mid_scr.x, marker_ye,
|
||||||
|
// mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
|
||||||
|
// drawOneLine( mid_scr.x, marker_ye,
|
||||||
|
// mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
|
||||||
|
// draw pointer
|
||||||
|
if(pointer) {
|
||||||
|
if(pointer_type=="fixed") {
|
||||||
|
glBegin(GL_LINE_STRIP);
|
||||||
|
glVertex2f( marker_xs - scrn_rect.bottom / 4, scrn_rect.top);
|
||||||
|
glVertex2f( marker_xs, marker_ye);
|
||||||
|
glVertex2f( marker_xs + scrn_rect.bottom / 4, scrn_rect.top);
|
||||||
|
glEnd();
|
||||||
|
} else {
|
||||||
|
if(pointer_type=="moving") {
|
||||||
|
// Code for Moving type Pointer to be included.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( huds_bottom(options) ) {
|
if( huds_bottom(options) ) {
|
||||||
// Top box line
|
// Top box line
|
||||||
if (draw_cap_top) {
|
if (draw_cap_top) {
|
||||||
drawOneLine( scrn_rect.left, height,
|
drawOneLine( scrn_rect.left, height,
|
||||||
width, height);
|
width, height);
|
||||||
} //endif cap_top
|
} //endif cap_top
|
||||||
|
|
||||||
// Tick point adjust
|
// Tick point adjust
|
||||||
marker_ys = height - scrn_rect.bottom / 2;
|
marker_ys = height - scrn_rect.bottom / 2;
|
||||||
// Top arrow
|
// Top arrow
|
||||||
// drawOneLine( mid_scr.x + scrn_rect.bottom / 4,
|
// drawOneLine( mid_scr.x + scrn_rect.bottom / 4,
|
||||||
// scrn_rect.top + scrn_rect.bottom,
|
// scrn_rect.top + scrn_rect.bottom,
|
||||||
// mid_scr.x, marker_ys );
|
// mid_scr.x, marker_ys );
|
||||||
// drawOneLine( mid_scr.x - scrn_rect.bottom / 4,
|
// drawOneLine( mid_scr.x - scrn_rect.bottom / 4,
|
||||||
// scrn_rect.top + scrn_rect.bottom,
|
// scrn_rect.top + scrn_rect.bottom,
|
||||||
// mid_scr.x , marker_ys );
|
// mid_scr.x , marker_ys );
|
||||||
|
|
||||||
// draw pointer
|
|
||||||
if(pointer) {
|
|
||||||
if(pointer_type=="fixed") {
|
|
||||||
glBegin(GL_LINE_STRIP);
|
|
||||||
glVertex2f( marker_xs + scrn_rect.bottom / 4, height);
|
|
||||||
glVertex2f( marker_xs, marker_ys );
|
|
||||||
glVertex2f( marker_xs - scrn_rect.bottom / 4, height);
|
|
||||||
glEnd();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if(pointer_type=="moving") {
|
|
||||||
// Code for Moving Type Pointer to be included.
|
|
||||||
}
|
|
||||||
}//if pointer
|
|
||||||
|
|
||||||
|
// draw pointer
|
||||||
|
if(pointer) {
|
||||||
|
if(pointer_type=="fixed") {
|
||||||
|
glBegin(GL_LINE_STRIP);
|
||||||
|
glVertex2f( marker_xs + scrn_rect.bottom / 4, height);
|
||||||
|
glVertex2f( marker_xs, marker_ys );
|
||||||
|
glVertex2f( marker_xs - scrn_rect.bottom / 4, height);
|
||||||
|
glEnd();
|
||||||
|
} else {
|
||||||
|
if(pointer_type=="moving") {
|
||||||
|
// Code for Moving Type Pointer to be included.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}//if pointer
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,113 +488,109 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
|
|
||||||
// last = FloatToInt(vmax)+1;
|
// last = FloatToInt(vmax)+1;
|
||||||
// i = FloatToInt(vmin);
|
// i = FloatToInt(vmin);
|
||||||
last = (int)vmax + 1;
|
last = (int)vmax + 1;
|
||||||
i = (int)vmin;
|
i = (int)vmin;
|
||||||
for(; i <last ; i++ ) {
|
for(; i <last ; i++ ) {
|
||||||
// for( i = (int)vmin; i <= (int)vmax; i++ ) {
|
// for( i = (int)vmin; i <= (int)vmax; i++ ) {
|
||||||
// printf("<*> i = %d\n", i);
|
// printf("<*> i = %d\n", i);
|
||||||
condition = true;
|
condition = true;
|
||||||
if( !modulo()) {
|
if( !modulo()) {
|
||||||
if( i < min_val()) {
|
if( i < min_val()) {
|
||||||
condition = false;
|
condition = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 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 + FloatToInt(((i - vmin) * factor()/*+ .5f*/));
|
||||||
if( div_min()){
|
if( div_min()){
|
||||||
// if( (i%(int)div_min()) == 0 ) {
|
// if( (i%(int)div_min()) == 0 ) {
|
||||||
if( !(i%(int)div_min() )) {
|
if( !(i%(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) ) {
|
||||||
drawOneLine( marker_xs, scrn_rect.top,
|
drawOneLine( marker_xs, scrn_rect.top,
|
||||||
marker_xs, marker_ys - 4);
|
marker_xs, marker_ys - 4);
|
||||||
drawOneLine( marker_xs, marker_ye + 4,
|
drawOneLine( marker_xs, marker_ye + 4,
|
||||||
marker_xs, height);
|
marker_xs, height);
|
||||||
// glBegin(GL_LINES);
|
// glBegin(GL_LINES);
|
||||||
// glVertex2f( marker_xs, scrn_rect.top);
|
// glVertex2f( marker_xs, scrn_rect.top);
|
||||||
// glVertex2f( marker_xs, marker_ys - 4);
|
// glVertex2f( marker_xs, marker_ys - 4);
|
||||||
// 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
|
drawOneLine( marker_xs, marker_ys,
|
||||||
drawOneLine( marker_xs, marker_ys,
|
marker_xs, marker_ye - 4);
|
||||||
marker_xs, marker_ye - 4);
|
} else {
|
||||||
}
|
drawOneLine( marker_xs, marker_ys + 4,
|
||||||
else {
|
marker_xs, marker_ye);
|
||||||
drawOneLine( marker_xs, marker_ys + 4,
|
}
|
||||||
marker_xs, marker_ye);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
// printf("<***> i = %d\n", i);
|
// printf("<***> i = %d\n", i);
|
||||||
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 ) {
|
||||||
if( !(i%(int)div_max()) ) {
|
if( !(i%(int)div_max()) ) {
|
||||||
if(modulo()) {
|
if(modulo()) {
|
||||||
if( disp_val < 0) {
|
if( disp_val < 0) {
|
||||||
while(disp_val<0)
|
while(disp_val<0)
|
||||||
disp_val += modulo();
|
disp_val += modulo();
|
||||||
}
|
}
|
||||||
disp_val = i % (int) modulo(); // ?????????
|
disp_val = i % (int) modulo(); // ?????????
|
||||||
} else {
|
} else {
|
||||||
disp_val = i;
|
disp_val = i;
|
||||||
}
|
}
|
||||||
// printf("disp_val = %d\n", disp_val);
|
// printf("disp_val = %d\n", disp_val);
|
||||||
// printf("%d\n", (int)(disp_val * (double)data_scaling() + 0.5));
|
// printf("%d\n", (int)(disp_val * (double)data_scaling() + 0.5));
|
||||||
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);
|
||||||
// drawOneLine( marker_xs, marker_ye,
|
// drawOneLine( marker_xs, marker_ye,
|
||||||
// marker_xs, scrn_rect.top + scrn_rect.bottom);
|
// marker_xs, scrn_rect.top + scrn_rect.bottom);
|
||||||
glBegin(GL_LINE_STRIP);
|
glBegin(GL_LINE_STRIP);
|
||||||
glVertex2f( marker_xs, scrn_rect.top);
|
glVertex2f( marker_xs, scrn_rect.top);
|
||||||
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, GLUT_BITMAP_8_BY_13 );
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
||||||
}
|
}
|
||||||
}
|
} 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, GLUT_BITMAP_8_BY_13 );
|
||||||
TextScale, GLUT_BITMAP_8_BY_13 );
|
} else {
|
||||||
}
|
textString( marker_xs - 4 * lenstr,
|
||||||
else {
|
scrn_rect.top,
|
||||||
textString( marker_xs - 4 * lenstr,
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
||||||
scrn_rect.top,
|
}
|
||||||
TextScale, GLUT_BITMAP_8_BY_13 );
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
// printf("<****> i = %d\n", i);
|
// printf("<****> i = %d\n", i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} //draw
|
} //draw
|
||||||
|
|
|
@ -45,12 +45,12 @@ HudLadder :: HudLadder( string name,
|
||||||
factor ( factr ),
|
factor ( factr ),
|
||||||
hudladder_type ( name ),
|
hudladder_type ( name ),
|
||||||
frl ( frl_spot ),
|
frl ( frl_spot ),
|
||||||
|
target_spot ( target ),
|
||||||
velocity_vector ( vel_vec ),
|
velocity_vector ( vel_vec ),
|
||||||
drift_marker ( drift ),
|
drift_marker ( drift ),
|
||||||
alpha_bracket ( alpha ),
|
alpha_bracket ( alpha ),
|
||||||
energy_marker ( energy ),
|
energy_marker ( energy ),
|
||||||
climb_dive_marker ( climb ),
|
climb_dive_marker ( climb ),
|
||||||
target_spot ( target ),
|
|
||||||
glide_slope_marker ( glide ),
|
glide_slope_marker ( glide ),
|
||||||
glide_slope ( glide_slope_val),
|
glide_slope ( glide_slope_val),
|
||||||
energy_worm ( worm_energy),
|
energy_worm ( worm_energy),
|
||||||
|
@ -79,12 +79,12 @@ HudLadder( const HudLadder & image ) :
|
||||||
factor ( image.factor ),
|
factor ( image.factor ),
|
||||||
hudladder_type ( image.hudladder_type),
|
hudladder_type ( image.hudladder_type),
|
||||||
frl ( image.frl),
|
frl ( image.frl),
|
||||||
|
target_spot ( image.target_spot),
|
||||||
velocity_vector ( image.velocity_vector),
|
velocity_vector ( image.velocity_vector),
|
||||||
drift_marker ( image.drift_marker),
|
drift_marker ( image.drift_marker),
|
||||||
alpha_bracket ( image.alpha_bracket),
|
alpha_bracket ( image.alpha_bracket),
|
||||||
energy_marker ( image.energy_marker),
|
energy_marker ( image.energy_marker),
|
||||||
climb_dive_marker ( image.climb_dive_marker),
|
climb_dive_marker ( image.climb_dive_marker),
|
||||||
target_spot ( image.target_spot),
|
|
||||||
glide_slope_marker ( image.glide_slope_marker),
|
glide_slope_marker ( image.glide_slope_marker),
|
||||||
glide_slope ( image.glide_slope),
|
glide_slope ( image.glide_slope),
|
||||||
energy_worm ( image.energy_worm),
|
energy_worm ( image.energy_worm),
|
||||||
|
@ -127,15 +127,17 @@ void HudLadder :: draw( void )
|
||||||
|
|
||||||
float x_ini,x_ini2;
|
float x_ini,x_ini2;
|
||||||
float x_end,x_end2;
|
float x_end,x_end2;
|
||||||
float y;
|
float y = 0;
|
||||||
int count;
|
int count;
|
||||||
float cosine, sine,xvvr,yvvr,Vxx,Vyy,Vzz,up_vel,ground_vel,actslope;
|
float cosine, sine, xvvr, yvvr, Vxx = 0.0, Vyy = 0.0, Vzz = 0.0,
|
||||||
float Axx,Ayy,Azz,total_vel,pot_slope,t1,t2,psi,alpha,pla;
|
up_vel, ground_vel, actslope = 0.0;
|
||||||
float vel_x,vel_y,drift;
|
float Axx = 0.0, Ayy = 0.0, Azz = 0.0, total_vel = 0.0, pot_slope, t1,
|
||||||
char Textaux[8] ;
|
t2 = 0.0, psi = 0.0, alpha,pla;
|
||||||
bool pitch_ladder;
|
float vel_x = 0.0, vel_y = 0.0, drift;
|
||||||
bool climb_dive_ladder;
|
// char Textaux[8] ;
|
||||||
bool clip_plane;
|
bool pitch_ladder = false;
|
||||||
|
bool climb_dive_ladder = false;
|
||||||
|
bool clip_plane = false;
|
||||||
|
|
||||||
GLdouble eqn_top[4] = {0.0,-1.0,0.0,0.0};
|
GLdouble eqn_top[4] = {0.0,-1.0,0.0,0.0};
|
||||||
GLdouble eqn_left[4] = {-1.0,0.0,0.0,100.0};
|
GLdouble eqn_left[4] = {-1.0,0.0,0.0,100.0};
|
||||||
|
@ -473,13 +475,15 @@ void HudLadder :: draw( void )
|
||||||
float bot ;
|
float bot ;
|
||||||
float top ;
|
float top ;
|
||||||
float text_offset = 4.0f ;
|
float text_offset = 4.0f ;
|
||||||
float zero_offset;
|
float zero_offset = 0.0;
|
||||||
|
|
||||||
if(climb_dive_ladder)
|
if ( climb_dive_ladder ) {
|
||||||
zero_offset = 50.0f ;
|
zero_offset = 50.0f ;
|
||||||
else
|
} else {
|
||||||
if(pitch_ladder)
|
if ( pitch_ladder ) {
|
||||||
zero_offset = 10.0f ;
|
zero_offset = 10.0f ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fntFont *font = HUDtext->getFont();
|
fntFont *font = HUDtext->getFont();
|
||||||
float pointsize = HUDtext->getPointSize();
|
float pointsize = HUDtext->getPointSize();
|
||||||
|
|
|
@ -482,7 +482,6 @@ double FGSteam::get_HackOBS2_deg () {
|
||||||
|
|
||||||
double FGSteam::get_HackADF_deg () {
|
double FGSteam::get_HackADF_deg () {
|
||||||
static double last_r = 0;
|
static double last_r = 0;
|
||||||
double r;
|
|
||||||
|
|
||||||
if ( current_radiostack->get_adf_inrange() ) {
|
if ( current_radiostack->get_adf_inrange() ) {
|
||||||
double r = current_radiostack->get_adf_heading()
|
double r = current_radiostack->get_adf_heading()
|
||||||
|
|
Loading…
Reference in a new issue