From 96387ee88a89d172fa23ef325a15da510afac3e5 Mon Sep 17 00:00:00 2001 From: khonkhortisan Date: Sat, 30 Mar 2013 14:49:46 -0700 Subject: Don't load menu textures every frame --- src/main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 2e57a8c20..439b59d31 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -618,7 +618,7 @@ void drawMenuBackground(video::IVideoDriver* driver) { std::string path = getTexturePath("menubg.png"); if (path[0]) { - video::ITexture *bgtexture = + static const video::ITexture *bgtexture = driver->getTexture(path.c_str()); if (bgtexture) { @@ -646,7 +646,7 @@ void drawMenuFooter(video::IVideoDriver* driver, bool clouds) { std::string path = getTexturePath(clouds ? "menufooter_clouds.png" : "menufooter.png"); if (path[0]) { - video::ITexture *footertexture = + static const video::ITexture *footertexture = driver->getTexture(path.c_str()); if (footertexture) { @@ -678,7 +678,7 @@ void drawMenuHeader(video::IVideoDriver* driver) { std::string path = getTexturePath("menuheader.png"); if (path[0]) { - video::ITexture *splashtexture = + static const video::ITexture *splashtexture = driver->getTexture(path.c_str()); if(splashtexture) { @@ -713,7 +713,7 @@ void drawMenuHeader(video::IVideoDriver* driver) { void drawMenuSplash(video::IVideoDriver* driver) { core::dimension2d screensize = driver->getScreenSize(); if (getTexturePath("menusplash.png") != "") { - video::ITexture *splashtexture = + static const video::ITexture *splashtexture = driver->getTexture(getTexturePath("menusplash.png").c_str()); if(splashtexture) { -- cgit v1.2.3 From 7d3b3890b5fde204051662f5ad73dd5d75e0a6f8 Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Sat, 30 Mar 2013 18:40:33 -0400 Subject: Add a small optimization to the menu splash and remove a old comment --- src/main.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 439b59d31..08af6a37d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -682,9 +682,6 @@ void drawMenuHeader(video::IVideoDriver* driver) { driver->getTexture(path.c_str()); if(splashtexture) { - //v2s32 splashsize((splashtexture->getOriginalSize().Width*100)/ - // splashtexture->getOriginalSize().Height, 80); - f32 mult = (((f32)screensize.Width / 2)) / ((f32)splashtexture->getOriginalSize().Width); @@ -712,9 +709,10 @@ void drawMenuHeader(video::IVideoDriver* driver) { // Draw the Splash over the clouds and under the main menu void drawMenuSplash(video::IVideoDriver* driver) { core::dimension2d screensize = driver->getScreenSize(); - if (getTexturePath("menusplash.png") != "") { + std::string path = getTexturePath("menusplash.png"); + if (path[0]) { static const video::ITexture *splashtexture = - driver->getTexture(getTexturePath("menusplash.png").c_str()); + driver->getTexture(path.c_str()); if(splashtexture) { core::rect splashrect(0, 0, screensize.Width, screensize.Height); -- cgit v1.2.3