diff --git a/src/Cockpit/Makefile.am b/src/Cockpit/Makefile.am index 46b231a30..bc94710e3 100644 --- a/src/Cockpit/Makefile.am +++ b/src/Cockpit/Makefile.am @@ -2,7 +2,7 @@ noinst_LIBRARIES = libCockpit.a libCockpit_a_SOURCES = \ cockpit.cxx cockpit.hxx \ - hud.cxx hud.hxx hud_opts.hxx \ + hud.cxx hud.hxx \ hud_card.cxx hud_dnst.cxx hud_gaug.cxx hud_inst.cxx \ hud_labl.cxx hud_ladr.cxx \ hud_lat.cxx hud_lon.cxx \ diff --git a/src/Cockpit/hud.hxx b/src/Cockpit/hud.hxx index 73582fe26..da3bf862f 100644 --- a/src/Cockpit/hud.hxx +++ b/src/Cockpit/hud.hxx @@ -21,8 +21,8 @@ // $Id$ -#ifndef _HUD_HXX -#define _HUD_HXX +#ifndef _OLDHUD_HXX +#define _OLDHUD_HXX #ifndef __cplusplus # error This library requires C++ @@ -50,8 +50,9 @@ #include // STL double ended queue #include STL_FSTREAM +#include // float_to_int() #include -//#include +#include #include #include @@ -62,7 +63,6 @@ #include
#include -#include "hud_opts.hxx" #include SG_USING_STD(deque); @@ -287,7 +287,7 @@ public: if ( HUDtext && str ) { float r, l ; HUD_Font->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ; - return FloatToInt( r - l ); + return float_to_int( r - l ); } return 0 ; } @@ -297,7 +297,7 @@ public: if ( HUDtext && strlen( msg )) { float r, l ; HUD_Font->getBBox ( msg, HUD_TextSize, 0, &l, &r, NULL, NULL ) ; - return FloatToInt( r - l ); + return float_to_int( r - l ); } return 0 ; } @@ -354,7 +354,7 @@ public: void Draw() { - guiFnt.drawString( msg, FloatToInt(x), FloatToInt(y) ); + guiFnt.drawString( msg, float_to_int(x), float_to_int(y) ); } }; @@ -490,7 +490,7 @@ public: if ( HUDtext && str ) { float r, l ; HUD_Font->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ; - return FloatToInt( r - l ); + return float_to_int( r - l ); } return 0 ; } @@ -898,4 +898,4 @@ private: float _r, _g, _b, _a, _cl; }; -#endif // _HUD_H +#endif // _OLDHUD_H diff --git a/src/Cockpit/hud_card.cxx b/src/Cockpit/hud_card.cxx index c60efd0d0..921c5990d 100644 --- a/src/Cockpit/hud_card.cxx +++ b/src/Cockpit/hud_card.cxx @@ -339,8 +339,8 @@ void hud_card::draw(void) // (HUD_scale * pscale) // draw scale or tape -// last = FloatToInt(vmax)+1; -// i = FloatToInt(vmin); +// last = float_to_int(vmax)+1; +// i = float_to_int(vmin); last = (int)vmax + 1; // N i = (int)vmin; // N @@ -464,7 +464,7 @@ void hud_card::draw(void) // (HUD_scale * pscale) } lenstr = sprintf(TextScale, "%d", - FloatToInt(disp_val * data_scaling()/*+.5*/)); + float_to_int(disp_val * data_scaling()/*+.5*/)); // (int)(disp_val * data_scaling() +.5)); /* if (((marker_ys - 8) > scrn_rect.top) && ((marker_ys + 8) < (height))){ */ @@ -642,8 +642,8 @@ void hud_card::draw(void) // (HUD_scale * pscale) // printf("vmin = %d vmax = %d\n", (int)vmin, (int)vmax); - // last = FloatToInt(vmax)+1; - // i = FloatToInt(vmin); + // last = float_to_int(vmax)+1; + // i = float_to_int(vmin); if (zoom == 1) { zoomed_scale((int)vmin,(int)vmax); @@ -733,7 +733,7 @@ void hud_card::draw(void) // (HUD_scale * pscale) // printf("%d\n", (int)(disp_val * (double)data_scaling() + 0.5)); lenstr = sprintf(TextScale, "%d", // (int)(disp_val * data_scaling() +.5)); - FloatToInt(disp_val * data_scaling()/*+.5*/)); + float_to_int(disp_val * data_scaling()/*+.5*/)); // Draw major ticks and text only if far enough from the edge. if (((marker_xs - 10)> scrn_rect.left) diff --git a/src/Cockpit/hud_gaug.cxx b/src/Cockpit/hud_gaug.cxx index 30b91bd4c..04c2018ed 100644 --- a/src/Cockpit/hud_gaug.cxx +++ b/src/Cockpit/hud_gaug.cxx @@ -95,8 +95,8 @@ void gauge_instr::draw(void) if (!huds_noticks(options)) { // If not no ticks...:) // Calculate x marker offsets - int last = (int)vmax + 1; // FloatToInt(vmax)+1; - i = (int)vmin; //FloatToInt(vmin); + int last = (int)vmax + 1; // float_to_int(vmax)+1; + i = (int)vmin; //float_to_int(vmin); for (; i < last; i++) { // Calculate the location of this tick @@ -135,7 +135,7 @@ void gauge_instr::draw(void) if (!huds_notext(options)) { disp_val = i; sprintf(TextScale, "%d", - FloatToInt(disp_val * data_scaling()/*+.5*/)); + float_to_int(disp_val * data_scaling()/*+.5*/)); lenstr = getStringWidth(TextScale); @@ -143,12 +143,12 @@ void gauge_instr::draw(void) text_x = mid_scr.x - lenstr/2 ; } else if (huds_left(options)) { - text_x = FloatToInt(marker_xs - lenstr); + text_x = float_to_int(marker_xs - lenstr); } else { - text_x = FloatToInt(marker_xe - lenstr); + text_x = float_to_int(marker_xe - lenstr); } // Now we know where to put the text. - text_y = FloatToInt(marker_ys); + text_y = float_to_int(marker_ys); textString(text_x, text_y, TextScale, 0); } } @@ -160,20 +160,20 @@ void gauge_instr::draw(void) // have been drawn, text_x and text_y may be recycled. This is used // with the marker start stops to produce a pointer for each side reading - text_y = scrn_rect.top + FloatToInt((cur_value - vmin) * factor() /*+.5f*/); + text_y = scrn_rect.top + float_to_int((cur_value - vmin) * factor() /*+.5f*/); // text_x = marker_xs - scrn_rect.left; if (huds_right(options)) { glBegin(GL_LINE_STRIP); glVertex2f(scrn_rect.left, text_y + 5); - glVertex2f(FloatToInt(marker_xe), text_y); + glVertex2f(float_to_int(marker_xe), text_y); glVertex2f(scrn_rect.left, text_y - 5); glEnd(); } if (huds_left(options)) { glBegin(GL_LINE_STRIP); glVertex2f(width, text_y + 5); - glVertex2f(FloatToInt(marker_xs), text_y); + glVertex2f(float_to_int(marker_xs), text_y); glVertex2f(width, text_y - 5); glEnd(); } @@ -218,8 +218,8 @@ void gauge_instr::draw(void) } - int last = (int)vmax + 1; //FloatToInt(vmax)+1; - i = (int)vmin; //FloatToInt(vmin); + int last = (int)vmax + 1; //float_to_int(vmax)+1; + i = (int)vmin; //float_to_int(vmin); for (; i -#endif - -#include - - -#if defined(i386) -#define USE_X86_ASM -#endif - -#if defined(USE_X86_ASM) -static __inline__ int FloatToInt(float f) -{ - int r; - __asm__ ("fistpl %0" : "=m" (r) : "t" (f) : "st"); - return r; -} -#elif defined(__MSC__) && defined(__WIN32__) -static __inline int FloatToInt(float f) -{ - int r; - _asm { - fld f - fistp r - } - return r; -} -#else -#define FloatToInt(F) ((int) ((F) < 0.0f ? (F)-0.5f : (F)+0.5f)) -#endif - - -#endif // _HUD_OPTS_H diff --git a/src/Cockpit/hud_scal.cxx b/src/Cockpit/hud_scal.cxx index f2fc6abc5..694a0ea3a 100644 --- a/src/Cockpit/hud_scal.cxx +++ b/src/Cockpit/hud_scal.cxx @@ -45,7 +45,7 @@ instr_scale::instr_scale( if (show_range < 0) range_shown = -range_shown; - temp = FloatToInt(Maximum_value - Minimum_value) / 100; + temp = float_to_int(Maximum_value - Minimum_value) / 100; if (range_shown < temp) range_shown = temp; }