summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui.cpp30
-rw-r--r--src/gui/gui.h9
-rw-r--r--src/gui/window.h3
3 files changed, 14 insertions, 28 deletions
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