]> git.mxchange.org Git - flightgear.git/blobdiff - src/Viewer/splash.cxx
commradio: improvements for atis speech
[flightgear.git] / src / Viewer / splash.cxx
index 78d79aa0b9101cfcd75ce6d40d4876eb61fe77fc..5452aac641f11ff8969b04c6ab3511b0f8296730 100644 (file)
@@ -54,6 +54,7 @@
 #include <Main/globals.hxx>
 #include <Main/fg_props.hxx>
 #include <Main/fg_os.hxx>
+#include <Main/locale.hxx>
 #include "splash.hxx"
 #include "renderer.hxx"
 
@@ -307,10 +308,21 @@ static osg::Node* fgCreateSplashCamera()
   text->setPosition(osg::Vec3(0, -0.92, 0));
   text->setAlignment(osgText::Text::CENTER_CENTER);
   SGPropertyNode* prop = fgGetNode("/sim/startup/splash-progress-text", true);
-  prop->setStringValue("initializing");
+  prop->setStringValue("");
   text->setUpdateCallback(new FGSplashTextUpdateCallback(prop));
   geode->addDrawable(text);
 
+  osgText::Text* spinnertext = new osgText::Text;
+  spinnertext->setFont(globals->get_fontcache()->getfntpath(fn.c_str()).str());
+  spinnertext->setCharacterSize(0.06);
+  spinnertext->setColor(osg::Vec4(1, 1, 1, 1));
+  spinnertext->setPosition(osg::Vec3(0, -0.97, 0));
+  spinnertext->setAlignment(osgText::Text::CENTER_CENTER);
+  prop = fgGetNode("/sim/startup/splash-progress-spinner", true);
+  prop->setStringValue("");
+  spinnertext->setUpdateCallback(new FGSplashTextUpdateCallback(prop));
+  geode->addDrawable(spinnertext);
+
   text = new osgText::Text;
   text->setFont(globals->get_fontcache()->getfntpath(fn.c_str()).str());
   text->setCharacterSize(0.08);
@@ -332,6 +344,8 @@ static osg::Node* fgCreateSplashCamera()
   text->setUpdateCallback(new FGSplashTextUpdateCallback(prop));
   geode->addDrawable(text);
 
+  fgSplashProgress("init");
+
   return camera;
 }
 
@@ -360,6 +374,7 @@ private:
 
 osg::Node* fgCreateSplashNode() {
   osg::Group* group = new osg::Group;
+    group->setName("splashGroup");
   group->setUpdateCallback(new FGSplashGroupUpdateCallback);
   return group;
 }
@@ -370,7 +385,39 @@ void fgSplashInit () {
   globals->get_renderer()->splashinit();
 }
 
-void fgSplashProgress ( const char *text ) {
-  SG_LOG( SG_VIEW, SG_INFO, "Splash screen progress " << text );
-  fgSetString("/sim/startup/splash-progress-text", text);
+void fgSplashProgress( const char *identifier ) {
+  const char* spinChars = "-\\|/";
+  static int spin_count = 0;
+  std::string spin_status = std::string("");
+
+  if (identifier[0] != 0)
+      spin_status += spinChars[spin_count++ % 4];
+
+  fgSetString("/sim/startup/splash-progress-spinner", spin_status);
+
+  const char* text = "";
+  if (identifier[0] != 0)
+  {
+      std::string id = std::string("splash/") + identifier;
+      text = globals->get_locale()->getLocalizedString(id.c_str(),
+                                                       "sys", "<incomplete language resource>");
+  }
+    
+    if (!strcmp(identifier,"downloading-scenery")) {
+        std::ostringstream oss;
+        unsigned int kbytesPerSec = fgGetInt("/sim/terrasync/transfer-rate-bytes-sec") / 1024;
+        oss << text;
+        if (kbytesPerSec > 0) {
+            oss << " - " << kbytesPerSec << " KBytes/sec";
+        }
+        fgSetString("/sim/startup/splash-progress-text", oss.str());
+        return;
+    }
+    
+    if (!strcmp(fgGetString("/sim/startup/splash-progress-text"), text)) {
+        return;
+    }
+    
+    SG_LOG( SG_VIEW, SG_INFO, "Splash screen progress " << identifier );
+    fgSetString("/sim/startup/splash-progress-text", text);
 }