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>
54 #include <NetworkOLK/network.h>
56 #include <Scenery/scenery.hxx>
57 //#include <Time/fg_timer.hxx>
59 #if defined ( __sun__ ) || defined ( __sgi )
61 extern void *memmove(void *, const void *, size_t);
69 // The following routines obtain information concerning the aircraft's
70 // current state and return it to calling instrument display routines.
71 // They should eventually be member functions of the aircraft.
74 deque< instr_item * > HUD_deque;
76 fgTextList HUD_TextList;
77 fgLineList HUD_LineList;
78 fgLineList HUD_StippleLineList;
80 fntRenderer *HUDtext = 0;
81 float HUD_TextSize = 0;
85 static float hud_trans_alpha = 0.67f;
88 //$$$ begin - added, Neetha, 28 Nov 2k
96 static float span_units;
97 static float division_units;
98 static float minor_division = 0;
99 static UINT screen_hole;
102 static string loadfn;
104 static float maxValue;
105 static float minValue;
106 static float scaling;
107 static UINT major_divs;
108 static UINT minor_divs;
109 static UINT modulator;
110 static int dp_showing = 0;
111 static string label_format;
112 static string prelabel;
113 static string postlabel;
116 static float maxBankAngle;
117 static float maxSlipAngle;
118 static UINT gap_width;
119 static bool latitude;
120 static bool longitude;
121 static bool tick_bottom;
122 static bool tick_top;
123 static bool tick_right;
124 static bool tick_left;
125 static bool cap_bottom;
127 static bool cap_right;
128 static bool cap_left;
129 static float marker_off;
131 static bool enable_pointer;
132 static string type_pointer;
133 static bool frl_spot;
135 static bool vel_vector;
139 static bool climb_dive;
141 static float glide_slope_val;
142 static bool worm_energy;
143 static bool waypoint;
145 static FLTFNPTR load_fn;
146 static fgLabelJust justification;
147 static const char *pre_label_string = 0;
148 static const char *post_label_string = 0;
150 int readHud( istream &input );
151 int readInstrument ( const SGPropertyNode * node);
152 static instr_item * readLadder ( const SGPropertyNode * node);
153 static instr_item * readCard ( const SGPropertyNode * node);
154 static instr_item * readLabel( const SGPropertyNode * node);
155 static instr_item * readTBI( const SGPropertyNode * node);
156 //$$$ end - added, Neetha, 28 Nov 2k
158 void fgHUDalphaInit( void );
164 locRECT( UINT left, UINT top, UINT right, UINT bottom);
165 RECT get_rect(void) { return rect;}
168 locRECT :: locRECT( UINT left, UINT top, UINT right, UINT bottom)
173 rect.bottom = bottom;
179 void drawOneLine( UINT x1, UINT y1, UINT x2, UINT y2)
187 void drawOneLine( RECT &rect)
190 glVertex2f(rect.left, rect.top);
191 glVertex2f(rect.right, rect.bottom);
196 // The following code deals with painting the "instrument" on the display
198 /* textString - Bitmap font string */
200 void textString( int x, int y, char *msg, void *font ){
204 // puDrawString ( NULL, msg, x, y );
207 glutBitmapCharacter(font, *msg);
214 /* strokeString - Stroke font string */
215 void strokeString(int x, int y, char *msg, void *font, float theta)
220 float sintheta,costheta;
226 glRotatef(theta * RAD_TO_DEG, 0.0, 0.0, 1.0);
227 sintheta = sin(theta);
228 costheta = cos(theta);
229 xx = (int)(x * costheta + y * sintheta);
230 yy = (int)(y * costheta - x * sintheta);
231 glTranslatef( xx, yy, 0);
232 glScalef(.1, .1, 0.0);
233 while( (c=*msg++) ) {
234 glutStrokeCharacter(font, c);
240 int getStringWidth ( char *str )
242 if ( HUDtext && str )
245 guiFntHandle->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
246 return FloatToInt( r - l );
252 //========================= End of Class Implementations===================
255 // Constructs a HUD object and then adds in instruments. At the present
256 // the instruments are hard coded into the routine. Ultimately these need
257 // to be defined by the aircraft's instrumentation records so that the
258 // display for a Piper Cub doesn't show the speed range of a North American
259 // mustange and the engine readouts of a B36!
264 //$$$ begin - added, Neetha, 28 Nov 2k
266 readLadder(const SGPropertyNode * node)
271 name = node->getStringValue("name");
272 x = node->getIntValue("x");
273 y = node->getIntValue("y");
274 width = node->getIntValue("width");
275 height = node->getIntValue("height");
276 factor = node->getFloatValue("compression_factor");
277 span_units = node->getFloatValue("span_units");
278 division_units = node->getFloatValue("division_units");
279 screen_hole = node->getIntValue("screen_hole");
280 lbl_pos = node->getIntValue("lbl_pos");
281 frl_spot = node->getBoolValue("enable_frl",false);
282 target = node->getBoolValue("enable_target_spot",false);
283 vel_vector = node->getBoolValue("enable_velocity_vector",false);
284 drift = node->getBoolValue("enable_drift_marker",false);
285 alpha = node->getBoolValue("enable_alpha_bracket",false);
286 energy = node->getBoolValue("enable_energy_marker",false);
287 climb_dive = node->getBoolValue("enable_climb_dive_marker",false);
288 glide = node->getBoolValue("enable_glide_slope_marker",false);
289 glide_slope_val = node->getFloatValue("glide_slope",-4.0);
290 worm_energy = node->getBoolValue("enable_energy_marker",false);
291 waypoint = node->getBoolValue("enable_waypoint_marker",false);
292 working = node->getBoolValue("working");
294 FG_LOG(FG_INPUT, FG_INFO, "Done reading instrument " << name);
297 p = (instr_item *) new HudLadder( name, x, y,
298 width, height, factor,
300 span_units, division_units, minor_division,
301 screen_hole, lbl_pos, frl_spot, target, vel_vector,
302 drift, alpha, energy, climb_dive,
303 glide, glide_slope_val, worm_energy,
311 readCard(const SGPropertyNode * node)
316 name = node->getStringValue("name");
317 x = node->getIntValue("x");
318 y = node->getIntValue("y");
319 width = node->getIntValue("width");
320 height = node->getIntValue("height");
321 loadfn = node->getStringValue("loadfn");
322 options = node->getIntValue("options");
323 maxValue = node->getFloatValue("maxValue");
324 minValue = node->getFloatValue("minValue");
325 scaling = node->getFloatValue("disp_scaling");
326 major_divs = node->getIntValue("major_divs");
327 minor_divs = node->getIntValue("minor_divs");
328 modulator = node->getIntValue("modulator");
329 span_units = node->getFloatValue("value_span");
330 type = node->getStringValue("type");
331 tick_bottom = node->getBoolValue("tick_bottom",false);
332 tick_top = node->getBoolValue("tick_top",false);
333 tick_right = node->getBoolValue("tick_right",false);
334 tick_left = node->getBoolValue("tick_left",false);
335 cap_bottom = node->getBoolValue("cap_bottom",false);
336 cap_top = node->getBoolValue("cap_top",false);
337 cap_right = node->getBoolValue("cap_right",false);
338 cap_left = node->getBoolValue("cap_left",false);
339 marker_off = node->getFloatValue("marker_offset",0.0);
340 enable_pointer = node->getBoolValue("enable_pointer",true);
341 type_pointer = node->getStringValue("pointer_type");
342 working = node->getBoolValue("working");
345 FG_LOG(FG_INPUT, FG_INFO, "Done reading instrument " << name);
349 span_units = maxValue - minValue;
354 if(loadfn=="heading")
355 load_fn = get_heading;
361 load_fn = get_climb_rate;
363 if(loadfn=="altitude")
364 load_fn = get_altitude;
372 if(loadfn=="view_direction")
373 load_fn = get_view_direction;
375 if(loadfn=="aileronval")
376 load_fn = get_aileronval;
378 if(loadfn=="elevatorval")
379 load_fn = get_elevatorval;
381 if(loadfn=="rudderval")
382 load_fn = get_rudderval;
384 if(loadfn=="throttleval")
385 load_fn = get_throttleval;
388 p = (instr_item *) new hud_card( x,
396 major_divs, minor_divs,
417 readLabel(const SGPropertyNode * node)
421 int font_size = (globals->get_options()->get_xsize() > 1000) ? LARGE : SMALL;
423 name = node->getStringValue("name");
424 x = node->getIntValue("x");
425 y = node->getIntValue("y");
426 width = node->getIntValue("width");
427 height = node->getIntValue("height");
428 loadfn = node->getStringValue("data_source");
429 label_format = node->getStringValue("label_format");
430 prelabel = node->getStringValue("pre_label_string");
431 postlabel = node->getStringValue("post_label_string");
432 scaling = node->getFloatValue("scale_data");
433 options = node->getIntValue("options");
434 justi = node->getIntValue("justification");
435 blinking = node->getIntValue("blinking");
436 latitude = node->getBoolValue("latitude",false);
437 longitude = node->getBoolValue("longitude",false);
438 working = node->getBoolValue("working");
441 FG_LOG(FG_INPUT, FG_INFO, "Done reading instrument " << name);
445 justification = LEFT_JUST;
448 justification = CENTER_JUST;
451 justification = RIGHT_JUST;
455 pre_label_string = NULL;
457 if(prelabel=="blank")
458 pre_label_string = " ";
460 pre_label_string = prelabel.c_str();
463 if(postlabel=="blank")
464 post_label_string = " ";
466 if(postlabel=="NULL")
467 post_label_string = NULL;
469 if(postlabel=="units")
470 post_label_string = units;
472 post_label_string = postlabel.c_str();
514 if(loadfn=="altitude")
515 load_fn = get_altitude;
520 if(loadfn=="framerate")
521 load_fn = get_frame_rate;
523 if(loadfn=="heading")
524 load_fn = get_heading;
529 if(loadfn=="vfc_tris_culled")
530 load_fn = get_vfc_tris_culled;
532 if(loadfn=="vfc_tris_drawn")
533 load_fn = get_vfc_tris_drawn;
538 if(loadfn=="latitude")
539 load_fn = get_latitude;
541 if(loadfn=="longitude")
542 load_fn = get_longitude;
545 p = (instr_item *) new instr_label ( x,
550 label_format.c_str(),
567 readTBI(const SGPropertyNode * node)
572 name = node->getStringValue("name");
573 x = node->getIntValue("x");
574 y = node->getIntValue("y");
575 width = node->getIntValue("width");
576 height = node->getIntValue("height");
577 maxBankAngle = node->getFloatValue("maxBankAngle");
578 maxSlipAngle = node->getFloatValue("maxSlipAngle");
579 gap_width = node->getIntValue("gap_width");
580 working = node->getBoolValue("working");
582 FG_LOG(FG_INPUT, FG_INFO, "Done reading instrument " << name);
585 p = (instr_item *) new fgTBI_instr( x,
600 int readInstrument(const SGPropertyNode * node)
605 if ( globals->get_options()->get_units() == FGOptions::FG_UNITS_FEET ) {
606 strcpy(units, " ft");
611 const SGPropertyNode * ladder_group = node->getNode("ladders");
613 if (ladder_group != 0) {
614 int nLadders = ladder_group->nChildren();
615 for (int j = 0; j < nLadders; j++) {
617 HIptr = readLadder(ladder_group->getChild(j));
618 HUD_deque.insert( HUD_deque.begin(), HIptr);
623 const SGPropertyNode * card_group = node->getNode("cards");
624 if (card_group != 0) {
625 int nCards = card_group->nChildren();
626 for (int j = 0; j < nCards; j++) {
628 HIptr = readCard(card_group->getChild(j));
629 HUD_deque.insert( HUD_deque.begin(), HIptr);
634 const SGPropertyNode * label_group = node->getNode("labels");
635 if (label_group != 0) {
636 int nLabels = label_group->nChildren();
637 for (int j = 0; j < nLabels; j++) {
639 HIptr = readLabel(label_group->getChild(j));
640 HUD_deque.insert( HUD_deque.begin(), HIptr);
645 const SGPropertyNode * tbi_group = node->getNode("tbis");
646 if (tbi_group != 0) {
647 int nTbis = tbi_group->nChildren();
648 for (int j = 0; j < nTbis; j++) {
650 HIptr = readTBI(tbi_group->getChild(j));
651 HUD_deque.insert( HUD_deque.begin(), HIptr);
656 }//end readinstrument
658 int readHud( istream &input )
664 if (!readProperties(input, &root)) {
665 FG_LOG(FG_INPUT, FG_ALERT, "Malformed property list for hud.");
670 FG_LOG(FG_INPUT, FG_INFO, "Read properties for " <<
671 root.getStringValue("name"));
674 HUD_deque.erase( HUD_deque.begin(), HUD_deque.end()); // empty the HUD deque
677 FG_LOG(FG_INPUT, FG_INFO, "Reading Hud instruments");
679 const SGPropertyNode * instrument_group = root.getChild("instruments");
680 int nInstruments = instrument_group->nChildren();
682 for (int i = 0; i < nInstruments; i++) {
684 const SGPropertyNode * node = instrument_group->getChild(i);
686 FGPath path( globals->get_options()->get_fg_root() );
687 path.append(node->getStringValue("path"));
689 FG_LOG(FG_INPUT, FG_INFO, "Reading Instrument "
695 SGPropertyNode root2;
696 if (readProperties(path.str(), &root2)) {
698 readInstrument(&root2);
706 int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
712 FG_LOG( FG_COCKPIT, FG_INFO, "Initializing current aircraft HUD" );
715 globals->get_props()->getStringValue("/sim/hud/path",
716 "Huds/Default/default.xml");
717 FGPath path(globals->get_options()->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_options()->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 int global_day_night_switch = DAY;
767 void HUD_masterswitch( bool incr )
769 if ( globals->get_options()->get_hud_status() ) {
770 if ( global_day_night_switch == DAY ) {
771 global_day_night_switch = NIGHT;
773 globals->get_options()->set_hud_status( false );
776 globals->get_options()->set_hud_status( 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( globals->get_options()->get_hud_status() ) {
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 globals->get_options()->set_hud_status(0);
833 globals->get_options()->set_hud_status(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 globals->get_options()->set_anti_alias_hud(1);
862 FG_PUSH_PUI_DIALOG( HUDalphaDialog );
865 static void goAwayHUDalphaAdjust (puObject *)
867 FG_POP_PUI_DIALOG( HUDalphaDialog );
870 static void cancelHUDalphaAdjust (puObject *)
872 globals->get_options()->set_anti_alias_hud(0);
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 = globals->get_options()->get_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 globals->get_options()->get_anti_alias_hud() ?
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( globals->get_options()->get_anti_alias_hud() ) {
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( globals->get_options()->get_anti_alias_hud() ) {
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);