summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2007-08-24 09:14:27 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2007-08-24 09:14:27 +0000
commit78e280de977329aec2b9ad5926882dc9af4d152d (patch)
tree44f3dbc5115982a15171dfe8a12884bbcb043bfd
parentb0969b283f6c8bb0701f74e61f8086963f44ff93 (diff)
downloadmana-78e280de977329aec2b9ad5926882dc9af4d152d.tar.gz
mana-78e280de977329aec2b9ad5926882dc9af4d152d.tar.bz2
mana-78e280de977329aec2b9ad5926882dc9af4d152d.tar.xz
mana-78e280de977329aec2b9ad5926882dc9af4d152d.zip
Removed useless logic method and reverted mouse cursor to non-static since
there can be only one Gui instance so there is no point in supporting a shared resource.
-rw-r--r--ChangeLog8
-rw-r--r--src/gui/gui.cpp30
-rw-r--r--src/gui/gui.h9
-rw-r--r--src/gui/window.h3
-rw-r--r--src/localplayer.cpp2
5 files changed, 22 insertions, 30 deletions
diff --git a/ChangeLog b/ChangeLog
index 668ebb9a..6c450eb5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,10 @@
-2007-08-23 Bjørn Lindeijer <bjorn@lindeijer.nl>
+2007-08-24 Bjørn Lindeijer <bjorn@lindeijer.nl>
+
+ * src/gui/gui.h, src/gui/gui.cpp: Removed useless logic method and
+ reverted mouse cursor to non-static since there can be only one Gui
+ instance so there is no point in supporting a shared resource.
+
+2007-08-23 Bjørn Lindeijer <bjorn@lindeijer.nl>
* src/gui/viewport.h, src/gui/viewport.cpp: Removed two useless popup
related methods.
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index bcb4ac0a..84680da8 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -59,7 +59,6 @@ gcn::Font *hitBlueFont;
gcn::Font *hitYellowFont;
// Font used to display speech and player names
gcn::Font *speechFont;
-ImageSet *Gui::mMouseCursor = NULL;
class GuiConfigListener : public ConfigListener
{
@@ -81,7 +80,9 @@ class GuiConfigListener : public ConfigListener
Gui::Gui(Graphics *graphics):
mHostImageLoader(NULL),
- mCustomCursor(false)
+ mCustomCursor(false),
+ mMouseCursors(NULL),
+ mCursorType(CURSOR_POINTER)
{
logger->log("Initializing GUI...");
// Set graphics
@@ -178,10 +179,10 @@ Gui::~Gui()
delete hitBlueFont;
delete hitYellowFont;
- if (mMouseCursor) {
- mMouseCursor->decRef();
- mMouseCursor = NULL;
+ if (mMouseCursors) {
+ mMouseCursors->decRef();
}
+
delete mGuiFont;
delete speechFont;
delete viewport;
@@ -193,12 +194,6 @@ Gui::~Gui()
}
void
-Gui::logic()
-{
- gcn::Gui::logic();
-}
-
-void
Gui::draw()
{
mGraphics->pushClipArea(mTop->getDimension());
@@ -211,7 +206,7 @@ Gui::draw()
mCustomCursor)
{
static_cast<Graphics*>(mGraphics)->drawImage(
- mMouseCursor->get(mCursorType),
+ mMouseCursors->get(mCursorType),
mouseX - 15,
mouseY - 17);
}
@@ -233,13 +228,12 @@ Gui::setUseCustomCursor(bool customCursor)
// Load the mouse cursor
ResourceManager *resman = ResourceManager::getInstance();
- mMouseCursor =
+ mMouseCursors =
resman->getImageSet("graphics/gui/mouse.png", 40, 40);
- if (!mMouseCursor) {
+ if (!mMouseCursors) {
logger->error("Unable to load mouse cursors.");
}
- mCursorType = CURSOR_POINTER;
}
else
{
@@ -247,9 +241,9 @@ Gui::setUseCustomCursor(bool customCursor)
SDL_ShowCursor(SDL_ENABLE);
// Unload the mouse cursor
- if (mMouseCursor) {
- mMouseCursor->decRef();
- mMouseCursor = NULL;
+ if (mMouseCursors) {
+ mMouseCursors->decRef();
+ mMouseCursors = NULL;
}
}
}
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 21b10454..70afbb79 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -60,12 +60,6 @@ class Gui : public gcn::Gui
~Gui();
/**
- * Works around Guichan bug
- */
- void
- logic();
-
- /**
* Draws the whole Gui by calling draw functions down in the
* Gui hierarchy. It also draws the mouse pointer.
*/
@@ -119,9 +113,8 @@ class Gui : public gcn::Gui
gcn::ImageLoader *mImageLoader; /**< For loading images */
gcn::Font *mGuiFont; /**< The global GUI font */
bool mCustomCursor; /**< Show custom cursor */
+ ImageSet *mMouseCursors; /**< Mouse cursor images */
int mCursorType;
-
- static ImageSet *mMouseCursor; /**< Mouse cursor images */
};
extern Gui *gui; /**< The GUI system */
diff --git a/src/gui/window.h b/src/gui/window.h
index 03dfafb2..8b6382a2 100644
--- a/src/gui/window.h
+++ b/src/gui/window.h
@@ -295,6 +295,7 @@ class Window : public gcn::Window
static int instances; /**< Number of Window instances */
static int mouseResize; /**< Window is being resized */
static ImageRect border; /**< The window border and background */
+ static Image *closeImage; /**< Close Button Image */
/**
* The width of the resize border. Is independent of the actual window
@@ -302,8 +303,6 @@ class Window : public gcn::Window
* where two borders are moved at the same time.
*/
static const int resizeBorderWidth = 10;
- static Image *closeImage; /**< Close Button Image */
-
};
#endif
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index e6a52e10..ddef8b3b 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -45,9 +45,9 @@ LocalPlayer *player_node = NULL;
LocalPlayer::LocalPlayer(Uint32 id, Uint16 job, Map *map):
Player(id, job, map),
- mXp(0),
mAttackRange(0),
mInventory(new Inventory()),
+ mXp(0),
mTarget(NULL), mPickUpTarget(NULL),
mTrading(false), mLastAction(-1)
{