mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-11-13 22:08:54 +00:00
Treat a single frame animated cursor as a normal color cursor
This commit is contained in:
@@ -1636,15 +1636,19 @@ SDL_Cursor *SDL_CreateAnimatedCursor(SDL_CursorFrameInfo *frames, int frame_coun
|
|||||||
}
|
}
|
||||||
|
|
||||||
CHECK_PARAM(!frames[0].surface) {
|
CHECK_PARAM(!frames[0].surface) {
|
||||||
SDL_SetError("Null surface in frame 0");
|
SDL_SetError("NULL surface in frame 0");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_PARAM(!frame_count) {
|
CHECK_PARAM(frame_count <= 0) {
|
||||||
SDL_InvalidParamError("frame_count");
|
SDL_InvalidParamError("frame_count");
|
||||||
return NULL;
|
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
|
// Allow specifying the hot spot via properties on the surface
|
||||||
SDL_PropertiesID props = SDL_GetSurfaceProperties(frames[0].surface);
|
SDL_PropertiesID props = SDL_GetSurfaceProperties(frames[0].surface);
|
||||||
hot_x = (int)SDL_GetNumberProperty(props, SDL_PROP_SURFACE_HOTSPOT_X_NUMBER, hot_x);
|
hot_x = (int)SDL_GetNumberProperty(props, SDL_PROP_SURFACE_HOTSPOT_X_NUMBER, hot_x);
|
||||||
|
|||||||
Reference in New Issue
Block a user