summaryrefslogtreecommitdiff
path: root/src/gui/gui.cpp
diff options
context:
space:
mode:
authorJoshua Langley <joshlangley[at]optusnet.com.au>2007-08-20 05:29:12 +0000
committerJoshua Langley <joshlangley[at]optusnet.com.au>2007-08-20 05:29:12 +0000
commitc322e6eac2373358c04e7bd70c8e0fc1bcfb37db (patch)
tree3ad86b222fa2e2688807a47cf500ec36567f8b6b /src/gui/gui.cpp
parent1d9b37e81b1c91986644d6e9580422e6f8b47e25 (diff)
downloadmana-client-c322e6eac2373358c04e7bd70c8e0fc1bcfb37db.tar.gz
mana-client-c322e6eac2373358c04e7bd70c8e0fc1bcfb37db.tar.bz2
mana-client-c322e6eac2373358c04e7bd70c8e0fc1bcfb37db.tar.xz
mana-client-c322e6eac2373358c04e7bd70c8e0fc1bcfb37db.zip
Added close button functionality, resize cursor cues.
Diffstat (limited to 'src/gui/gui.cpp')
-rw-r--r--src/gui/gui.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 60d5ae8a..ba9aa930 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -44,7 +44,7 @@
#include "../graphics.h"
#include "../log.h"
-#include "../resources/image.h"
+#include "../resources/imageset.h"
#include "../resources/resourcemanager.h"
#include "../resources/sdlimageloader.h"
@@ -59,6 +59,7 @@ 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
{
@@ -80,7 +81,6 @@ class GuiConfigListener : public ConfigListener
Gui::Gui(Graphics *graphics):
mHostImageLoader(NULL),
- mMouseCursor(NULL),
mCustomCursor(false)
{
logger->log("Initializing GUI...");
@@ -180,8 +180,8 @@ Gui::~Gui()
if (mMouseCursor) {
mMouseCursor->decRef();
+ mMouseCursor = NULL;
}
-
delete mGuiFont;
delete speechFont;
delete viewport;
@@ -210,9 +210,11 @@ Gui::draw()
if ((SDL_GetAppState() & SDL_APPMOUSEFOCUS || button & SDL_BUTTON(1))
&& mCustomCursor)
{
- dynamic_cast<Graphics*>(mGraphics)->drawImage(mMouseCursor,
- mouseX - 5,
- mouseY - 2);
+
+ static_cast<Graphics*>(mGraphics)->drawImage(
+ mMouseCursor->get(mCursorType),
+ mouseX - 15,
+ mouseY - 17);
}
mGraphics->popClipArea();
@@ -232,10 +234,13 @@ Gui::setUseCustomCursor(bool customCursor)
// Load the mouse cursor
ResourceManager *resman = ResourceManager::getInstance();
- mMouseCursor = resman->getImage("graphics/gui/mouse.png");
+ mMouseCursor =
+ resman->getImageSet("graphics/gui/mouse.png", 40, 40);
+
if (!mMouseCursor) {
- logger->error("Unable to load mouse cursor.");
+ logger->error("Unable to load mouse cursors.");
}
+ mCursorType = CURSOR_POINTER;
}
else
{