]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/hud.cxx
make --enable-osgviewer the default
[flightgear.git] / src / Cockpit / hud.cxx
index 0d016b873e93f02648ffcd5ee257a0aaecd63242..606a29efb5ba7878720547cb2382aeb8a51a5431 100644 (file)
@@ -63,7 +63,7 @@ static HUD_Properties *HUDprop = 0;
 
 static char units[5];
 
-deque<instr_item *> HUD_deque;
+deque<SGSharedPtr<instr_item> > HUD_deque;
 
 fgTextList HUD_TextList;
 fgLineList HUD_LineList;
@@ -79,8 +79,8 @@ float HUD_matrix[16];
 int readHud( istream &input );
 int readInstrument ( const SGPropertyNode * node);
 
-static void drawHUD();
-static void fgUpdateHUDVirtual();
+static void drawHUD(osg::State*);
+static void fgUpdateHUDVirtual(osg::State*);
 
 
 class locRECT {
@@ -191,6 +191,8 @@ int readHud( istream &input )
     SG_LOG(SG_INPUT, SG_INFO, "Read properties for  " <<
            root.getStringValue("name"));
 
+    if (!root.getNode("depreciated"))
+        SG_LOG(SG_INPUT, SG_ALERT, "WARNING: use of depreciated old HUD");
 
     HUD_deque.erase( HUD_deque.begin(), HUD_deque.end());
 
@@ -255,8 +257,6 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
         input.close();
     }
 
-    fgHUDReshape();
-
     if ( HUDtext ) {
         // this chunk of code is not necessarily thread safe if the
         // compiler optimizer reorders these statements.  Note that
@@ -314,39 +314,17 @@ int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ )
 //$$$ End - added, Neetha, 28 Nov 2k
 
 
-void fgHUDReshape(void) {
-#if 0
-    if ( HUDtext ) {
-        // this chunk of code is not necessarily thread safe if the
-        // compiler optimizer reorders these statements.  Note that
-        // "delete ptr" does not set "ptr = NULL".  We have to do that
-        // ourselves.
-        fntRenderer *tmp = HUDtext;
-        HUDtext = NULL;
-        delete tmp;
-    }
-
-    HUD_TextSize = fgGetInt("/sim/startup/xsize") / 60;
-    HUD_TextSize = 10;
-    HUDtext = new fntRenderer();
-    HUDtext -> setFont      ( guiFntHandle ) ;
-    HUDtext -> setPointSize ( HUD_TextSize ) ;
-    HUD_TextList.setFont( HUDtext );
-#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 ) {
+void fgUpdateHUD( osg::State* state ) {
 
     static const SGPropertyNode *enable3d_node = fgGetNode("/sim/hud/enable3d");
     if ( HUD_style == 1 && enable3d_node->getBoolValue() ) {
-        fgUpdateHUDVirtual();
+        fgUpdateHUDVirtual(state);
         return;
     }
 
@@ -356,15 +334,15 @@ void fgUpdateHUD( void ) {
     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 );
+        fgUpdateHUD( state, -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 );
+        fgUpdateHUD( state, 0.0f, -adjust, 640.0f, 480.0f+adjust );
     }
 }
 
-void fgUpdateHUDVirtual()
+void fgUpdateHUDVirtual(osg::State* state)
 {
     FGViewer* view = globals->get_current_view();
 
@@ -406,7 +384,7 @@ void fgUpdateHUDVirtual()
     glTranslatef(-320, -240, -1);
 
     // Do the deed
-    drawHUD();
+    drawHUD(state);
 
     // Clean up our mess
     glMatrixMode(GL_PROJECTION);
@@ -416,7 +394,7 @@ void fgUpdateHUDVirtual()
 }
 
 
-void fgUpdateHUD( GLfloat x_start, GLfloat y_start,
+void fgUpdateHUD( osg::State* state, GLfloat x_start, GLfloat y_start,
                   GLfloat x_end, GLfloat y_end )
 {
     glMatrixMode(GL_PROJECTION);
@@ -428,7 +406,7 @@ void fgUpdateHUD( GLfloat x_start, GLfloat y_start,
     glPushMatrix();
     glLoadIdentity();
 
-    drawHUD();
+    drawHUD(state);
 
     glMatrixMode(GL_PROJECTION);
     glPopMatrix();
@@ -437,7 +415,7 @@ void fgUpdateHUD( GLfloat x_start, GLfloat y_start,
 }
 
 
-void drawHUD()
+void drawHUD(osg::State* state)
 {
     if ( !HUD_deque.size() ) // Trust everyone, but ALWAYS cut the cards!
         return;
@@ -577,7 +555,7 @@ void fgTextList::draw()
 
     Font->begin();
     for (; curString != lastString; curString++)
-        curString->Draw(Font,curString->digit);
+        curString->Draw(Font);
     Font->end();
 
     glDisable(GL_TEXTURE_2D);