]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/hud.cxx
- modified FGBinding to keep a local copy of the argument property
[flightgear.git] / src / Cockpit / hud.cxx
index 8f413dce1ca4987319a059b4338b4456436f2450..fbaec9b14e3f8b0bf6012c82e91f190cc82b03b0 100644 (file)
@@ -964,6 +964,24 @@ static void set_hud_color(float r, float g, float b) {
 // all C++.
 //
 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();
+    if( current_aspect > normal_aspect ) {
+        float aspect_adjust = current_aspect / normal_aspect;
+        float adjust = 320.0f*aspect_adjust - 320.0f;
+        fgUpdateHUD( -adjust, 0.0f, 640.0f+adjust, 480.0f );
+    } else {
+        float aspect_adjust = normal_aspect / current_aspect;
+        float adjust = 240.0f*aspect_adjust - 240.0f;
+        fgUpdateHUD( 0.0f, -adjust, 640.0f, 480.0f+adjust );
+    }
+}
+
+void fgUpdateHUD( GLfloat x_start, GLfloat y_start,
+                  GLfloat x_end, GLfloat y_end )
+{
   int brightness;
   // int day_night_sw = current_aircraft.controls->day_night_switch;
   int day_night_sw = global_day_night_switch;
@@ -987,7 +1005,7 @@ void fgUpdateHUD( void ) {
   glPushMatrix();
 
   glLoadIdentity();
-  gluOrtho2D(0, 640, 0, 480);
+  gluOrtho2D(x_start, x_end, y_start, y_end);
   glMatrixMode(GL_MODELVIEW);
   glPushMatrix();
   glLoadIdentity();
@@ -1003,6 +1021,7 @@ void fgUpdateHUD( void ) {
 //       glEnable(GL_BLEND);
          glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
          glHint(GL_LINE_SMOOTH_HINT,GL_DONT_CARE);
+//       glHint(GL_LINE_SMOOTH_HINT,GL_NICEST);
          glLineWidth(1.5);
   } else {
          glLineWidth(1.0);