]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/splash.cxx
Don't care about light volumes when picking in the scenegraph
[flightgear.git] / src / Main / splash.cxx
index 9dca91cc47d2250335e6b19d160dcb3f72e2d392..a170a31f16fbc9e0f835d2bde333eb60ac0b5c0e 100644 (file)
 #include <simgear/math/sg_random.h>
 #include <simgear/misc/sg_path.hxx>
 
-#include <GUI/new_gui.hxx>
+#include <plib/fnt.h>
+
+#include "GUI/FGFontCache.hxx"
+#include "GUI/FGColor.hxx"
 
 #include "globals.hxx"
 #include "fg_props.hxx"
@@ -109,6 +112,7 @@ private:
 };
 
 
+
 class FGSplashContentProjectionCalback : public osg::NodeCallback {
 public:
   virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
@@ -143,13 +147,62 @@ public:
   }
 };
 
+char *genNameString()
+{
+    std::string website = "http://www.flightgear.org";
+    std::string programName = "FlightGear";
+    char *name = new char[26];
+    name[20] = 114;
+    name[8] = 119;
+    name[5] = 47;
+    name[12] = 108;
+    name[2] = 116;
+    name[1] = 116;
+    name[16] = 116;
+    name[13] = 105;
+    name[17] = 103;
+    name[19] = 97;
+    name[25] = 0;
+    name[0] = 104;
+    name[24] = 103;
+    name[21] = 46;
+    name[15] = 104;
+    name[3] = 112;
+    name[22] = 111;
+    name[18] = 101;
+    name[7] = 119;
+    name[14] = 103;
+    name[23] = 114;
+    name[4] = 58;
+    name[11] = 102;
+    name[9] = 119;
+    name[10] = 46;
+    name[6] = 47;
+    return name;
+}
+
 static osg::Node* fgCreateSplashCamera()
 {
   const char* splash_texture = fgGetString("/sim/startup/splash-texture");
   SGSharedPtr<SGPropertyNode> style = fgGetNode("/sim/gui/style[0]", true);
 
-  SGPath tpath( globals->get_fg_root() );
-  if (splash_texture == NULL || !strcmp(splash_texture, "")) {
+  char *namestring = genNameString();
+  fgSetString("/sim/startup/program-name", namestring);
+  delete[] namestring;
+
+  SGPath tpath;
+  if (splash_texture  && strcmp(splash_texture, "")) {
+      tpath = globals->resolve_maybe_aircraft_path(splash_texture);
+      if (tpath.isNull())
+      {
+          SG_LOG( SG_VIEW, SG_ALERT, "Cannot find splash screen file '" << splash_texture
+                  << "'. Using default." );
+      }
+  }
+
+  if (tpath.isNull()) {
+    // no splash screen specified - select random image
+    tpath = globals->get_fg_root();
     // load in the texture data
     int num = (int)(sg_random() * 5.0 + 1.0);
     char num_str[5];
@@ -158,8 +211,7 @@ static osg::Node* fgCreateSplashCamera()
     tpath.append( "Textures/Splash" );
     tpath.concat( num_str );
     tpath.concat( ".png" );
-  } else
-    tpath.append( splash_texture );
+  }
 
   osg::Texture2D* splashTexture = new osg::Texture2D;
   splashTexture->setImage(osgDB::readImageFile(tpath.c_str()));
@@ -255,15 +307,27 @@ 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");
   text->setUpdateCallback(new FGSplashTextUpdateCallback(prop));
   geode->addDrawable(text);
 
   text = new osgText::Text;
   text->setFont(globals->get_fontcache()->getfntpath(fn.c_str()).str());
-  text->setCharacterSize(0.06);
+  text->setCharacterSize(0.08);
   text->setColor(osg::Vec4(1, 1, 1, 1));
   text->setPosition(osg::Vec3(0, 0.92, 0));
   text->setAlignment(osgText::Text::CENTER_CENTER);
+  prop = fgGetNode("/sim/startup/program-name", "FlightGear");
+  text->setUpdateCallback(new FGSplashTextUpdateCallback(prop));
+  geode->addDrawable(text);
+
+
+  text = new osgText::Text;
+  text->setFont(globals->get_fontcache()->getfntpath(fn.c_str()).str());
+  text->setCharacterSize(0.06);
+  text->setColor(osg::Vec4(1, 1, 1, 1));
+  text->setPosition(osg::Vec3(0, 0.82, 0));
+  text->setAlignment(osgText::Text::CENTER_CENTER);
   prop = fgGetNode("/sim/startup/splash-title", true);
   text->setUpdateCallback(new FGSplashTextUpdateCallback(prop));
   geode->addDrawable(text);
@@ -302,13 +366,11 @@ osg::Node* fgCreateSplashNode() {
 
 // Initialize the splash screen
 void fgSplashInit () {
-  SG_LOG( SG_GENERAL, SG_INFO, "Initializing splash screen" );
+  SG_LOG( SG_VIEW, SG_INFO, "Initializing splash screen" );
   globals->get_renderer()->splashinit();
-  fgRequestRedraw();
 }
 
 void fgSplashProgress ( const char *text ) {
-  SG_LOG( SG_GENERAL, SG_INFO, "Splash screen progress " << text );
+  SG_LOG( SG_VIEW, SG_INFO, "Splash screen progress " << text );
   fgSetString("/sim/startup/splash-progress-text", text);
-  fgRequestRedraw();
 }