X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FMain%2Fsplash.cxx;h=334cd63aae55604e0f9c73d2e32f152ff9c47461;hb=2385e5d3876dd6e5dd8aadbb239a6e959647aee2;hp=23b4705108ebf0fd8ef5545d259ba56d0a87fba6;hpb=d80b718039e7a6c4b7686014b785d78b26085d3e;p=flightgear.git diff --git a/src/Main/splash.cxx b/src/Main/splash.cxx index 23b470510..334cd63aa 100644 --- a/src/Main/splash.cxx +++ b/src/Main/splash.cxx @@ -46,14 +46,17 @@ #include #include +#include + #include "globals.hxx" #include "fg_props.hxx" #include "splash.hxx" #include "fg_os.hxx" +#include "renderer.hxx" static const int fontsize = 19; static const char fontname[] = "default.txf"; -static const char *text = 0; +static const char *progress_text = 0; static SGTexture splash; @@ -65,9 +68,6 @@ static fntRenderer info; void fgSplashInit ( const char *splash_texture ) { fgRequestRedraw(); - if (!fgGetBool("/sim/startup/splash-screen")) - return; - SG_LOG( SG_GENERAL, SG_INFO, "Initializing splash screen" ); @@ -82,11 +82,16 @@ void fgSplashInit ( const char *splash_texture ) { SGPath path(fontpath); path.append(fontname); - font.load((char *)path.c_str()); + if (!font.load((char *)path.c_str())) { + SG_LOG( SG_GENERAL, SG_ALERT, "Error loading font " << path.str() ); + return; + } info.setFont(&font); info.setPointSize(fontsize); + if (!fgGetBool("/sim/startup/splash-screen")) + return; splash.bind(); @@ -125,7 +130,7 @@ void fgSplashInit ( const char *splash_texture ) { void fgSplashProgress ( const char *s ) { - text = s; + progress_text = s; fgRequestRedraw(); } @@ -138,6 +143,7 @@ void fgSplashUpdate ( float alpha ) { if (!screen_width || !screen_height) return; + globals->get_renderer()->resize(screen_width, screen_height); int size = screen_width < (screen_height - 5 * fontsize) ? screen_width : screen_height - 5 * fontsize; if (size > 512) @@ -162,7 +168,9 @@ void fgSplashUpdate ( float alpha ) { glDisable(GL_LIGHTING); // draw the background - glColor4f( 0.0, 0.0, 0.0, alpha ); + FGColor c(0.0, 0.0, 0.0); + c.merge(fgGetNode("/sim/gui/colors/splash-screen")); + glColor4f(c.red(), c.green(), c.blue(), alpha ); glBegin(GL_POLYGON); glVertex2f(0.0, 0.0); glVertex2f(screen_width, 0.0); @@ -185,7 +193,7 @@ void fgSplashUpdate ( float alpha ) { glEnd(); } - if (text && fgGetBool("/sim/startup/splash-progress", true)) { + if (info.getFont() && progress_text && fgGetBool("/sim/startup/splash-progress", true)) { glEnable(GL_ALPHA_TEST); glEnable(GL_BLEND); glAlphaFunc(GL_GREATER, 0.1f); @@ -195,10 +203,13 @@ void fgSplashUpdate ( float alpha ) { float left, right, bot, top; info.begin(); - glColor3f(1.0, 0.9, 0.0); - font.getBBox(text, fontsize, 0, &left, &right, &bot, &top); + FGColor c(1.0, 0.9, 0.0); + c.merge(fgGetNode("/sim/gui/colors/splash-font")); + glColor4f(c.red(), c.green(), c.blue(), alpha); + + font.getBBox(progress_text, fontsize, 0, &left, &right, &bot, &top); info.start2f((screen_width - right) / 2.0, 10.0 - bot); - info.puts(text); + info.puts(progress_text); const char *s = fgGetString("/sim/startup/splash-title", ""); font.getBBox(s, fontsize, 0, &left, &right, &bot, &top);