MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / UpdateCursor

Method UpdateCursor

Source/Engine/Platform/SDL/SDLWindow.cpp:984–1042  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

982}
983
984void SDLWindow::UpdateCursor()
985{
986 if (_cursor == CursorType::Hidden)
987 {
988 SDL_HideCursor();
989
990 if (_isTrackingMouse)
991 Input::Mouse->SetRelativeMode(true, this);
992 return;
993 }
994 SDL_ShowCursor();
995 //if (_isTrackingMouse)
996 // Input::Mouse->SetRelativeMode(false, this);
997
998 int32 index = SDL_SYSTEM_CURSOR_DEFAULT;
999 switch (_cursor)
1000 {
1001 case CursorType::Cross:
1002 index = SDL_SYSTEM_CURSOR_CROSSHAIR;
1003 break;
1004 case CursorType::Hand:
1005 index = SDL_SYSTEM_CURSOR_POINTER;
1006 break;
1007 case CursorType::Help:
1008 //index = SDL_SYSTEM_CURSOR_DEFAULT;
1009 break;
1010 case CursorType::IBeam:
1011 index = SDL_SYSTEM_CURSOR_TEXT;
1012 break;
1013 case CursorType::No:
1014 index = SDL_SYSTEM_CURSOR_NOT_ALLOWED;
1015 break;
1016 case CursorType::Wait:
1017 index = SDL_SYSTEM_CURSOR_WAIT;
1018 break;
1019 case CursorType::SizeAll:
1020 index = SDL_SYSTEM_CURSOR_MOVE;
1021 break;
1022 case CursorType::SizeNESW:
1023 index = SDL_SYSTEM_CURSOR_NESW_RESIZE;
1024 break;
1025 case CursorType::SizeNS:
1026 index = SDL_SYSTEM_CURSOR_NS_RESIZE;
1027 break;
1028 case CursorType::SizeNWSE:
1029 index = SDL_SYSTEM_CURSOR_NWSE_RESIZE;
1030 break;
1031 case CursorType::SizeWE:
1032 index = SDL_SYSTEM_CURSOR_EW_RESIZE;
1033 break;
1034 case CursorType::Default:
1035 default:
1036 break;
1037 }
1038
1039 if (SDLImpl::Cursors[index] == nullptr)
1040 SDLImpl::Cursors[index] = SDL_CreateSystemCursor(static_cast<SDL_SystemCursor>(index));
1041 SDL_SetCursor(SDLImpl::Cursors[index]);

Callers

nothing calls this directly

Calls 1

SetRelativeModeMethod · 0.80

Tested by

no test coverage detected