diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/gui.cpp | 2 | ||||
-rw-r--r-- | src/gui/gui.h | 20 | ||||
-rw-r--r-- | src/gui/viewport.cpp | 18 | ||||
-rw-r--r-- | src/gui/widgets/window.cpp | 20 |
4 files changed, 24 insertions, 36 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 5939345f0..6e78e3ac8 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -82,7 +82,7 @@ Gui::Gui(Graphics *const graphics) : mMouseCursors(nullptr), mMouseCursorAlpha(1.0f), mMouseInactivityTimer(0), - mCursorType(CURSOR_POINTER) + mCursorType(Cursor::CURSOR_POINTER) { logger->log1("Initializing GUI..."); // Set graphics diff --git a/src/gui/gui.h b/src/gui/gui.h index c327a4b81..e8969d666 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -23,6 +23,8 @@ #ifndef GUI_H #define GUI_H +#include "resources/cursor.h" + #include <guichan/gui.hpp> #include "localconsts.h" @@ -139,24 +141,6 @@ class Gui final : public gcn::Gui void getAbsolutePosition(gcn::Widget *widget, int &x, int &y); - /** - * Cursors are in graphic order from left to right. - * CURSOR_POINTER should be left untouched. - * CURSOR_TOTAL should always be last. - */ - enum - { - CURSOR_POINTER = 0, - CURSOR_RESIZE_ACROSS, - CURSOR_RESIZE_DOWN, - CURSOR_RESIZE_DOWN_LEFT, - CURSOR_RESIZE_DOWN_RIGHT, - CURSOR_FIGHT, - CURSOR_PICKUP, - CURSOR_TALK, - CURSOR_TOTAL - }; - protected: void handleMouseMoved(const gcn::MouseInput &mouseInput); diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 42e6473ee..e7d7ab85d 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -788,6 +788,7 @@ void Viewport::mouseMoved(gcn::MouseEvent &event A_UNUSED) if (mTextPopup->isVisible()) mTextPopup->setVisible(false); } + gui->setCursorType(Cursor::CURSOR_UP); return; } } @@ -801,31 +802,34 @@ void Viewport::mouseMoved(gcn::MouseEvent &event A_UNUSED) { // NPCs case ActorSprite::NPC: - gui->setCursorType(Gui::CURSOR_TALK); + gui->setCursorType(mHoverBeing->getHoverCursor()); break; // Monsters case ActorSprite::MONSTER: - gui->setCursorType(Gui::CURSOR_FIGHT); + gui->setCursorType(mHoverBeing->getHoverCursor()); break; + case ActorSprite::PORTAL: + gui->setCursorType(mHoverBeing->getHoverCursor()); + break; + + case ActorSprite::FLOOR_ITEM: case ActorSprite::UNKNOWN: case ActorSprite::PLAYER: - case ActorSprite::FLOOR_ITEM: - case ActorSprite::PORTAL: default: - gui->setCursorType(Gui::CURSOR_POINTER); + gui->setCursorType(Cursor::CURSOR_POINTER); break; } } // Item mouseover else if (mHoverItem) { - gui->setCursorType(Gui::CURSOR_PICKUP); + gui->setCursorType(mHoverItem->getHoverCursor()); } else { - gui->setCursorType(Gui::CURSOR_POINTER); + gui->setCursorType(Cursor::CURSOR_POINTER); } } diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 9128402ad..1a6eb334c 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -131,7 +131,7 @@ Window::Window(const std::string &caption, const bool modal, if (mModal) { - gui->setCursorType(Gui::CURSOR_POINTER); + gui->setCursorType(Cursor::CURSOR_POINTER); requestModalFocus(); } @@ -443,7 +443,7 @@ void Window::widgetMoved(const gcn::Event& event A_UNUSED) void Window::widgetHidden(const gcn::Event &event A_UNUSED) { if (gui) - gui->setCursorType(Gui::CURSOR_POINTER); + gui->setCursorType(Cursor::CURSOR_POINTER); if (!mFocusHandler) return; @@ -587,7 +587,7 @@ void Window::mouseReleased(gcn::MouseEvent &event A_UNUSED) { mouseResize = 0; if (gui) - gui->setCursorType(Gui::CURSOR_POINTER); + gui->setCursorType(Cursor::CURSOR_POINTER); } // This should be the responsibility of Guichan (and is from 0.8.0 on) @@ -602,7 +602,7 @@ void Window::mouseEntered(gcn::MouseEvent &event) void Window::mouseExited(gcn::MouseEvent &event A_UNUSED) { if (mGrip && !mouseResize && gui) - gui->setCursorType(Gui::CURSOR_POINTER); + gui->setCursorType(Cursor::CURSOR_POINTER); } void Window::updateResizeHandler(gcn::MouseEvent &event) @@ -617,22 +617,22 @@ void Window::updateResizeHandler(gcn::MouseEvent &event) { case BOTTOM | RIGHT: case TOP | LEFT: - gui->setCursorType(Gui::CURSOR_RESIZE_DOWN_RIGHT); + gui->setCursorType(Cursor::CURSOR_RESIZE_DOWN_RIGHT); break; case TOP | RIGHT: case BOTTOM | LEFT: - gui->setCursorType(Gui::CURSOR_RESIZE_DOWN_LEFT); + gui->setCursorType(Cursor::CURSOR_RESIZE_DOWN_LEFT); break; case BOTTOM: case TOP: - gui->setCursorType(Gui::CURSOR_RESIZE_DOWN); + gui->setCursorType(Cursor::CURSOR_RESIZE_DOWN); break; case RIGHT: case LEFT: - gui->setCursorType(Gui::CURSOR_RESIZE_ACROSS); + gui->setCursorType(Cursor::CURSOR_RESIZE_ACROSS); break; default: - gui->setCursorType(Gui::CURSOR_POINTER); + gui->setCursorType(Cursor::CURSOR_POINTER); } } @@ -735,7 +735,7 @@ void Window::setModal(bool modal) if (mModal) { if (gui) - gui->setCursorType(Gui::CURSOR_POINTER); + gui->setCursorType(Cursor::CURSOR_POINTER); requestModalFocus(); } else |