From 97e47610b2ca88398b8f9c249cb008678f5ab1e1 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Fri, 14 Jan 2005 16:09:15 +0000 Subject: Some fixes for Dev-C++ but it has a black screen problem. --- src/graphic/graphic.h | 2 +- src/graphic/image.cpp | 44 -------------------------------- src/graphic/image.h | 53 --------------------------------------- src/graphic/spriteset.cpp | 44 ++++++++++++++++++++++++++++++++ src/graphic/spriteset.h | 53 +++++++++++++++++++++++++++++++++++++++ src/gui/inventory.h | 6 +---- src/main.h | 2 +- src/resources/resourcemanager.cpp | 3 ++- 8 files changed, 102 insertions(+), 105 deletions(-) delete mode 100644 src/graphic/image.cpp delete mode 100644 src/graphic/image.h create mode 100644 src/graphic/spriteset.cpp create mode 100644 src/graphic/spriteset.h (limited to 'src') diff --git a/src/graphic/graphic.h b/src/graphic/graphic.h index 063410cf..f9a5b4e7 100644 --- a/src/graphic/graphic.h +++ b/src/graphic/graphic.h @@ -40,7 +40,7 @@ #include "../gui/npc.h" #include "../gui/status.h" #include "../resources/resourcemanager.h" -#include "image.h" +#include "spriteset.h" #include #define TILE_SIZE 32 diff --git a/src/graphic/image.cpp b/src/graphic/image.cpp deleted file mode 100644 index 44b611f6..00000000 --- a/src/graphic/image.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * The Mana World - * Copyright 2004 The Mana World Development Team - * - * This file is part of The Mana World. - * - * The Mana World is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * The Mana World is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with The Mana World; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * $Id$ - */ - -#include "image.h" - -Spriteset::Spriteset(Image *img, int width, int height) -{ - int x, y; - - for (y = 0; y + height <= img->getHeight(); y += height) - { - for (x = 0; x + width <= img->getWidth(); x += width) - { - spriteset.push_back(img->getSubImage(x, y, width, height)); - } - } -} - -Spriteset::~Spriteset() -{ - for (unsigned int i = 0; i < spriteset.size(); i++) { - delete spriteset[i]; - } -} diff --git a/src/graphic/image.h b/src/graphic/image.h deleted file mode 100644 index b732d4cf..00000000 --- a/src/graphic/image.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * The Mana World - * Copyright 2004 The Mana World Development Team - * - * This file is part of The Mana World. - * - * The Mana World is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * The Mana World is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with The Mana World; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * $Id$ - */ - -#ifndef _TMW_SPRITESET_H -#define _TMW_SPRITESET_H - -#include -#include -#include -#include -#include "../log.h" -#include "../resources/image.h" - -/** - * Stores a complete set of sprites. - */ -class Spriteset { - public: - // Vector storing the whole spriteset. - std::vector spriteset; - - /* - * Cuts the passed image in a grid of sub images. - */ - Spriteset::Spriteset(Image *img, int w, int h); - - /** - * Destructor. - */ - ~Spriteset(); -}; - -#endif diff --git a/src/graphic/spriteset.cpp b/src/graphic/spriteset.cpp new file mode 100644 index 00000000..31e84e9d --- /dev/null +++ b/src/graphic/spriteset.cpp @@ -0,0 +1,44 @@ +/* + * The Mana World + * Copyright 2004 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#include "spriteset.h" + +Spriteset::Spriteset(Image *img, int width, int height) +{ + int x, y; + + for (y = 0; y + height <= img->getHeight(); y += height) + { + for (x = 0; x + width <= img->getWidth(); x += width) + { + spriteset.push_back(img->getSubImage(x, y, width, height)); + } + } +} + +Spriteset::~Spriteset() +{ + for (unsigned int i = 0; i < spriteset.size(); i++) { + delete spriteset[i]; + } +} diff --git a/src/graphic/spriteset.h b/src/graphic/spriteset.h new file mode 100644 index 00000000..b732d4cf --- /dev/null +++ b/src/graphic/spriteset.h @@ -0,0 +1,53 @@ +/* + * The Mana World + * Copyright 2004 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#ifndef _TMW_SPRITESET_H +#define _TMW_SPRITESET_H + +#include +#include +#include +#include +#include "../log.h" +#include "../resources/image.h" + +/** + * Stores a complete set of sprites. + */ +class Spriteset { + public: + // Vector storing the whole spriteset. + std::vector spriteset; + + /* + * Cuts the passed image in a grid of sub images. + */ + Spriteset::Spriteset(Image *img, int w, int h); + + /** + * Destructor. + */ + ~Spriteset(); +}; + +#endif diff --git a/src/gui/inventory.h b/src/gui/inventory.h index 87a99b07..7e7b7963 100644 --- a/src/gui/inventory.h +++ b/src/gui/inventory.h @@ -24,16 +24,12 @@ #ifndef _INVENTORY_H #define _INVENTORY_H -#ifdef WIN32 - #pragma warning (disable:4312) -#endif - #include #include "../main.h" #include "../game.h" #include "../log.h" #include "../net/network.h" -#include "../graphic/image.h" +#include "../graphic/spriteset.h" #include "gui.h" #include "window.h" diff --git a/src/main.h b/src/main.h index bd85463d..66508e8e 100644 --- a/src/main.h +++ b/src/main.h @@ -34,7 +34,7 @@ #include "configuration.h" #include "gui/login.h" #include "gui/gui.h" -#include "graphic/image.h" +#include "graphic/spriteset.h" #include "resources/image.h" #include "log.h" #include "game.h" diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index 3a7b3897..838dcd6b 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -25,6 +25,7 @@ #include "image.h" #include "resourcemanager.h" #include +#include #ifdef WIN32 #include @@ -96,7 +97,7 @@ Resource* ResourceManager::get(const E_RESOURCE_TYPE &type, // Flip all of the idPath '/' to '\' unsigned int begPos = 0; unsigned int endPos = idPath.find("/"); - std::strstream result; + std::stringstream result; // Loop through and replace all the characters. while (endPos != std::string::npos) { -- cgit v1.2.3-70-g09d2