X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FMain%2Fsplash.cxx;h=a170a31f16fbc9e0f835d2bde333eb60ac0b5c0e;hb=da73dd97d3d0e36b6078728ac39f0b98cae46ff7;hp=403617891f2027276978b7110de7146a8bcfc845;hpb=b5c46a8d59120f18b0bc268af72ecb6d3a75b3e3;p=flightgear.git diff --git a/src/Main/splash.cxx b/src/Main/splash.cxx index 403617891..a170a31f1 100644 --- a/src/Main/splash.cxx +++ b/src/Main/splash.cxx @@ -46,7 +46,10 @@ #include #include -#include +#include + +#include "GUI/FGFontCache.hxx" +#include "GUI/FGColor.hxx" #include "globals.hxx" #include "fg_props.hxx" @@ -146,8 +149,8 @@ public: char *genNameString() { - string website = "http://www.flightgear.org"; - string programName = "FlightGear"; + std::string website = "http://www.flightgear.org"; + std::string programName = "FlightGear"; char *name = new char[26]; name[20] = 114; name[8] = 119; @@ -187,8 +190,19 @@ static osg::Node* fgCreateSplashCamera() fgSetString("/sim/startup/program-name", namestring); delete[] namestring; - SGPath tpath( globals->get_fg_root() ); - if (splash_texture == NULL || !strcmp(splash_texture, "")) { + 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]; @@ -197,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())); @@ -294,6 +307,7 @@ 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); @@ -352,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(); }