KeyMap.sort();\r
}\r
\r
+void CIrrDeviceSDL::CCursorControl::initCursors()\r
+{\r
+ Cursors.reserve(gui::ECI_COUNT);\r
+\r
+ Cursors.emplace_back(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW)); // ECI_NORMAL\r
+ Cursors.emplace_back(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_CROSSHAIR)); // ECI_CROSS\r
+ Cursors.emplace_back(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_HAND)); // ECI_HAND\r
+ Cursors.emplace_back(nullptr); // ECI_HELP\r
+ Cursors.emplace_back(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_IBEAM)); // ECI_IBEAM\r
+ Cursors.emplace_back(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_NO)); // ECI_NO\r
+ Cursors.emplace_back(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_WAIT)); // ECI_WAIT\r
+ Cursors.emplace_back(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEALL)); // ECI_SIZEALL\r
+ Cursors.emplace_back(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENESW)); // ECI_SIZENESW\r
+ Cursors.emplace_back(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENWSE)); // ECI_SIZENWSE\r
+ Cursors.emplace_back(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENS)); // ECI_SIZENS\r
+ Cursors.emplace_back(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEWE)); // ECI_SIZEWE\r
+ Cursors.emplace_back(nullptr); // ECI_UP\r
+}\r
+\r
} // end namespace irr\r
\r
#endif // _IRR_COMPILE_WITH_SDL_DEVICE_\r
#include <SDL.h>\r
#include <SDL_syswm.h>\r
\r
+#include <memory>\r
+\r
namespace irr\r
{\r
\r
CCursorControl(CIrrDeviceSDL* dev)\r
: Device(dev), IsVisible(true)\r
{\r
+ initCursors();\r
}\r
\r
//! Changes the visible state of the mouse cursor.\r
}\r
}\r
\r
+ void setActiveIcon(gui::ECURSOR_ICON iconId) override\r
+ {\r
+ ActiveIcon = iconId;\r
+ if (iconId > Cursors.size() || !Cursors[iconId]) {\r
+ iconId = gui::ECI_NORMAL;\r
+ if (iconId > Cursors.size() || !Cursors[iconId])\r
+ return;\r
+ }\r
+ SDL_SetCursor(Cursors[iconId].get());\r
+ }\r
+\r
+ gui::ECURSOR_ICON getActiveIcon() const override\r
+ {\r
+ return ActiveIcon;\r
+ }\r
+\r
private:\r
\r
void updateCursorPos()\r
#endif\r
}\r
\r
+ void initCursors();\r
+\r
CIrrDeviceSDL* Device;\r
core::position2d<s32> CursorPos;\r
bool IsVisible;\r
+\r
+ struct CursorDeleter {\r
+ void operator()(SDL_Cursor *ptr) {\r
+ if (ptr)\r
+ SDL_FreeCursor(ptr);\r
+ }\r
+ };\r
+ std::vector<std::unique_ptr<SDL_Cursor, CursorDeleter>> Cursors;\r
+ gui::ECURSOR_ICON ActiveIcon;\r
};\r
\r
private:\r