summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2005-10-16 20:18:50 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2005-10-16 20:18:50 +0000
commit7489419558c12ba19eb7d0f26bf5a29149330eb0 (patch)
tree769035b8e79b95a2767aa04daa5cb567492e1254 /src/main.cpp
parent4453a80a2f43c5ebf20dce881586a89c484d4830 (diff)
downloadmana-7489419558c12ba19eb7d0f26bf5a29149330eb0.tar.gz
mana-7489419558c12ba19eb7d0f26bf5a29149330eb0.tar.bz2
mana-7489419558c12ba19eb7d0f26bf5a29149330eb0.tar.xz
mana-7489419558c12ba19eb7d0f26bf5a29149330eb0.zip
Use the ResourceManager to get spritesets.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp30
1 files changed, 10 insertions, 20 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 90a0aac3..d4766bfe 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -45,7 +45,6 @@
#ifdef USE_OPENGL
#include "openglgraphics.h"
#endif
-#include "playerinfo.h"
#include "sound.h"
#include "graphic/spriteset.h"
@@ -58,9 +57,6 @@
#include "gui/login.h"
#include "gui/ok_dialog.h"
#include "gui/updatewindow.h"
-#include "gui/error.h"
-
-#include "net/protocol.h"
#include "resources/image.h"
#include "resources/resourcemanager.h"
@@ -266,19 +262,13 @@ void init_engine()
// Initialize for drawing
graphics->_beginDraw();
- Image *playerImg = resman->getImage(
- "graphics/sprites/player_male_base.png");
- Image *hairImg = resman->getImage(
- "graphics/sprites/player_male_hair.png");
-
- if (!playerImg) logger->error("Couldn't load player_male_base.png");
- if (!hairImg) logger->error("Couldn't load player_male_hair.png");
+ playerset = resman->createSpriteset(
+ "graphics/sprites/player_male_base.png", 64, 64);
+ hairset = resman->createSpriteset(
+ "graphics/sprites/player_male_hair.png", 40, 40);
- playerset = new Spriteset(playerImg, 64, 64);
- hairset = new Spriteset(hairImg, 40, 40);
-
- playerImg->decRef();
- hairImg->decRef();
+ if (!playerset) logger->error("Couldn't load player spriteset!");
+ if (!hairset) logger->error("Couldn't load hair spriteset!");
gui = new Gui(graphics);
state = UPDATE_STATE; /**< Initial game state */
@@ -427,7 +417,7 @@ int main(int argc, char *argv[])
void (*inputHandler)(SDL_KeyboardEvent*) = NULL;
Image *login_wallpaper = NULL;
-
+
sound.playMusic(TMW_DATADIR "data/music/Magick - Real.ogg");
while (state != EXIT_STATE)
@@ -448,9 +438,9 @@ int main(int argc, char *argv[])
guiInput->pushInput(event);
}
-
+
gui->logic();
-
+
if (!login_wallpaper)
{
login_wallpaper = ResourceManager::getInstance()->
@@ -525,7 +515,7 @@ int main(int argc, char *argv[])
}
}
}
-
+
if (nullFile)
{
fclose(nullFile);