# include <values.h> // for MAXINT
#endif
+#include <simgear/constants.h>
+#include <simgear/debug/logstream.hxx>
+#include <simgear/math/fg_random.h>
+#include <simgear/math/polar3d.hxx>
+
#include <Aircraft/aircraft.hxx>
-#include <Debug/logstream.hxx>
#include <GUI/gui.h>
-#include <Include/fg_constants.h>
#include <Main/options.hxx>
-#include <Math/fg_random.h>
-#include <Math/mat3.h>
-#include <Math/polar3d.hxx>
+#ifdef FG_NETWORK_OLK
+#include <NetworkOLK/network.h>
+#endif
#include <Scenery/scenery.hxx>
#include <Time/fg_timer.hxx>
// int index;
int font_size;
- int off = 50;
+// int off = 50;
int min_x = 25; //off/2;
int max_x = 615; //640-(off/2);
// int min_y = off;
// fgHUDSetBrightness( hud, BRT_LIGHT );
// case 0: // TBI
- int x = 290; /*cen_x-30*/
- int y = 45; /*off-5*/
+// int x = 290; /*cen_x-30*/
+// int y = 45; /*off-5*/
// HIptr = (instr_item *) new fgTBI_instr( x, y, ladr_w2, text_h );
HIptr = (instr_item *) new fgTBI_instr( 290, 45, 60, 10 );
HUD_deque.insert( HUD_deque.begin(), HIptr);
50.0,
true);
+
+
+ HUD_deque.insert( HUD_deque.begin(), HIptr);
+
+
+// case 10: // Digital Mach number
+ HIptr = (instr_item *) new instr_label ( min_x , //same as speed tape
+ cen_y-(compass_w/2) -10, //below speed tape
+ 40,
+ 30,
+ get_mach,
+ "%4.2f",
+ "",
+ NULL,
+ 1.0,
+ HUDS_TOP,
+ RIGHT_JUST,
+ font_size,
+ 0,
+ TRUE );
HUD_deque.insert( HUD_deque.begin(), HIptr);
// case 9:
// int min_y = off;
int max_y = 480-off;
int cen_x = 640 / 2;
-// int cen_y = 480 / 2;
+ int cen_y = 480 / 2;
int text_h = 10;
int ladr_w2 = 60;
-// int ladr_h2 = 90;
+ int ladr_h2 = 90;
// int ladr_t = 35;
int compass_w = 200;
// int gap = 10;
instr_item* p;
+ p = new HudLadder( cen_x-ladr_w2, cen_y-ladr_h2, 2*ladr_w2, 2*ladr_h2, 1 );
+ HUD_deque.push_front( p );
+
// case 4: // GYRO COMPASS
p =new hud_card( cen_x-(compass_w/2),
max_y,
0,
TRUE );
HUD_deque.push_front( p );
-
+#if 0
p = new instr_label( x_pos, 40, 120, 10,
get_vfc_tris_culled,
"%7.0f",
0,
TRUE );
HUD_deque.push_front( p );
-
- p = new instr_label( x_pos, 70, 90, 10,
+#endif // 0
+
+// p = new instr_label( x_pos, 70, 90, 10,
+ p = new instr_label( x_pos, 40, 90, 10,
get_fov,
"%7.1f",
"FOV = ",
pHUDInstr->SetBrightness( brightness );
}
+#if 0
// fgUpdateHUD
//
// Performs a once around the list of calls to instruments installed in
}
char *gmt_str = get_formated_gmt_time();
- HUD_TextList.add( fgText( gmt_str, 40, 10) );
+ HUD_TextList.add( fgText( 40, 10, gmt_str) );
+
+#ifdef FG_NETWORK_OLK
+ if ( net_hud_display ) {
+ net_hud_update();
+ }
+#endif
+
+ HUD_TextList.draw();
+
+ line_width = (current_options.get_xsize() > 1000) ? 1.0 : 0.5;
+ glLineWidth(line_width);
+ HUD_LineList.draw();
+
+// glEnable(GL_LINE_STIPPLE);
+// glLineStipple( 1, 0x00FF );
+// HUD_StippleLineList.draw();
+// glDisable(GL_LINE_STIPPLE);
+
+// glDisable( GL_BLEND );
+
+ glEnable(GL_DEPTH_TEST);
+ glEnable(GL_LIGHTING);
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+}
+#endif
+
+
+// fgUpdateHUD
+//
+// Performs a once around the list of calls to instruments installed in
+// the HUD object with requests for redraw. Kinda. It will when this is
+// all C++.
+//
+void fgUpdateHUD( void ) {
+ int brightness;
+// int day_night_sw = current_aircraft.controls->day_night_switch;
+ int day_night_sw = global_day_night_switch;
+ int hud_displays = HUD_deque.size();
+ instr_item *pHUDInstr;
+ float line_width;
+
+ if( !hud_displays ) { // Trust everyone, but ALWAYS cut the cards!
+ return;
+ }
+
+ HUD_TextList.erase();
+ HUD_LineList.erase();
+// HUD_StippleLineList.erase();
+
+ pHUDInstr = HUD_deque[0];
+ brightness = pHUDInstr->get_brightness();
+// brightness = HUD_deque.at(0)->get_brightness();
+
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+
+ glLoadIdentity();
+ gluOrtho2D(0, 640, 0, 480);
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
+
+ glColor3f(1.0, 1.0, 1.0);
+ glIndexi(7);
+
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_LIGHTING);
+
+ // We can do translucency, so why not. :-)
+// glEnable ( GL_BLEND ) ;
+// glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ;
+
+ if( day_night_sw == DAY) {
+ switch (brightness) {
+ case BRT_LIGHT:
+// glColor4f (0.1, 0.9, 0.1, 0.75);
+ glColor3f (0.1, 0.9, 0.1);
+ break;
+
+ case BRT_MEDIUM:
+// glColor4f (0.1, 0.7, 0.0, 0.75);
+ glColor3f (0.1, 0.7, 0.0);
+ break;
+
+ case BRT_DARK:
+// glColor4f (0.0, 0.6, 0.0, 0.75);
+ glColor3f(0.0, 0.6, 0.0);
+ break;
+
+ case BRT_BLACK:
+// glColor4f( 0.0, 0.0, 0.0, 0.75);
+ glColor3f( 0.0, 0.0, 0.0);
+ break;
+
+ default:;
+ }
+ }
+ else {
+ if( day_night_sw == NIGHT) {
+ switch (brightness) {
+ case BRT_LIGHT:
+// glColor4f (0.9, 0.1, 0.1, 0.75);
+ glColor3f (0.9, 0.1, 0.1);
+ break;
+
+ case BRT_MEDIUM:
+// glColor4f (0.7, 0.0, 0.1, 0.75);
+ glColor3f (0.7, 0.0, 0.1);
+ break;
+
+ case BRT_DARK:
+ default:
+// glColor4f (0.6, 0.0, 0.0, 0.75);
+ glColor3f (0.6, 0.0, 0.0);
+ }
+ }
+ else { // Just in case default
+// glColor4f (0.1, 0.9, 0.1, 0.75);
+ glColor3f (0.1, 0.9, 0.1);
+ }
+ }
+
+ deque < instr_item * > :: iterator current = HUD_deque.begin();
+ deque < instr_item * > :: iterator last = HUD_deque.end();
+
+ for ( ; current != last; ++current ) {
+ pHUDInstr = *current;
+
+ if( pHUDInstr->enabled()) {
+ // fgPrintf( FG_COCKPIT, FG_DEBUG, "HUD Code %d Status %d\n",
+ // hud->code, hud->status );
+ pHUDInstr->draw();
+// HUD_deque.at(i)->draw(); // Responsible for broken or fixed variants.
+ // No broken displays honored just now.
+ }
+ }
+
+ char *gmt_str = get_formated_gmt_time();
+ HUD_TextList.add( fgText(40, 10, gmt_str) );
+
+#ifdef FG_NETWORK_OLK
+ if ( net_hud_display ) {
+ net_hud_update();
+ }
+#endif
+
+
+ // temporary
+ extern bool fgAPAltitudeEnabled( void );
+ extern bool fgAPHeadingEnabled( void );
+ extern bool fgAPWayPointEnabled( void );
+ extern char *fgAPget_TargetDistanceStr( void );
+ extern char *fgAPget_TargetHeadingStr( void );
+ extern char *fgAPget_TargetAltitudeStr( void );
+ extern char *fgAPget_TargetLatLonStr( void );
+
+ int apY = 480 - 80;
+// char scratch[128];
+// HUD_TextList.add( fgText( "AUTOPILOT", 20, apY) );
+// apY -= 15;
+ if( fgAPHeadingEnabled() ) {
+ HUD_TextList.add( fgText( 40, apY, fgAPget_TargetHeadingStr()) );
+ apY -= 15;
+ }
+ if( fgAPAltitudeEnabled() ) {
+ HUD_TextList.add( fgText( 40, apY, fgAPget_TargetAltitudeStr()) );
+ apY -= 15;
+ }
+ if( fgAPWayPointEnabled() ) {
+ HUD_TextList.add( fgText( 40, apY, fgAPget_TargetLatLonStr()) );
+ apY -= 15;
+ HUD_TextList.add( fgText( 40, apY, fgAPget_TargetDistanceStr() ) );
+ apY -= 15;
+ }
HUD_TextList.draw();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
}
+