fix loading not centring when resized

This commit is contained in:
darkrose 2015-04-23 04:25:08 +10:00
parent eb1ef8a8dc
commit 8405874ae2
5 changed files with 28 additions and 24 deletions

View File

@ -1008,8 +1008,12 @@ void update_skybox(video::IVideoDriver* driver,
Draws a screen with logo and text on it.
Text will be removed when the screen is drawn the next time.
*/
void drawLoadingScreen(video::IVideoDriver* driver, const std::wstring msg)
void drawLoadingScreen(irr::IrrlichtDevice* device, const std::wstring msg)
{
if (device == NULL)
return;
device->run();
video::IVideoDriver* driver = device->getVideoDriver();
if (driver == NULL)
return;
core::dimension2d<u32> screensize = driver->getScreenSize();
@ -1105,7 +1109,7 @@ void the_game(
Draw "Loading" screen
*/
//draw_load_screen(L"Loading...", driver, font);
drawLoadingScreen(driver,wgettext("Loading..."));
drawLoadingScreen(device,wgettext("Loading..."));
/*
Create server.
@ -1114,7 +1118,7 @@ void the_game(
SharedPtr<Server> server;
if(address == ""){
//draw_load_screen(L"Creating server...", driver, font);
drawLoadingScreen(driver,wgettext("Creating server..."));
drawLoadingScreen(device,wgettext("Creating server..."));
infostream<<"Creating server"<<std::endl;
server = new Server(map_dir, configpath);
server->start(port);
@ -1125,12 +1129,12 @@ void the_game(
*/
//draw_load_screen(L"Creating client...", driver, font);
drawLoadingScreen(driver,wgettext("Creating client..."));
drawLoadingScreen(device,wgettext("Creating client..."));
infostream<<"Creating client"<<std::endl;
MapDrawControl draw_control;
Client client(device, playername.c_str(), password, draw_control, sound);
drawLoadingScreen(driver,wgettext("Resolving address..."));
drawLoadingScreen(device,wgettext("Resolving address..."));
Address connect_address(0,0,0,0, port);
try{
if(address == "")
@ -1188,7 +1192,7 @@ void the_game(
tot
);
//draw_load_screen(ss.str(), driver, font);
drawLoadingScreen(driver,narrow_to_wide(buff));
drawLoadingScreen(device,narrow_to_wide(buff));
// Update client and server
client.step(0.1);
@ -2720,7 +2724,7 @@ void the_game(
generator and other stuff quits
*/
{
drawLoadingScreen(driver,wgettext("Shutting down..."));
drawLoadingScreen(device,wgettext("Shutting down..."));
}
}

View File

@ -31,7 +31,7 @@
#include "keycode.h"
void drawLoadingScreen(video::IVideoDriver* driver, const std::wstring);
void drawLoadingScreen(irr::IrrlichtDevice* device, const std::wstring);
class KeyList : protected core::list<KeyPress>
{

View File

@ -1088,7 +1088,7 @@ int main(int argc, char *argv[])
// Create texture source
g_texturesource = new TextureSource(device);
drawLoadingScreen(driver,L"");
drawLoadingScreen(device,L"");
/*
Speed tests (done after irrlicht is loaded to get timer)
@ -1128,7 +1128,7 @@ int main(int argc, char *argv[])
// If font was not found, this will get us one
font = skin->getFont();
assert(font);
drawLoadingScreen(driver,wgettext("Setting Up UI"));
drawLoadingScreen(device,wgettext("Setting Up UI"));
u32 text_height = font->getDimension(L"Hello, world!").Height;
infostream<<"text_height="<<text_height<<std::endl;
@ -1151,12 +1151,12 @@ int main(int argc, char *argv[])
Preload some textures and stuff
*/
drawLoadingScreen(driver,wgettext("Loading MapNodes"));
init_mapnode(driver); // Second call with g_texturesource set
drawLoadingScreen(driver,wgettext("Loading Creatures"));
//drawLoadingScreen(device,wgettext("Loading MapNodes"));
init_mapnode(device); // Second call with g_texturesource set
drawLoadingScreen(device,wgettext("Loading Creatures"));
content_mob_init();
drawLoadingScreen(driver,wgettext("Setting Up Sound"));
drawLoadingScreen(device,wgettext("Setting Up Sound"));
#if USE_AUDIO == 1
sound = createSoundManager();
@ -1421,7 +1421,7 @@ int main(int argc, char *argv[])
continue;
}
// Initialize mapnode again to enable changed graphics settings
init_mapnode(driver);
init_mapnode(device);
/*
Run game

View File

@ -207,7 +207,7 @@ ContentFeatures & content_features(MapNode &n)
#include "common_irrlicht.h"
#include "game.h"
#include "intl.h"
void init_mapnode(video::IVideoDriver* driver)
void init_mapnode(irr::IrrlichtDevice* device)
#else
void init_mapnode()
#endif
@ -276,31 +276,31 @@ void init_mapnode()
Initialize mapnode content
*/
#ifndef SERVER
drawLoadingScreen(driver,wgettext("Loading Base MapNodes"));
drawLoadingScreen(device,wgettext("Loading Base MapNodes"));
#endif
content_mapnode_init(repeat);
#ifndef SERVER
drawLoadingScreen(driver,wgettext("Loading Circuit MapNodes"));
drawLoadingScreen(device,wgettext("Loading Circuit MapNodes"));
#endif
content_mapnode_circuit(repeat);
#ifndef SERVER
drawLoadingScreen(driver,wgettext("Loading Plant MapNodes"));
drawLoadingScreen(device,wgettext("Loading Plant MapNodes"));
#endif
content_mapnode_plants(repeat);
#ifndef SERVER
drawLoadingScreen(driver,wgettext("Loading Farming MapNodes"));
drawLoadingScreen(device,wgettext("Loading Farming MapNodes"));
#endif
content_mapnode_farm(repeat);
#ifndef SERVER
drawLoadingScreen(driver,wgettext("Loading Decorative MapNodes"));
drawLoadingScreen(device,wgettext("Loading Decorative MapNodes"));
#endif
content_mapnode_furniture(repeat);
#ifndef SERVER
drawLoadingScreen(driver,wgettext("Loading Interactive MapNodes"));
drawLoadingScreen(device,wgettext("Loading Interactive MapNodes"));
#endif
content_mapnode_door(repeat);
#ifndef SERVER
drawLoadingScreen(driver,wgettext("Loading Special MapNodes"));
drawLoadingScreen(device,wgettext("Loading Special MapNodes"));
#endif
content_mapnode_stair(repeat);
content_mapnode_slab(repeat);

View File

@ -62,7 +62,7 @@ typedef u16 content_t;
*/
#ifndef SERVER
#include "common_irrlicht.h"
void init_mapnode(video::IVideoDriver* driver);
void init_mapnode(irr::IrrlichtDevice* device);
#else
void init_mapnode();
#endif