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 \
// $Id$
-#ifndef _HUD_HXX
-#define _HUD_HXX
+#ifndef _OLDHUD_HXX
+#define _OLDHUD_HXX
#ifndef __cplusplus
# error This library requires C++
#include <deque> // STL double ended queue
#include STL_FSTREAM
+#include <simgear/math/fastmath.hxx> // float_to_int()
#include <simgear/constants.h>
-//#include <simgear/props/props.hxx>
+#include <simgear/props/props.hxx>
#include <Include/fg_typedefs.h>
#include <Aircraft/aircraft.hxx>
#include <Main/viewmgr.hxx>
#include <Airports/runways.hxx>
-#include "hud_opts.hxx"
#include <plib/sg.h>
SG_USING_STD(deque);
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 ;
}
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 ;
}
void Draw()
{
- guiFnt.drawString( msg, FloatToInt(x), FloatToInt(y) );
+ guiFnt.drawString( msg, float_to_int(x), float_to_int(y) );
}
};
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 ;
}
float _r, _g, _b, _a, _cl;
};
-#endif // _HUD_H
+#endif // _OLDHUD_H
// 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
}
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))){ */
// 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);
// 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)
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
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);
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);
}
}
// 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();
}
}
- 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++) {
condition = true;
if (!modulo() && i < min_val())
disp_val = i;
}
sprintf(TextScale, "%d",
- FloatToInt(disp_val * data_scaling()/* +.5*/));
+ float_to_int(disp_val * data_scaling()/* +.5*/));
lenstr = getStringWidth(TextScale);
// Draw major ticks and text only if far enough from the edge.
LineList.erase();
StippleLineList.erase();
- int last = FloatToInt(vmax) + 1;
- int i = FloatToInt(vmin);
+ int last = float_to_int(vmax) + 1;
+ int i = float_to_int(vmin);
if (!scr_hole) {
x_end = half_span;
+++ /dev/null
-// hud_opts.hxx -- hud optimization tools
-//
-// Probably written by Norman Vine, started sometime in 1998 or 1999.
-//
-// Copyright (C) 1999 FlightGear Project
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-// $Id$
-
-
-#ifndef _HUD_OPTS_HXX
-#define _HUD_OPTS_HXX
-
-#ifndef __cplusplus
-# error This library requires C++
-#endif
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <simgear/compiler.h>
-
-
-#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
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;
}