【发布时间】:2015-03-03 09:27:24
【问题描述】:
我在互联网和这里搜索过,我只找到了 1 个很好的帖子SDL_RenderCopy with an array of Rectangles。 (据我所知)没有答案,但我的问题与那里相同。有什么办法可以做到吗?
SDL_RenderCopy(renderer, texture, &rects[index], &sprPos);
调试是这样说的:
Error 1 error C2664: 'int SDL_RenderCopy(SDL_Renderer *,SDL_Texture *,const SDL_Rect *,const SDL_Rect *)' : cannot convert argument 3 from 'SDL_Rect **' to 'const SDL_Rect *' c:\users\kushnirenko\documents\visual studio 2013\projects\sdl_project\sdl_project\main.cpp 96 1 SDL_Project
2 IntelliSense: argument of type "SDL_Rect **" is incompatible with parameter of type "const SDL_Rect *" c:\Users\kushnirenko\Documents\Visual Studio 2013\Projects\SDL_Project\SDL_Project\main.cpp 96 37 SDL_Project
【问题讨论】:
-
Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example. -
您的答案甚至不直观。 OP,您是否从参数 3 中删除了与号?除非需要双指针,否则使用 & 不是素数;无论如何,数组都是通过引用传递的。