mirror of
https://github.com/glfw/glfw.git
synced 2026-09-23 09:08:58 +00:00
Use switch statement instead of if-else-chain for cursor shapes
Closes #1739.
This commit is contained in:
+34
-23
@@ -2123,30 +2123,41 @@ int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
||||
{
|
||||
int id = 0;
|
||||
|
||||
if (shape == GLFW_ARROW_CURSOR)
|
||||
id = OCR_NORMAL;
|
||||
else if (shape == GLFW_IBEAM_CURSOR)
|
||||
id = OCR_IBEAM;
|
||||
else if (shape == GLFW_CROSSHAIR_CURSOR)
|
||||
id = OCR_CROSS;
|
||||
else if (shape == GLFW_POINTING_HAND_CURSOR)
|
||||
id = OCR_HAND;
|
||||
else if (shape == GLFW_RESIZE_EW_CURSOR)
|
||||
id = OCR_SIZEWE;
|
||||
else if (shape == GLFW_RESIZE_NS_CURSOR)
|
||||
id = OCR_SIZENS;
|
||||
else if (shape == GLFW_RESIZE_NWSE_CURSOR)
|
||||
id = OCR_SIZENWSE;
|
||||
else if (shape == GLFW_RESIZE_NESW_CURSOR)
|
||||
id = OCR_SIZENESW;
|
||||
else if (shape == GLFW_RESIZE_ALL_CURSOR)
|
||||
id = OCR_SIZEALL;
|
||||
else if (shape == GLFW_NOT_ALLOWED_CURSOR)
|
||||
id = OCR_NO;
|
||||
else
|
||||
switch (shape)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Unknown standard cursor");
|
||||
return GLFW_FALSE;
|
||||
case GLFW_ARROW_CURSOR:
|
||||
id = OCR_NORMAL;
|
||||
break;
|
||||
case GLFW_IBEAM_CURSOR:
|
||||
id = OCR_IBEAM;
|
||||
break;
|
||||
case GLFW_CROSSHAIR_CURSOR:
|
||||
id = OCR_CROSS;
|
||||
break;
|
||||
case GLFW_POINTING_HAND_CURSOR:
|
||||
id = OCR_HAND;
|
||||
break;
|
||||
case GLFW_RESIZE_EW_CURSOR:
|
||||
id = OCR_SIZEWE;
|
||||
break;
|
||||
case GLFW_RESIZE_NS_CURSOR:
|
||||
id = OCR_SIZENS;
|
||||
break;
|
||||
case GLFW_RESIZE_NWSE_CURSOR:
|
||||
id = OCR_SIZENWSE;
|
||||
break;
|
||||
case GLFW_RESIZE_NESW_CURSOR:
|
||||
id = OCR_SIZENESW;
|
||||
break;
|
||||
case GLFW_RESIZE_ALL_CURSOR:
|
||||
id = OCR_SIZEALL;
|
||||
break;
|
||||
case GLFW_NOT_ALLOWED_CURSOR:
|
||||
id = OCR_NO;
|
||||
break;
|
||||
default:
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Unknown standard cursor");
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
cursor->win32.handle = LoadImageW(NULL,
|
||||
|
||||
Reference in New Issue
Block a user