67 for (StateMap::iterator c = g->second.begin(); c != g->second.end(); ++c)
87 CursorMap::iterator g =
_cursors.find(group);
89 std::pair<CursorMap::iterator, bool> result;
96 std::pair<StateMap::iterator, bool> result;
98 result = g->second.insert(std::make_pair(state, cursor.
get()));
160 return SDL_GetMouseState(&x, &y);
168 const float sW =
WindowMan.getWindowWidth();
169 const float sH =
WindowMan.getWindowHeight();
171 sX = ((float) x) - (sW / 2.0f);
172 sY = (sH - ((float) y)) - (sH / 2.0f);
176 const float sW =
WindowMan.getWindowWidth();
177 const float sH =
WindowMan.getWindowHeight();
179 x = (int) sX + (sW / 2.0f);
180 y = (int) (-sY - (sH / 2.0f)) + sH;
201 CursorMap::const_iterator g =
_cursors.find(group);
206 StateMap::const_iterator c = g->second.find(state);
207 if (c == g->second.end()) {
208 c = g->second.begin();
210 if (c == g->second.end())
bool add(const Common::UString &name, const Common::UString &group, const Common::UString &state="", int hotspotX=-1, int hotspotY=-1)
Add a cursor.
The global graphics manager.
void setPosition(int x, int y)
Move the cursor to a specific position.
const Common::UString & getCurrentGroup() const
Return the current group.
Common::UString _currentState
A class holding an UTF-8 string.
PointerType release()
Returns the plain pointer value and releases ScopedPtr.
void reset()
Reset the cursor to the system's default.
The global window manager.
void setGroup(const Common::UString &group)
Set the cursor to another group, using the current state name.
void set()
Set the cursor to the registered default.
void setState(const Common::UString &state)
Set the cursor to a different state within the current group.
Common::UString _currentGroup
const Common::UString & getCurrentState() const
Return the current state.
void clear()
Remove all managed cursors.
A simple scoped smart pointer template.
void exceptionDispatcherWarning(const char *s,...)
Exception dispatcher that prints the exception as a warning, and adds another reason on top...
Basic exceptions to throw.
const char * c_str() const
Return the (utf8 encoded) string data.
Utility templates and functions.
void toScreenCoordinates(int x, int y, float &sX, float &sY)
Convert cursor position to screen position.
#define DECLARE_SINGLETON(T)
Note that you need to use this macro from the global namespace.
bool isVisible() const
Is a cursor current visible?
Cursor * find(Common::UString &group, Common::UString &state, bool def=false) const
Common::UString _defaultState
void hideCursor()
Hide the cursor completely.
void setDefault(const Common::UString &group, const Common::UString &state="")
Register this cursor as the default cursor.
A scoped plain pointer, allowing pointer-y access and normal deletion.
A cursor as used in the Aurora engines.
Convenience class that locks a mutex on creation and unlocks it on destruction.
The Aurora cursor manager.
The global Aurora cursor manager.
Common::UString _defaultGroup
void fromScreenCoordinates(float sX, float sY, int &x, int &y)
Convert screen position to cursor position.
#define WindowMan
Shortcut for accessing the window manager.
PointerType get() const
Returns the plain pointer value.
std::map< Common::UString, Cursor * > StateMap
A cursor as used in the Aurora engines.
void showCursor()
Unhide the cursor.
uint8 getPosition(int &x, int &y) const
Get the current cursor position.
void clear()
Clear the string's contents.
#define GfxMan
Shortcut for accessing the graphics manager.