1
0
Fork 0

Allow XML control over splash logo position.

As suggested by Chris, these are normalised and account for the logo
size after scaling, so 0.5 will centre, 1.0 is the right/bottom edge.

E.g. (in /sim/startup)
 <splash-logo-x-norm>0.5</splash-logo-x-norm>
 <splash-logo-y-norm>0.9</splash-logo-y-norm> 

Many values will overlap with other text, so use with care!
This commit is contained in:
James Turner 2017-03-15 11:58:47 +00:00
parent f4788cddb4
commit c7f29699d3

View file

@ -614,8 +614,13 @@ void SplashScreen::resize( int width, int height )
if (_aircraftLogoVertexArray) { if (_aircraftLogoVertexArray) {
float logoWidth = fgGetDouble("/sim/startup/splash-logo-width", 0.6) * width; float logoWidth = fgGetDouble("/sim/startup/splash-logo-width", 0.6) * width;
float logoHeight = _logoImage->t() * (logoWidth / _logoImage->s()); float logoHeight = _logoImage->t() * (logoWidth / _logoImage->s());
float originX = width * -0.5;
float originY = height * ((1.0 - 0.935) - 0.5); float logoX = fgGetDouble("/sim/startup/splash-logo-x-norm", 0.0) * (width - logoWidth);
float logoY = fgGetDouble("/sim/startup/splash-logo-y-norm", 1.0 - 0.935) * (height - logoHeight);
float originX = logoX - (width * 0.5);
float originY = logoY - (height * 0.5);
osg::Vec3 positions[4] = { osg::Vec3 positions[4] = {
osg::Vec3(originX, originY, 0.0), osg::Vec3(originX, originY, 0.0),
osg::Vec3(originX + logoWidth, originY, 0.0), osg::Vec3(originX + logoWidth, originY, 0.0),