#include <GL/glut.h>
#include <stdlib.h>
+#include <stdio.h> // char related functions
+#include <string.h> // strcmp()
#include STL_STRING
#include STL_FSTREAM
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/props.hxx>
+#include <simgear/misc/sg_path.hxx>
//#include <simgear/math/fg_random.h>
//#include <simgear/math/polar3d.hxx>
load_fn = get_aileronval;
} else if (loadfn=="elevatorval") {
load_fn = get_elevatorval;
+ } else if (loadfn=="elevatortrimval") {
+ load_fn = get_elev_trimval;
} else if (loadfn=="rudderval") {
load_fn = get_rudderval;
} else if (loadfn=="throttleval") {
int readInstrument(const SGPropertyNode * node)
{
+ static const SGPropertyNode *startup_units_node
+ = fgGetNode("/sim/startup/units");
instr_item *HIptr;
- if ( fgGetString("/sim/startup/units") == "feet" ) {
+ if ( !strcmp(startup_units_node->getStringValue(), "feet") ) {
strcpy(units, " ft");
} else {
strcpy(units, " m");
char *s;
int labelX = (DialogWidth / 2) -
- (puGetStringWidth( puGetDefaultLabelFont(), Label ) / 2);
+ ( puGetDefaultLabelFont().getStringWidth( Label ) / 2);
int nSliders = 1;
int slider_x = 10;
puGetDefaultFonts ( &HUDalphaLegendFont, &HUDalphaLabelFont );
HUDalphaDialog = new puDialogBox ( DialogX, DialogY ); {
- int horiz_slider_height = puGetStringHeight (HUDalphaLabelFont) +
- puGetStringDescender (HUDalphaLabelFont) +
+ int horiz_slider_height = HUDalphaLabelFont.getStringHeight() +
+ HUDalphaLabelFont.getStringDescender() +
PUSTR_TGAP + PUSTR_BGAP + 5;
/* puFrame *
void fgUpdateHUD( void ) {
static const float normal_aspect = float(640) / float(480);
- // note: win_ratio is Y/X
- float current_aspect = 1.0f/globals->get_current_view()->get_win_ratio();
+ // note: aspect_ratio is Y/X
+ float current_aspect = 1.0f/globals->get_current_view()->get_aspect_ratio();
if( current_aspect > normal_aspect ) {
float aspect_adjust = current_aspect / normal_aspect;
float adjust = 320.0f*aspect_adjust - 320.0f;
// char scratch[128];
// HUD_TextList.add( fgText( "AUTOPILOT", 20, apY) );
// apY -= 15;
- if( current_autopilot->get_HeadingEnabled() ) {
+ if( globals->get_autopilot()->get_HeadingEnabled() ) {
HUD_TextList.add( fgText( 40, apY,
- current_autopilot->get_TargetHeadingStr()) );
+ globals->get_autopilot()->get_TargetHeadingStr()) );
apY -= 15;
}
- if( current_autopilot->get_AltitudeEnabled() ) {
+ if( globals->get_autopilot()->get_AltitudeEnabled() ) {
HUD_TextList.add( fgText( 40, apY,
- current_autopilot->get_TargetAltitudeStr()) );
+ globals->get_autopilot()->get_TargetAltitudeStr()) );
apY -= 15;
}
- if( current_autopilot->get_HeadingMode() ==
+ if( globals->get_autopilot()->get_HeadingMode() ==
FGAutopilot::FG_HEADING_WAYPOINT )
{
char *wpstr;
- wpstr = current_autopilot->get_TargetWP1Str();
+ wpstr = globals->get_autopilot()->get_TargetWP1Str();
if ( strlen( wpstr ) ) {
HUD_TextList.add( fgText( 40, apY, wpstr ) );
apY -= 15;
}
- wpstr = current_autopilot->get_TargetWP2Str();
+ wpstr = globals->get_autopilot()->get_TargetWP2Str();
if ( strlen( wpstr ) ) {
HUD_TextList.add( fgText( 40, apY, wpstr ) );
apY -= 15;
}
- wpstr = current_autopilot->get_TargetWP3Str();
+ wpstr = globals->get_autopilot()->get_TargetWP3Str();
if ( strlen( wpstr ) ) {
HUD_TextList.add( fgText( 40, apY, wpstr ) );
apY -= 15;