-4
我在互聯網上搜索過,在這裏,我發現只有1井後SDL_RenderCopy with an array of Rectangles。有(據我所知)沒有答案,但我的問題是一樣的。有什麼辦法可以做到這一點?SDL_RenderCopy()不適用於數組
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
_問題尋求調試幫助(「爲什麼不是這個代碼工作嗎?」)必須包括所需的行爲,特定的問題或錯誤以及在問題中重現它的最短代碼本身。沒有明確問題陳述的問題對其他讀者無益。請參閱:如何創建最小,完整和可驗證的示例.'_ –
您的答案甚至不直觀。 OP,你是否從參數3中刪除了&符號?除非預期有雙指針,否則使用&符號不是主要的;無論如何,數組通過引用傳遞。 – Poriferous