summaryrefslogtreecommitdiff
path: root/src/graphic
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-02-13 14:10:15 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-02-13 14:10:15 +0000
commit821732ebbc2760ec98e0097f38a962c67285d421 (patch)
tree2e4fbb5b22108bf6d71011541acb927e9f633a5e /src/graphic
parent6c5351a2cbe2655a6b255cb882ade9e6f988c0ea (diff)
downloadmana-821732ebbc2760ec98e0097f38a962c67285d421.tar.gz
mana-821732ebbc2760ec98e0097f38a962c67285d421.tar.bz2
mana-821732ebbc2760ec98e0097f38a962c67285d421.tar.xz
mana-821732ebbc2760ec98e0097f38a962c67285d421.zip
Allow preservation of alpha channel when loading image resources, which is used
to load alpha blended mouse cursor, which is now drawn instead of using the system cursor.
Diffstat (limited to 'src/graphic')
-rw-r--r--src/graphic/graphic.cpp16
-rw-r--r--src/graphic/graphic.h3
2 files changed, 18 insertions, 1 deletions
diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp
index d39338de..a0786e59 100644
--- a/src/graphic/graphic.cpp
+++ b/src/graphic/graphic.cpp
@@ -150,9 +150,20 @@ int get_y_offset(Being *being) {
}
-Graphics::Graphics()
+Graphics::Graphics():
+ mouseCursor(NULL)
{
setTarget(SDL_GetVideoSurface());
+
+ // Load the mouse cursor
+ ResourceManager *resman = ResourceManager::getInstance();
+ mouseCursor = resman->getImage("core/graphics/gui/mouse.png", IMG_ALPHA);
+ if (!mouseCursor) {
+ error("Unable to load mouse cursor.");
+ }
+
+ // Hide the system mouse cursor
+ SDL_ShowCursor(SDL_DISABLE);
}
Graphics::~Graphics() {
@@ -210,6 +221,9 @@ void Graphics::drawImageRect(
void Graphics::updateScreen()
{
+ // Draw mouse before flipping
+ mouseCursor->draw(screen, mouseX - 5, mouseY - 2);
+
SDL_Flip(screen);
}
diff --git a/src/graphic/graphic.h b/src/graphic/graphic.h
index 0bae4327..3e4bc168 100644
--- a/src/graphic/graphic.h
+++ b/src/graphic/graphic.h
@@ -152,6 +152,9 @@ class Graphics : public gcn::SDLGraphics {
* screen or swapping pages.
*/
void updateScreen();
+
+ private:
+ Image *mouseCursor;
};
/**