1 // hud.cxx -- hud defines and prototypes
3 // Written by Michele America, started September 1997.
5 // Copyright (C) 1997 Michele F. America - micheleamerica@geocities.com
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
33 # define exception c_exception
42 #include <simgear/constants.h>
43 #include <simgear/debug/logstream.hxx>
44 #include <simgear/misc/props.hxx>
45 //#include <simgear/math/fg_random.h>
46 //#include <simgear/math/polar3d.hxx>
48 #include <Aircraft/aircraft.hxx>
49 #include <Autopilot/newauto.hxx>
51 #include <Main/globals.hxx>
53 #include <NetworkOLK/network.h>
55 #include <Scenery/scenery.hxx>
56 //#include <Time/fg_timer.hxx>
58 #if defined ( __sun__ ) || defined ( __sgi )
60 extern void *memmove(void *, const void *, size_t);
68 // The following routines obtain information concerning the aircraft's
69 // current state and return it to calling instrument display routines.
70 // They should eventually be member functions of the aircraft.
73 deque< instr_item * > HUD_deque;
75 fgTextList HUD_TextList;
76 fgLineList HUD_LineList;
77 fgLineList HUD_StippleLineList;
79 fntRenderer *HUDtext = 0;
80 float HUD_TextSize = 0;
84 static float hud_trans_alpha = 0.67f;
87 //$$$ begin - added, Neetha, 28 Nov 2k
95 static float span_units;
96 static float division_units;
97 static float minor_division = 0;
98 static UINT screen_hole;
101 static string loadfn;
103 static float maxValue;
104 static float minValue;
105 static float scaling;
106 static UINT major_divs;
107 static UINT minor_divs;
108 static UINT modulator;
109 static int dp_showing = 0;
110 static string label_format;
111 static string prelabel;
112 static string postlabel;
115 static float maxBankAngle;
116 static float maxSlipAngle;
117 static UINT gap_width;
118 static bool latitude;
119 static bool longitude;
120 static bool tick_bottom;
121 static bool tick_top;
122 static bool tick_right;
123 static bool tick_left;
124 static bool cap_bottom;
126 static bool cap_right;
127 static bool cap_left;
128 static float marker_off;
130 static bool enable_pointer;
131 static string type_pointer;
132 static bool frl_spot;
134 static bool vel_vector;
138 static bool climb_dive;
140 static float glide_slope_val;
141 static bool worm_energy;
142 static bool waypoint;
144 static FLTFNPTR load_fn;
145 static fgLabelJust justification;
146 static const char *pre_label_string = 0;
147 static const char *post_label_string = 0;
149 int readHud( istream &input );
150 int readInstrument ( const SGPropertyNode * node);
151 static instr_item * readLadder ( const SGPropertyNode * node);
152 static instr_item * readCard ( const SGPropertyNode * node);
153 static instr_item * readLabel( const SGPropertyNode * node);
154 static instr_item * readTBI( const SGPropertyNode * node);
155 //$$$ end - added, Neetha, 28 Nov 2k
157 void fgHUDalphaInit( void );
163 locRECT( UINT left, UINT top, UINT right, UINT bottom);
164 RECT get_rect(void) { return rect;}
167 locRECT :: locRECT( UINT left, UINT top, UINT right, UINT bottom)
172 rect.bottom = bottom;
178 void drawOneLine( UINT x1, UINT y1, UINT x2, UINT y2)
186 void drawOneLine( RECT &rect)
189 glVertex2f(rect.left, rect.top);
190 glVertex2f(rect.right, rect.bottom);
195 // The following code deals with painting the "instrument" on the display
197 /* textString - Bitmap font string */
199 void textString( int x, int y, char *msg, void *font ){
203 // puDrawString ( NULL, msg, x, y );
206 glutBitmapCharacter(font, *msg);
213 /* strokeString - Stroke font string */
214 void strokeString(int x, int y, char *msg, void *font, float theta)
219 float sintheta,costheta;
225 glRotatef(theta * RAD_TO_DEG, 0.0, 0.0, 1.0);
226 sintheta = sin(theta);
227 costheta = cos(theta);
228 xx = (int)(x * costheta + y * sintheta);
229 yy = (int)(y * costheta - x * sintheta);
230 glTranslatef( xx, yy, 0);
231 glScalef(.1, .1, 0.0);
232 while( (c=*msg++) ) {
233 glutStrokeCharacter(font, c);
239 int getStringWidth ( char *str )
241 if ( HUDtext && str )
244 guiFntHandle->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
245 return FloatToInt( r - l );
251 //========================= End of Class Implementations===================
254 // Constructs a HUD object and then adds in instruments. At the present
255 // the instruments are hard coded into the routine. Ultimately these need
256 // to be defined by the aircraft's instrumentation records so that the
257 // display for a Piper Cub doesn't show the speed range of a North American
258 // mustange and the engine readouts of a B36!
263 //$$$ begin - added, Neetha, 28 Nov 2k
265 readLadder(const SGPropertyNode * node)
270 name = node->getStringValue("name");
271 x = node->getIntValue("x");
272 y = node->getIntValue("y");
273 width = node->getIntValue("width");
274 height = node->getIntValue("height");
275 factor = node->getFloatValue("compression_factor");
276 span_units = node->getFloatValue("span_units");
277 division_units = node->getFloatValue("division_units");
278 screen_hole = node->getIntValue("screen_hole");
279 lbl_pos = node->getIntValue("lbl_pos");
280 frl_spot = node->getBoolValue("enable_frl",false);
281 target = node->getBoolValue("enable_target_spot",false);
282 vel_vector = node->getBoolValue("enable_velocity_vector",false);
283 drift = node->getBoolValue("enable_drift_marker",false);
284 alpha = node->getBoolValue("enable_alpha_bracket",false);
285 energy = node->getBoolValue("enable_energy_marker",false);
286 climb_dive = node->getBoolValue("enable_climb_dive_marker",false);
287 glide = node->getBoolValue("enable_glide_slope_marker",false);
288 glide_slope_val = node->getFloatValue("glide_slope",-4.0);
289 worm_energy = node->getBoolValue("enable_energy_marker",false);
290 waypoint = node->getBoolValue("enable_waypoint_marker",false);
291 working = node->getBoolValue("working");
293 FG_LOG(FG_INPUT, FG_INFO, "Done reading instrument " << name);
296 p = (instr_item *) new HudLadder( name, x, y,
297 width, height, factor,
299 span_units, division_units, minor_division,
300 screen_hole, lbl_pos, frl_spot, target, vel_vector,
301 drift, alpha, energy, climb_dive,
302 glide, glide_slope_val, worm_energy,
310 readCard(const SGPropertyNode * node)
315 name = node->getStringValue("name");
316 x = node->getIntValue("x");
317 y = node->getIntValue("y");
318 width = node->getIntValue("width");
319 height = node->getIntValue("height");
320 loadfn = node->getStringValue("loadfn");
321 options = node->getIntValue("options");
322 maxValue = node->getFloatValue("maxValue");
323 minValue = node->getFloatValue("minValue");
324 scaling = node->getFloatValue("disp_scaling");
325 major_divs = node->getIntValue("major_divs");
326 minor_divs = node->getIntValue("minor_divs");
327 modulator = node->getIntValue("modulator");
328 span_units = node->getFloatValue("value_span");
329 type = node->getStringValue("type");
330 tick_bottom = node->getBoolValue("tick_bottom",false);
331 tick_top = node->getBoolValue("tick_top",false);
332 tick_right = node->getBoolValue("tick_right",false);
333 tick_left = node->getBoolValue("tick_left",false);
334 cap_bottom = node->getBoolValue("cap_bottom",false);
335 cap_top = node->getBoolValue("cap_top",false);
336 cap_right = node->getBoolValue("cap_right",false);
337 cap_left = node->getBoolValue("cap_left",false);
338 marker_off = node->getFloatValue("marker_offset",0.0);
339 enable_pointer = node->getBoolValue("enable_pointer",true);
340 type_pointer = node->getStringValue("pointer_type");
341 working = node->getBoolValue("working");
344 FG_LOG(FG_INPUT, FG_INFO, "Done reading instrument " << name);
348 span_units = maxValue - minValue;
353 if(loadfn=="heading")
354 load_fn = get_heading;
360 load_fn = get_climb_rate;
362 if(loadfn=="altitude")
363 load_fn = get_altitude;
371 if(loadfn=="view_direction")
372 load_fn = get_view_direction;
374 if(loadfn=="aileronval")
375 load_fn = get_aileronval;
377 if(loadfn=="elevatorval")
378 load_fn = get_elevatorval;
380 if(loadfn=="rudderval")
381 load_fn = get_rudderval;
383 if(loadfn=="throttleval")
384 load_fn = get_throttleval;
387 p = (instr_item *) new hud_card( x,
395 major_divs, minor_divs,
416 readLabel(const SGPropertyNode * node)
420 int font_size = (globals->get_options()->get_xsize() > 1000) ? LARGE : SMALL;
422 name = node->getStringValue("name");
423 x = node->getIntValue("x");
424 y = node->getIntValue("y");
425 width = node->getIntValue("width");
426 height = node->getIntValue("height");
427 loadfn = node->getStringValue("data_source");
428 label_format = node->getStringValue("label_format");
429 prelabel = node->getStringValue("pre_label_string");
430 postlabel = node->getStringValue("post_label_string");
431 scaling = node->getFloatValue("scale_data");
432 options = node->getIntValue("options");
433 justi = node->getIntValue("justification");
434 blinking = node->getIntValue("blinking");
435 latitude = node->getBoolValue("latitude",false);
436 longitude = node->getBoolValue("longitude",false);
437 working = node->getBoolValue("working");
440 FG_LOG(FG_INPUT, FG_INFO, "Done reading instrument " << name);
444 justification = LEFT_JUST;
447 justification = CENTER_JUST;
450 justification = RIGHT_JUST;
454 pre_label_string = NULL;
456 if(prelabel=="blank")
457 pre_label_string = " ";
459 pre_label_string = prelabel.c_str();
462 if(postlabel=="blank")
463 post_label_string = " ";
465 if(postlabel=="NULL")
466 post_label_string = NULL;
468 if(postlabel=="units")
469 post_label_string = units;
471 post_label_string = postlabel.c_str();
513 if(loadfn=="altitude")
514 load_fn = get_altitude;
519 if(loadfn=="framerate")
520 load_fn = get_frame_rate;
522 if(loadfn=="heading")
523 load_fn = get_heading;
528 if(loadfn=="vfc_tris_culled")
529 load_fn = get_vfc_tris_culled;
531 if(loadfn=="vfc_tris_drawn")
532 load_fn = get_vfc_tris_drawn;
537 if(loadfn=="latitude")
538 load_fn = get_latitude;
540 if(loadfn=="longitude")
541 load_fn = get_longitude;
544 p = (instr_item *) new instr_label ( x,
549 label_format.c_str(),
566 readTBI(const SGPropertyNode * node)
571 name = node->getStringValue("name");
572 x = node->getIntValue("x");
573 y = node->getIntValue("y");
574 width = node->getIntValue("width");
575 height = node->getIntValue("height");
576 maxBankAngle = node->getFloatValue("maxBankAngle");
577 maxSlipAngle = node->getFloatValue("maxSlipAngle");
578 gap_width = node->getIntValue("gap_width");
579 working = node->getBoolValue("working");
581 FG_LOG(FG_INPUT, FG_INFO, "Done reading instrument " << name);
584 p = (instr_item *) new fgTBI_instr( x,
599 int readInstrument(const SGPropertyNode * node)
604 if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
605 strcpy(units, " ft");
610 const SGPropertyNode * ladder_group = node->getNode("ladders");
612 if (ladder_group != 0) {
613 int nLadders = ladder_group->nChildren();
614 for (int j = 0; j < nLadders; j++) {
616 HIptr = readLadder(ladder_group->getChild(j));
617 HUD_deque.insert( HUD_deque.begin(), HIptr);
622 const SGPropertyNode * card_group = node->getNode("cards");
623 if (card_group != 0) {
624 int nCards = card_group->nChildren();
625 for (int j = 0; j < nCards; j++) {
627 HIptr = readCard(card_group->getChild(j));
628 HUD_deque.insert( HUD_deque.begin(), HIptr);
633 const SGPropertyNode * label_group = node->getNode("labels");
634 if (label_group != 0) {
635 int nLabels = label_group->nChildren();
636 for (int j = 0; j < nLabels; j++) {
638 HIptr = readLabel(label_group->getChild(j));
639 HUD_deque.insert( HUD_deque.begin(), HIptr);
644 const SGPropertyNode * tbi_group = node->getNode("tbis");
645 if (tbi_group != 0) {
646 int nTbis = tbi_group->nChildren();
647 for (int j = 0; j < nTbis; j++) {
649 HIptr = readTBI(tbi_group->getChild(j));
650 HUD_deque.insert( HUD_deque.begin(), HIptr);
655 }//end readinstrument
657 int readHud( istream &input )
663 if (!readProperties(input, &root)) {
664 FG_LOG(FG_INPUT, FG_ALERT, "Malformed property list for hud.");
669 FG_LOG(FG_INPUT, FG_INFO, "Read properties for " <<
670 root.getStringValue("name"));
673 HUD_deque.erase( HUD_deque.begin(), HUD_deque.end()); // empty the HUD deque
676 FG_LOG(FG_INPUT, FG_INFO, "Reading Hud instruments");
678 const SGPropertyNode * instrument_group = root.getChild("instruments");
679 int nInstruments = instrument_group->nChildren();
681 for (int i = 0; i < nInstruments; i++) {
683 const SGPropertyNode * node = instrument_group->getChild(i);
685 FGPath path( globals->get_options()->get_fg_root() );
686 path.append(node->getStringValue("path"));
688 FG_LOG(FG_INPUT, FG_INFO, "Reading Instrument "
694 SGPropertyNode root2;
695 if (readProperties(path.str(), &root2)) {
697 readInstrument(&root2);
705 int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
711 FG_LOG( FG_COCKPIT, FG_INFO, "Initializing current aircraft HUD" );
714 globals->get_props()->getStringValue("/sim/hud/path",
715 "Huds/Default/default.xml");
716 FGPath path(globals->get_options()->get_fg_root());
717 path.append(hud_path);
719 ifstream input(path.c_str());
722 FG_LOG(FG_INPUT, FG_ALERT,
723 "Cannot read Hud configuration from " << path.str());
734 return 0; // For now. Later we may use this for an error code.
738 int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ )
743 FG_LOG( FG_COCKPIT, FG_INFO, "Initializing current aircraft HUD" );
745 FGPath path(globals->get_options()->get_fg_root());
746 path.append("Huds/Minimal/default.xml");
749 ifstream input(path.c_str());
751 FG_LOG(FG_INPUT, FG_ALERT,
752 "Cannot read Hud configuration from " << path.str());
759 return 0; // For now. Later we may use this for an error code.
762 //$$$ End - added, Neetha, 28 Nov 2k
764 int global_day_night_switch = DAY;
766 void HUD_masterswitch( bool incr )
768 if ( globals->get_options()->get_hud_status() ) {
769 if ( global_day_night_switch == DAY ) {
770 global_day_night_switch = NIGHT;
772 globals->get_options()->set_hud_status( false );
775 globals->get_options()->set_hud_status( true );
776 global_day_night_switch = DAY;
780 void HUD_brightkey( bool incr_bright )
782 instr_item *pHUDInstr = HUD_deque[0];
783 int brightness = pHUDInstr->get_brightness();
785 if( globals->get_options()->get_hud_status() ) {
790 brightness = BRT_BLACK;
794 brightness = BRT_LIGHT;
798 brightness = BRT_MEDIUM;
802 brightness = BRT_DARK;
806 brightness = BRT_BLACK;
812 brightness = BRT_MEDIUM;
816 brightness = BRT_DARK;
820 brightness = BRT_BLACK;
824 brightness = BRT_LIGHT;
828 globals->get_options()->set_hud_status(0);
832 globals->get_options()->set_hud_status(true);
835 pHUDInstr->SetBrightness( brightness );
839 #define fgAP_CLAMP(val,min,max) ( (val) = (val) > (max) ? (max) : (val) < (min) ? (min) : (val) )
841 static puDialogBox *HUDalphaDialog;
842 static puText *HUDalphaText;
843 static puSlider *HUDalphaHS0;
844 //static puText *HUDtextText;
845 //static puSlider *HUDalphaHS1;
846 static char SliderText[2][ 8 ];
848 static void alpha_adj( puObject *hs ) {
851 hs-> getValue ( &val ) ;
852 fgAP_CLAMP ( val, 0.1, 1.0 ) ;
853 // printf ( "maxroll_adj( %p ) %f %f\n", hs, val, MaxRollAdjust * val ) ;
854 hud_trans_alpha = val;
855 sprintf( SliderText[ 0 ], "%05.2f", hud_trans_alpha );
856 HUDalphaText -> setLabel ( SliderText[ 0 ] ) ;
859 void fgHUDalphaAdjust( puObject * ) {
860 globals->get_options()->set_anti_alias_hud(1);
861 FG_PUSH_PUI_DIALOG( HUDalphaDialog );
864 static void goAwayHUDalphaAdjust (puObject *)
866 FG_POP_PUI_DIALOG( HUDalphaDialog );
869 static void cancelHUDalphaAdjust (puObject *)
871 globals->get_options()->set_anti_alias_hud(0);
872 FG_POP_PUI_DIALOG( HUDalphaDialog );
875 // Done once at system initialization
876 void fgHUDalphaInit( void ) {
878 // printf("fgHUDalphaInit\n");
879 #define HORIZONTAL FALSE
883 int DialogWidth = 240;
885 char Label[] = "HUD Adjuster";
888 int labelX = (DialogWidth / 2) -
889 (puGetStringWidth( puGetDefaultLabelFont(), Label ) / 2);
894 int slider_width = 220;
895 int slider_title_x = 15;
896 int slider_value_x = 160;
897 float slider_delta = 0.05f;
899 puFont HUDalphaLegendFont;
900 puFont HUDalphaLabelFont;
901 puGetDefaultFonts ( &HUDalphaLegendFont, &HUDalphaLabelFont );
903 HUDalphaDialog = new puDialogBox ( DialogX, DialogY ); {
904 int horiz_slider_height = puGetStringHeight (HUDalphaLabelFont) +
905 puGetStringDescender (HUDalphaLabelFont) +
906 PUSTR_TGAP + PUSTR_BGAP + 5;
909 HUDalphaFrame = new puFrame ( 0, 0,
911 85 + nSliders * horiz_slider_height );
914 HUDalphaDialogMessage = new puText ( labelX,
916 * horiz_slider_height );
917 HUDalphaDialogMessage -> setDefaultValue ( Label );
918 HUDalphaDialogMessage -> getDefaultValue ( &s );
919 HUDalphaDialogMessage -> setLabel ( s );
921 HUDalphaHS0 = new puSlider ( slider_x, slider_y,
922 slider_width, HORIZONTAL ) ;
923 HUDalphaHS0-> setDelta ( slider_delta ) ;
924 HUDalphaHS0-> setValue ( hud_trans_alpha ) ;
925 HUDalphaHS0-> setCBMode ( PUSLIDER_DELTA ) ;
926 HUDalphaHS0-> setCallback ( alpha_adj ) ;
929 HUDalphaTitle = new puText ( slider_title_x, slider_y ) ;
930 HUDalphaTitle-> setDefaultValue ( "Alpha" ) ;
931 HUDalphaTitle-> getDefaultValue ( &s ) ;
932 HUDalphaTitle-> setLabel ( s ) ;
934 HUDalphaText = new puText ( slider_value_x, slider_y ) ;
935 sprintf( SliderText[ 0 ], "%05.2f", hud_trans_alpha );
936 HUDalphaText-> setLabel ( SliderText[ 0 ] ) ;
940 HUDalphaOkButton = new puOneShot ( 10, 10, 60, 45 );
941 HUDalphaOkButton-> setLegend ( gui_msg_OK );
942 HUDalphaOkButton-> makeReturnDefault ( TRUE );
943 HUDalphaOkButton-> setCallback ( goAwayHUDalphaAdjust );
946 HUDalphaNoButton = new puOneShot ( 160, 10, 230, 45 );
947 HUDalphaNoButton-> setLegend ( gui_msg_CANCEL );
948 HUDalphaNoButton-> setCallback ( cancelHUDalphaAdjust );
950 FG_FINALIZE_PUI_DIALOG( HUDalphaDialog );
955 void fgHUDReshape(void) {
959 HUD_TextSize = globals->get_options()->get_xsize() / 60;
961 HUDtext = new fntRenderer();
962 HUDtext -> setFont ( guiFntHandle ) ;
963 HUDtext -> setPointSize ( HUD_TextSize ) ;
964 HUD_TextList.setFont( HUDtext );
968 static void set_hud_color(float r, float g, float b) {
969 globals->get_options()->get_anti_alias_hud() ?
970 glColor4f(r,g,b,hud_trans_alpha) :
976 // Performs a once around the list of calls to instruments installed in
977 // the HUD object with requests for redraw. Kinda. It will when this is
980 void fgUpdateHUD( void ) {
982 // int day_night_sw = current_aircraft.controls->day_night_switch;
983 int day_night_sw = global_day_night_switch;
984 int hud_displays = HUD_deque.size();
985 instr_item *pHUDInstr;
988 if( !hud_displays ) { // Trust everyone, but ALWAYS cut the cards!
992 HUD_TextList.erase();
993 HUD_LineList.erase();
994 // HUD_StippleLineList.erase();
996 pHUDInstr = HUD_deque[0];
997 brightness = pHUDInstr->get_brightness();
998 // brightness = HUD_deque.at(0)->get_brightness();
1000 glMatrixMode(GL_PROJECTION);
1004 gluOrtho2D(0, 640, 0, 480);
1005 glMatrixMode(GL_MODELVIEW);
1009 glDisable(GL_DEPTH_TEST);
1010 glDisable(GL_LIGHTING);
1012 if( globals->get_options()->get_anti_alias_hud() ) {
1013 glEnable(GL_LINE_SMOOTH);
1014 // glEnable(GL_BLEND);
1015 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1016 glHint(GL_LINE_SMOOTH_HINT,GL_DONT_CARE);
1022 if( day_night_sw == DAY) {
1026 set_hud_color (0.1f, 0.9f, 0.1f);
1030 set_hud_color (0.1f, 0.7f, 0.0f);
1034 set_hud_color (0.0f, 0.6f, 0.0f);
1038 set_hud_color( 0.0f, 0.0f, 0.0f);
1042 set_hud_color (0.1f, 0.9f, 0.1f);
1045 if( day_night_sw == NIGHT) {
1049 set_hud_color (0.9f, 0.1f, 0.1f);
1053 set_hud_color (0.7f, 0.0f, 0.1f);
1057 set_hud_color (0.6f, 0.0f, 0.0f);
1061 set_hud_color( 0.0f, 0.0f, 0.0f);
1065 set_hud_color (0.6f, 0.0f, 0.0f);
1067 } else { // Just in case default
1068 set_hud_color (0.1f, 0.9f, 0.1f);
1072 deque < instr_item * > :: iterator current = HUD_deque.begin();
1073 deque < instr_item * > :: iterator last = HUD_deque.end();
1075 for ( ; current != last; ++current ) {
1076 pHUDInstr = *current;
1078 if( pHUDInstr->enabled()) {
1079 // fgPrintf( FG_COCKPIT, FG_DEBUG, "HUD Code %d Status %d\n",
1080 // hud->code, hud->status );
1086 char *gmt_str = get_formated_gmt_time();
1087 HUD_TextList.add( fgText(40, 10, gmt_str) );
1089 #ifdef FG_NETWORK_OLK
1090 if ( net_hud_display ) {
1097 // extern bool fgAPAltitudeEnabled( void );
1098 // extern bool fgAPHeadingEnabled( void );
1099 // extern bool fgAPWayPointEnabled( void );
1100 // extern char *fgAPget_TargetDistanceStr( void );
1101 // extern char *fgAPget_TargetHeadingStr( void );
1102 // extern char *fgAPget_TargetAltitudeStr( void );
1103 // extern char *fgAPget_TargetLatLonStr( void );
1106 // char scratch[128];
1107 // HUD_TextList.add( fgText( "AUTOPILOT", 20, apY) );
1109 if( current_autopilot->get_HeadingEnabled() ) {
1110 HUD_TextList.add( fgText( 40, apY,
1111 current_autopilot->get_TargetHeadingStr()) );
1114 if( current_autopilot->get_AltitudeEnabled() ) {
1115 HUD_TextList.add( fgText( 40, apY,
1116 current_autopilot->get_TargetAltitudeStr()) );
1119 if( current_autopilot->get_HeadingMode() ==
1120 FGAutopilot::FG_HEADING_WAYPOINT )
1123 wpstr = current_autopilot->get_TargetWP1Str();
1124 if ( strlen( wpstr ) ) {
1125 HUD_TextList.add( fgText( 40, apY, wpstr ) );
1128 wpstr = current_autopilot->get_TargetWP2Str();
1129 if ( strlen( wpstr ) ) {
1130 HUD_TextList.add( fgText( 40, apY, wpstr ) );
1133 wpstr = current_autopilot->get_TargetWP3Str();
1134 if ( strlen( wpstr ) ) {
1135 HUD_TextList.add( fgText( 40, apY, wpstr ) );
1140 HUD_TextList.draw();
1142 HUD_LineList.draw();
1144 // glEnable(GL_LINE_STIPPLE);
1145 // glLineStipple( 1, 0x00FF );
1146 // HUD_StippleLineList.draw();
1147 // glDisable(GL_LINE_STIPPLE);
1149 if( globals->get_options()->get_anti_alias_hud() ) {
1150 // glDisable(GL_BLEND);
1151 glDisable(GL_LINE_SMOOTH);
1155 glEnable(GL_DEPTH_TEST);
1156 glEnable(GL_LIGHTING);
1157 glMatrixMode(GL_PROJECTION);
1159 glMatrixMode(GL_MODELVIEW);