Treat a single frame animated cursor as a normal color cursor

This commit is contained in:
Sam Lantinga
2025-10-19 23:03:54 -07:00
parent bd86e85249
commit 23fcf53c53

View File

@@ -1636,15 +1636,19 @@ SDL_Cursor *SDL_CreateAnimatedCursor(SDL_CursorFrameInfo *frames, int frame_coun
}
CHECK_PARAM(!frames[0].surface) {
SDL_SetError("Null surface in frame 0");
SDL_SetError("NULL surface in frame 0");
return NULL;
}
CHECK_PARAM(!frame_count) {
CHECK_PARAM(frame_count <= 0) {
SDL_InvalidParamError("frame_count");
return NULL;
}
if (frame_count == 1) {
return SDL_CreateColorCursor(frames[0].surface, hot_x, hot_y);
}
// Allow specifying the hot spot via properties on the surface
SDL_PropertiesID props = SDL_GetSurfaceProperties(frames[0].surface);
hot_x = (int)SDL_GetNumberProperty(props, SDL_PROP_SURFACE_HOTSPOT_X_NUMBER, hot_x);