diff options
author | Lloyd Bryant <lloyd_bryant@netzero.net> | 2008-08-19 02:17:09 +0000 |
---|---|---|
committer | Lloyd Bryant <lloyd_bryant@netzero.net> | 2008-08-19 02:17:09 +0000 |
commit | 6be958da64e96f0b0d7ae043182b3f124eadfd4e (patch) | |
tree | 9e915b5b9126167c867d8824c54350b460141282 | |
parent | 7ac798f289e58348fdd1c08bd422fb435399f5d4 (diff) | |
download | mana-6be958da64e96f0b0d7ae043182b3f124eadfd4e.tar.gz mana-6be958da64e96f0b0d7ae043182b3f124eadfd4e.tar.bz2 mana-6be958da64e96f0b0d7ae043182b3f124eadfd4e.tar.xz mana-6be958da64e96f0b0d7ae043182b3f124eadfd4e.zip |
Added handling for different resolution wallpapers, reduced CPU usage during login sequence
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | data/graphics/images/Makefile.am | 6 | ||||
-rw-r--r-- | src/main.cpp | 37 |
3 files changed, 38 insertions, 11 deletions
@@ -1,3 +1,9 @@ +2008-08-17 Lloyd Bryant ("Sanga") <sanga@aethyra.com> + + * Set the wallpaper based on the screen width. + * Added a usleep to the login sequence loop to + prevent it from unnecessarily maxing out the CPU + 2008-08-17 Lloyd Bryant ("Sanga") <sanga@aethyra.com> * Correctly show GP remaining after buying from NPC diff --git a/data/graphics/images/Makefile.am b/data/graphics/images/Makefile.am index 4df6b7ed..e003bc7a 100644 --- a/data/graphics/images/Makefile.am +++ b/data/graphics/images/Makefile.am @@ -2,7 +2,11 @@ imagesdir = $(pkgdatadir)/data/graphics/images images_DATA = \ error.png \ - login_wallpaper.png + login_wallpaper.png \ + login_wallpaper_1024x768.png \ + login_wallpaper_1280x960.png \ + login_wallpaper_1440x1080.png \ + login_wallpaper_1600x1200.png EXTRA_DIST = \ $(images_DATA) diff --git a/src/main.cpp b/src/main.cpp index 89bc8e6b..7efbca4f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -697,6 +697,27 @@ int main(int argc, char *argv[]) SDLNet_Init(); Network *network = new Network(); + + // Set the most appropriate wallpaper, based on screen width + int screenWidth = (int) config.getValue("screenwidth", defaultScreenWidth); + std::string wallpaperName; + + if (screenWidth <= 800) + wallpaperName = "graphics/images/login_wallpaper.png"; + else if (screenWidth <= 1024) + wallpaperName = "graphics/images/login_wallpaper_1024x768.png"; + else if (screenWidth <= 1280) + wallpaperName = "graphics/images/login_wallpaper_1280x960.png"; + else if (screenWidth <= 1440) + wallpaperName = "graphics/images/login_wallpaper_1440x1080.png"; + else + wallpaperName = "graphics/images/login_wallpaper_1600x1200.png"; + + login_wallpaper = ResourceManager::getInstance()-> getImage(wallpaperName); + + if (!login_wallpaper) + logger->log("Couldn't load %s as wallpaper", wallpaperName.c_str()); + while (state != EXIT_STATE) { // Handle SDL events @@ -732,16 +753,6 @@ int main(int argc, char *argv[]) } } - if (!login_wallpaper) - { - login_wallpaper = ResourceManager::getInstance()-> - getImage("graphics/images/login_wallpaper.png"); - if (!login_wallpaper) - { - logger->error("Couldn't load login_wallpaper.png"); - } - } - if (progressBar->isVisible()) { progressBar->setProgress(progressBar->getProgress() + 0.005f); @@ -933,6 +944,12 @@ int main(int argc, char *argv[]) break; } } + /* + * This loop can really stress the CPU, for no reason since it's + * just constantly redrawing the wallpaper. Added the following + * usleep to limit it to 20 FPS during the login sequence + */ + usleep(50000); } #ifdef PACKAGE_VERSION |