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.
23 #include <simgear/compiler.h>
34 # define exception c_exception
43 #include <simgear/constants.h>
44 #include <simgear/debug/logstream.hxx>
45 #include <simgear/misc/props.hxx>
46 //#include <simgear/math/fg_random.h>
47 //#include <simgear/math/polar3d.hxx>
49 #include <Aircraft/aircraft.hxx>
50 #include <Autopilot/newauto.hxx>
52 #include <Main/globals.hxx>
53 #include <Main/fg_props.hxx>
55 #include <NetworkOLK/network.h>
57 #include <Scenery/scenery.hxx>
58 //#include <Time/fg_timer.hxx>
60 #if defined ( __sun__ ) || defined ( __sgi )
62 extern void *memmove(void *, const void *, size_t);
70 // The following routines obtain information concerning the aircraft's
71 // current state and return it to calling instrument display routines.
72 // They should eventually be member functions of the aircraft.
75 deque< instr_item * > HUD_deque;
77 fgTextList HUD_TextList;
78 fgLineList HUD_LineList;
79 fgLineList HUD_StippleLineList;
81 fntRenderer *HUDtext = 0;
82 float HUD_TextSize = 0;
86 static float hud_trans_alpha = 0.67f;
89 //$$$ begin - added, Neetha, 28 Nov 2k
97 static float span_units;
98 static float division_units;
99 static float minor_division = 0;
100 static UINT screen_hole;
103 static string loadfn;
105 static float maxValue;
106 static float minValue;
107 static float scaling;
108 static UINT major_divs;
109 static UINT minor_divs;
110 static UINT modulator;
111 static int dp_showing = 0;
112 static string label_format;
113 static string prelabel;
114 static string postlabel;
117 static float maxBankAngle;
118 static float maxSlipAngle;
119 static UINT gap_width;
120 static bool latitude;
121 static bool longitude;
122 static bool tick_bottom;
123 static bool tick_top;
124 static bool tick_right;
125 static bool tick_left;
126 static bool cap_bottom;
128 static bool cap_right;
129 static bool cap_left;
130 static float marker_off;
132 static bool enable_pointer;
133 static string type_pointer;
134 static bool frl_spot;
136 static bool vel_vector;
140 static bool climb_dive;
142 static float glide_slope_val;
143 static bool worm_energy;
144 static bool waypoint;
146 static FLTFNPTR load_fn;
147 static fgLabelJust justification;
148 static const char *pre_label_string = 0;
149 static const char *post_label_string = 0;
151 int readHud( istream &input );
152 int readInstrument ( const SGPropertyNode * node);
153 static instr_item * readLadder ( const SGPropertyNode * node);
154 static instr_item * readCard ( const SGPropertyNode * node);
155 static instr_item * readLabel( const SGPropertyNode * node);
156 static instr_item * readTBI( const SGPropertyNode * node);
157 //$$$ end - added, Neetha, 28 Nov 2k
159 void fgHUDalphaInit( void );
165 locRECT( UINT left, UINT top, UINT right, UINT bottom);
166 RECT get_rect(void) { return rect;}
169 locRECT :: locRECT( UINT left, UINT top, UINT right, UINT bottom)
174 rect.bottom = bottom;
180 void drawOneLine( UINT x1, UINT y1, UINT x2, UINT y2)
188 void drawOneLine( RECT &rect)
191 glVertex2f(rect.left, rect.top);
192 glVertex2f(rect.right, rect.bottom);
197 // The following code deals with painting the "instrument" on the display
199 /* textString - Bitmap font string */
201 void textString( int x, int y, char *msg, void *font ){
205 // puDrawString ( NULL, msg, x, y );
208 glutBitmapCharacter(font, *msg);
215 /* strokeString - Stroke font string */
216 void strokeString(int x, int y, char *msg, void *font, float theta)
221 float sintheta,costheta;
227 glRotatef(theta * RAD_TO_DEG, 0.0, 0.0, 1.0);
228 sintheta = sin(theta);
229 costheta = cos(theta);
230 xx = (int)(x * costheta + y * sintheta);
231 yy = (int)(y * costheta - x * sintheta);
232 glTranslatef( xx, yy, 0);
233 glScalef(.1, .1, 0.0);
234 while( (c=*msg++) ) {
235 glutStrokeCharacter(font, c);
241 int getStringWidth ( char *str )
243 if ( HUDtext && str )
246 guiFntHandle->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
247 return FloatToInt( r - l );
253 //========================= End of Class Implementations===================
256 // Constructs a HUD object and then adds in instruments. At the present
257 // the instruments are hard coded into the routine. Ultimately these need
258 // to be defined by the aircraft's instrumentation records so that the
259 // display for a Piper Cub doesn't show the speed range of a North American
260 // mustange and the engine readouts of a B36!
265 //$$$ begin - added, Neetha, 28 Nov 2k
267 readLadder(const SGPropertyNode * node)
272 name = node->getStringValue("name");
273 x = node->getIntValue("x");
274 y = node->getIntValue("y");
275 width = node->getIntValue("width");
276 height = node->getIntValue("height");
277 factor = node->getFloatValue("compression_factor");
278 span_units = node->getFloatValue("span_units");
279 division_units = node->getFloatValue("division_units");
280 screen_hole = node->getIntValue("screen_hole");
281 lbl_pos = node->getIntValue("lbl_pos");
282 frl_spot = node->getBoolValue("enable_frl",false);
283 target = node->getBoolValue("enable_target_spot",false);
284 vel_vector = node->getBoolValue("enable_velocity_vector",false);
285 drift = node->getBoolValue("enable_drift_marker",false);
286 alpha = node->getBoolValue("enable_alpha_bracket",false);
287 energy = node->getBoolValue("enable_energy_marker",false);
288 climb_dive = node->getBoolValue("enable_climb_dive_marker",false);
289 glide = node->getBoolValue("enable_glide_slope_marker",false);
290 glide_slope_val = node->getFloatValue("glide_slope",-4.0);
291 worm_energy = node->getBoolValue("enable_energy_marker",false);
292 waypoint = node->getBoolValue("enable_waypoint_marker",false);
293 working = node->getBoolValue("working");
295 FG_LOG(FG_INPUT, FG_INFO, "Done reading instrument " << name);
298 p = (instr_item *) new HudLadder( name, x, y,
299 width, height, factor,
301 span_units, division_units, minor_division,
302 screen_hole, lbl_pos, frl_spot, target, vel_vector,
303 drift, alpha, energy, climb_dive,
304 glide, glide_slope_val, worm_energy,
312 readCard(const SGPropertyNode * node)
317 name = node->getStringValue("name");
318 x = node->getIntValue("x");
319 y = node->getIntValue("y");
320 width = node->getIntValue("width");
321 height = node->getIntValue("height");
322 loadfn = node->getStringValue("loadfn");
323 options = node->getIntValue("options");
324 maxValue = node->getFloatValue("maxValue");
325 minValue = node->getFloatValue("minValue");
326 scaling = node->getFloatValue("disp_scaling");
327 major_divs = node->getIntValue("major_divs");
328 minor_divs = node->getIntValue("minor_divs");
329 modulator = node->getIntValue("modulator");
330 span_units = node->getFloatValue("value_span");
331 type = node->getStringValue("type");
332 tick_bottom = node->getBoolValue("tick_bottom",false);
333 tick_top = node->getBoolValue("tick_top",false);
334 tick_right = node->getBoolValue("tick_right",false);
335 tick_left = node->getBoolValue("tick_left",false);
336 cap_bottom = node->getBoolValue("cap_bottom",false);
337 cap_top = node->getBoolValue("cap_top",false);
338 cap_right = node->getBoolValue("cap_right",false);
339 cap_left = node->getBoolValue("cap_left",false);
340 marker_off = node->getFloatValue("marker_offset",0.0);
341 enable_pointer = node->getBoolValue("enable_pointer",true);
342 type_pointer = node->getStringValue("pointer_type");
343 working = node->getBoolValue("working");
346 FG_LOG(FG_INPUT, FG_INFO, "Done reading instrument " << name);
350 span_units = maxValue - minValue;
355 if(loadfn=="heading")
356 load_fn = get_heading;
362 load_fn = get_climb_rate;
364 if(loadfn=="altitude")
365 load_fn = get_altitude;
373 if(loadfn=="view_direction")
374 load_fn = get_view_direction;
376 if(loadfn=="aileronval")
377 load_fn = get_aileronval;
379 if(loadfn=="elevatorval")
380 load_fn = get_elevatorval;
382 if(loadfn=="rudderval")
383 load_fn = get_rudderval;
385 if(loadfn=="throttleval")
386 load_fn = get_throttleval;
389 p = (instr_item *) new hud_card( x,
397 major_divs, minor_divs,
418 readLabel(const SGPropertyNode * node)
422 int font_size = (fgGetInt("/sim/startup/xsize") > 1000) ? LARGE : SMALL;
424 name = node->getStringValue("name");
425 x = node->getIntValue("x");
426 y = node->getIntValue("y");
427 width = node->getIntValue("width");
428 height = node->getIntValue("height");
429 loadfn = node->getStringValue("data_source");
430 label_format = node->getStringValue("label_format");
431 prelabel = node->getStringValue("pre_label_string");
432 postlabel = node->getStringValue("post_label_string");
433 scaling = node->getFloatValue("scale_data");
434 options = node->getIntValue("options");
435 justi = node->getIntValue("justification");
436 blinking = node->getIntValue("blinking");
437 latitude = node->getBoolValue("latitude",false);
438 longitude = node->getBoolValue("longitude",false);
439 working = node->getBoolValue("working");
442 FG_LOG(FG_INPUT, FG_INFO, "Done reading instrument " << name);
446 justification = LEFT_JUST;
449 justification = CENTER_JUST;
452 justification = RIGHT_JUST;
456 pre_label_string = NULL;
458 if(prelabel=="blank")
459 pre_label_string = " ";
461 pre_label_string = prelabel.c_str();
464 if(postlabel=="blank")
465 post_label_string = " ";
467 if(postlabel=="NULL")
468 post_label_string = NULL;
470 if(postlabel=="units")
471 post_label_string = units;
473 post_label_string = postlabel.c_str();
515 if(loadfn=="altitude")
516 load_fn = get_altitude;
521 if(loadfn=="framerate")
522 load_fn = get_frame_rate;
524 if(loadfn=="heading")
525 load_fn = get_heading;
530 if(loadfn=="vfc_tris_culled")
531 load_fn = get_vfc_tris_culled;
533 if(loadfn=="vfc_tris_drawn")
534 load_fn = get_vfc_tris_drawn;
539 if(loadfn=="latitude")
540 load_fn = get_latitude;
542 if(loadfn=="longitude")
543 load_fn = get_longitude;
546 p = (instr_item *) new instr_label ( x,
551 label_format.c_str(),
568 readTBI(const SGPropertyNode * node)
573 name = node->getStringValue("name");
574 x = node->getIntValue("x");
575 y = node->getIntValue("y");
576 width = node->getIntValue("width");
577 height = node->getIntValue("height");
578 maxBankAngle = node->getFloatValue("maxBankAngle");
579 maxSlipAngle = node->getFloatValue("maxSlipAngle");
580 gap_width = node->getIntValue("gap_width");
581 working = node->getBoolValue("working");
583 FG_LOG(FG_INPUT, FG_INFO, "Done reading instrument " << name);
586 p = (instr_item *) new fgTBI_instr( x,
601 int readInstrument(const SGPropertyNode * node)
606 if ( fgGetString("/sim/startup/units") == "feet" ) {
607 strcpy(units, " ft");
612 const SGPropertyNode * ladder_group = node->getNode("ladders");
614 if (ladder_group != 0) {
615 int nLadders = ladder_group->nChildren();
616 for (int j = 0; j < nLadders; j++) {
618 HIptr = readLadder(ladder_group->getChild(j));
619 HUD_deque.insert( HUD_deque.begin(), HIptr);
624 const SGPropertyNode * card_group = node->getNode("cards");
625 if (card_group != 0) {
626 int nCards = card_group->nChildren();
627 for (int j = 0; j < nCards; j++) {
629 HIptr = readCard(card_group->getChild(j));
630 HUD_deque.insert( HUD_deque.begin(), HIptr);
635 const SGPropertyNode * label_group = node->getNode("labels");
636 if (label_group != 0) {
637 int nLabels = label_group->nChildren();
638 for (int j = 0; j < nLabels; j++) {
640 HIptr = readLabel(label_group->getChild(j));
641 HUD_deque.insert( HUD_deque.begin(), HIptr);
646 const SGPropertyNode * tbi_group = node->getNode("tbis");
647 if (tbi_group != 0) {
648 int nTbis = tbi_group->nChildren();
649 for (int j = 0; j < nTbis; j++) {
651 HIptr = readTBI(tbi_group->getChild(j));
652 HUD_deque.insert( HUD_deque.begin(), HIptr);
657 }//end readinstrument
659 int readHud( istream &input )
665 if (!readProperties(input, &root)) {
666 FG_LOG(FG_INPUT, FG_ALERT, "Malformed property list for hud.");
671 FG_LOG(FG_INPUT, FG_INFO, "Read properties for " <<
672 root.getStringValue("name"));
675 HUD_deque.erase( HUD_deque.begin(), HUD_deque.end()); // empty the HUD deque
678 FG_LOG(FG_INPUT, FG_INFO, "Reading Hud instruments");
680 const SGPropertyNode * instrument_group = root.getChild("instruments");
681 int nInstruments = instrument_group->nChildren();
683 for (int i = 0; i < nInstruments; i++) {
685 const SGPropertyNode * node = instrument_group->getChild(i);
687 FGPath path( globals->get_fg_root() );
688 path.append(node->getStringValue("path"));
690 FG_LOG(FG_INPUT, FG_INFO, "Reading Instrument "
696 SGPropertyNode root2;
697 if (readProperties(path.str(), &root2)) {
699 readInstrument(&root2);
707 int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
713 FG_LOG( FG_COCKPIT, FG_INFO, "Initializing current aircraft HUD" );
716 fgGetString("/sim/hud/path", "Huds/Default/default.xml");
717 FGPath path(globals->get_fg_root());
718 path.append(hud_path);
720 ifstream input(path.c_str());
723 FG_LOG(FG_INPUT, FG_ALERT,
724 "Cannot read Hud configuration from " << path.str());
735 return 0; // For now. Later we may use this for an error code.
739 int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ )
744 FG_LOG( FG_COCKPIT, FG_INFO, "Initializing current aircraft HUD" );
746 FGPath path(globals->get_fg_root());
747 path.append("Huds/Minimal/default.xml");
750 ifstream input(path.c_str());
752 FG_LOG(FG_INPUT, FG_ALERT,
753 "Cannot read Hud configuration from " << path.str());
760 return 0; // For now. Later we may use this for an error code.
763 //$$$ End - added, Neetha, 28 Nov 2k
765 static int global_day_night_switch = DAY;
767 void HUD_masterswitch( bool incr )
769 if ( fgGetBool("/sim/hud/visibility") ) {
770 if ( global_day_night_switch == DAY ) {
771 global_day_night_switch = NIGHT;
773 fgSetBool("/sim/hud/visibility", false);
776 fgSetBool("/sim/hud/visibility", true);
777 global_day_night_switch = DAY;
781 void HUD_brightkey( bool incr_bright )
783 instr_item *pHUDInstr = HUD_deque[0];
784 int brightness = pHUDInstr->get_brightness();
786 if( fgGetBool("/sim/hud/visibility") ) {
791 brightness = BRT_BLACK;
795 brightness = BRT_LIGHT;
799 brightness = BRT_MEDIUM;
803 brightness = BRT_DARK;
807 brightness = BRT_BLACK;
813 brightness = BRT_MEDIUM;
817 brightness = BRT_DARK;
821 brightness = BRT_BLACK;
825 brightness = BRT_LIGHT;
829 fgSetBool("/sim/hud/visibility", false);
833 fgSetBool("/sim/hud/visibility", true);
836 pHUDInstr->SetBrightness( brightness );
840 #define fgAP_CLAMP(val,min,max) ( (val) = (val) > (max) ? (max) : (val) < (min) ? (min) : (val) )
842 static puDialogBox *HUDalphaDialog;
843 static puText *HUDalphaText;
844 static puSlider *HUDalphaHS0;
845 //static puText *HUDtextText;
846 //static puSlider *HUDalphaHS1;
847 static char SliderText[2][ 8 ];
849 static void alpha_adj( puObject *hs ) {
852 hs-> getValue ( &val ) ;
853 fgAP_CLAMP ( val, 0.1, 1.0 ) ;
854 // printf ( "maxroll_adj( %p ) %f %f\n", hs, val, MaxRollAdjust * val ) ;
855 hud_trans_alpha = val;
856 sprintf( SliderText[ 0 ], "%05.2f", hud_trans_alpha );
857 HUDalphaText -> setLabel ( SliderText[ 0 ] ) ;
860 void fgHUDalphaAdjust( puObject * ) {
861 fgSetBool("/sim/hud/antialiased", true);
862 FG_PUSH_PUI_DIALOG( HUDalphaDialog );
865 static void goAwayHUDalphaAdjust (puObject *)
867 FG_POP_PUI_DIALOG( HUDalphaDialog );
870 static void cancelHUDalphaAdjust (puObject *)
872 fgSetBool("/sim/hud/antialiased", false);
873 FG_POP_PUI_DIALOG( HUDalphaDialog );
876 // Done once at system initialization
877 void fgHUDalphaInit( void ) {
879 // printf("fgHUDalphaInit\n");
880 #define HORIZONTAL FALSE
884 int DialogWidth = 240;
886 char Label[] = "HUD Adjuster";
889 int labelX = (DialogWidth / 2) -
890 (puGetStringWidth( puGetDefaultLabelFont(), Label ) / 2);
895 int slider_width = 220;
896 int slider_title_x = 15;
897 int slider_value_x = 160;
898 float slider_delta = 0.05f;
900 puFont HUDalphaLegendFont;
901 puFont HUDalphaLabelFont;
902 puGetDefaultFonts ( &HUDalphaLegendFont, &HUDalphaLabelFont );
904 HUDalphaDialog = new puDialogBox ( DialogX, DialogY ); {
905 int horiz_slider_height = puGetStringHeight (HUDalphaLabelFont) +
906 puGetStringDescender (HUDalphaLabelFont) +
907 PUSTR_TGAP + PUSTR_BGAP + 5;
910 HUDalphaFrame = new puFrame ( 0, 0,
912 85 + nSliders * horiz_slider_height );
915 HUDalphaDialogMessage = new puText ( labelX,
917 * horiz_slider_height );
918 HUDalphaDialogMessage -> setDefaultValue ( Label );
919 HUDalphaDialogMessage -> getDefaultValue ( &s );
920 HUDalphaDialogMessage -> setLabel ( s );
922 HUDalphaHS0 = new puSlider ( slider_x, slider_y,
923 slider_width, HORIZONTAL ) ;
924 HUDalphaHS0-> setDelta ( slider_delta ) ;
925 HUDalphaHS0-> setValue ( hud_trans_alpha ) ;
926 HUDalphaHS0-> setCBMode ( PUSLIDER_DELTA ) ;
927 HUDalphaHS0-> setCallback ( alpha_adj ) ;
930 HUDalphaTitle = new puText ( slider_title_x, slider_y ) ;
931 HUDalphaTitle-> setDefaultValue ( "Alpha" ) ;
932 HUDalphaTitle-> getDefaultValue ( &s ) ;
933 HUDalphaTitle-> setLabel ( s ) ;
935 HUDalphaText = new puText ( slider_value_x, slider_y ) ;
936 sprintf( SliderText[ 0 ], "%05.2f", hud_trans_alpha );
937 HUDalphaText-> setLabel ( SliderText[ 0 ] ) ;
941 HUDalphaOkButton = new puOneShot ( 10, 10, 60, 45 );
942 HUDalphaOkButton-> setLegend ( gui_msg_OK );
943 HUDalphaOkButton-> makeReturnDefault ( TRUE );
944 HUDalphaOkButton-> setCallback ( goAwayHUDalphaAdjust );
947 HUDalphaNoButton = new puOneShot ( 160, 10, 230, 45 );
948 HUDalphaNoButton-> setLegend ( gui_msg_CANCEL );
949 HUDalphaNoButton-> setCallback ( cancelHUDalphaAdjust );
951 FG_FINALIZE_PUI_DIALOG( HUDalphaDialog );
956 void fgHUDReshape(void) {
960 HUD_TextSize = fgGetInt("/sim/startup/xsize") / 60;
962 HUDtext = new fntRenderer();
963 HUDtext -> setFont ( guiFntHandle ) ;
964 HUDtext -> setPointSize ( HUD_TextSize ) ;
965 HUD_TextList.setFont( HUDtext );
969 static void set_hud_color(float r, float g, float b) {
970 fgGetBool("/sim/hud/antialiased") ?
971 glColor4f(r,g,b,hud_trans_alpha) :
977 // Performs a once around the list of calls to instruments installed in
978 // the HUD object with requests for redraw. Kinda. It will when this is
981 void fgUpdateHUD( void ) {
983 // int day_night_sw = current_aircraft.controls->day_night_switch;
984 int day_night_sw = global_day_night_switch;
985 int hud_displays = HUD_deque.size();
986 instr_item *pHUDInstr;
989 if( !hud_displays ) { // Trust everyone, but ALWAYS cut the cards!
993 HUD_TextList.erase();
994 HUD_LineList.erase();
995 // HUD_StippleLineList.erase();
997 pHUDInstr = HUD_deque[0];
998 brightness = pHUDInstr->get_brightness();
999 // brightness = HUD_deque.at(0)->get_brightness();
1001 glMatrixMode(GL_PROJECTION);
1005 gluOrtho2D(0, 640, 0, 480);
1006 glMatrixMode(GL_MODELVIEW);
1010 glDisable(GL_DEPTH_TEST);
1011 glDisable(GL_LIGHTING);
1013 if( fgGetBool("/sim/hud/antialiased") ) {
1014 glEnable(GL_LINE_SMOOTH);
1015 // glEnable(GL_BLEND);
1016 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
1017 glHint(GL_LINE_SMOOTH_HINT,GL_DONT_CARE);
1023 if( day_night_sw == DAY) {
1027 set_hud_color (0.1f, 0.9f, 0.1f);
1031 set_hud_color (0.1f, 0.7f, 0.0f);
1035 set_hud_color (0.0f, 0.6f, 0.0f);
1039 set_hud_color( 0.0f, 0.0f, 0.0f);
1043 set_hud_color (0.1f, 0.9f, 0.1f);
1046 if( day_night_sw == NIGHT) {
1050 set_hud_color (0.9f, 0.1f, 0.1f);
1054 set_hud_color (0.7f, 0.0f, 0.1f);
1058 set_hud_color (0.6f, 0.0f, 0.0f);
1062 set_hud_color( 0.0f, 0.0f, 0.0f);
1066 set_hud_color (0.6f, 0.0f, 0.0f);
1068 } else { // Just in case default
1069 set_hud_color (0.1f, 0.9f, 0.1f);
1073 deque < instr_item * > :: iterator current = HUD_deque.begin();
1074 deque < instr_item * > :: iterator last = HUD_deque.end();
1076 for ( ; current != last; ++current ) {
1077 pHUDInstr = *current;
1079 if( pHUDInstr->enabled()) {
1080 // fgPrintf( FG_COCKPIT, FG_DEBUG, "HUD Code %d Status %d\n",
1081 // hud->code, hud->status );
1087 char *gmt_str = get_formated_gmt_time();
1088 HUD_TextList.add( fgText(40, 10, gmt_str) );
1090 #ifdef FG_NETWORK_OLK
1091 if ( net_hud_display ) {
1098 // extern bool fgAPAltitudeEnabled( void );
1099 // extern bool fgAPHeadingEnabled( void );
1100 // extern bool fgAPWayPointEnabled( void );
1101 // extern char *fgAPget_TargetDistanceStr( void );
1102 // extern char *fgAPget_TargetHeadingStr( void );
1103 // extern char *fgAPget_TargetAltitudeStr( void );
1104 // extern char *fgAPget_TargetLatLonStr( void );
1107 // char scratch[128];
1108 // HUD_TextList.add( fgText( "AUTOPILOT", 20, apY) );
1110 if( current_autopilot->get_HeadingEnabled() ) {
1111 HUD_TextList.add( fgText( 40, apY,
1112 current_autopilot->get_TargetHeadingStr()) );
1115 if( current_autopilot->get_AltitudeEnabled() ) {
1116 HUD_TextList.add( fgText( 40, apY,
1117 current_autopilot->get_TargetAltitudeStr()) );
1120 if( current_autopilot->get_HeadingMode() ==
1121 FGAutopilot::FG_HEADING_WAYPOINT )
1124 wpstr = current_autopilot->get_TargetWP1Str();
1125 if ( strlen( wpstr ) ) {
1126 HUD_TextList.add( fgText( 40, apY, wpstr ) );
1129 wpstr = current_autopilot->get_TargetWP2Str();
1130 if ( strlen( wpstr ) ) {
1131 HUD_TextList.add( fgText( 40, apY, wpstr ) );
1134 wpstr = current_autopilot->get_TargetWP3Str();
1135 if ( strlen( wpstr ) ) {
1136 HUD_TextList.add( fgText( 40, apY, wpstr ) );
1141 HUD_TextList.draw();
1143 HUD_LineList.draw();
1145 // glEnable(GL_LINE_STIPPLE);
1146 // glLineStipple( 1, 0x00FF );
1147 // HUD_StippleLineList.draw();
1148 // glDisable(GL_LINE_STIPPLE);
1150 if( fgGetBool("/sim/hud/antialiased") ) {
1151 // glDisable(GL_BLEND);
1152 glDisable(GL_LINE_SMOOTH);
1156 glEnable(GL_DEPTH_TEST);
1157 glEnable(GL_LIGHTING);
1158 glMatrixMode(GL_PROJECTION);
1160 glMatrixMode(GL_MODELVIEW);