2
0
Эх сурвалжийг харах

Treat a single frame animated cursor as a normal color cursor

Sam Lantinga 5 өдөр өмнө
parent
commit
23fcf53c53

+ 6 - 2
src/events/SDL_mouse.c

@@ -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);