summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--data/graphics/images/Makefile.am6
-rw-r--r--src/main.cpp37
3 files changed, 38 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 80a8381a..22ae8172 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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