Oct 25, 2013 at 6:37pm UTC
Your fge_RenderCopy takes SDL_Rects by value , this means you cannot pass in NULL (which is a pointer), you must pass in an actual rect.
To fix, you can change your fge_RenderCopy function to take the Rect by pointer instead of by value:
void fge_RenderCopy(SDL_Renderer * renderer, SDL_Texture * tex, SDL_Rect* srcRect, SDL_Rect* dstRect)
Oct 25, 2013 at 6:43pm UTC
now it gives this error
cannot convert 'SDL_Rect**' to 'const SDL_Rect*' for argument '3' to 'int
SDL_RenderCopy(SDL_Renderer*, SDL_Texture*, const SDL_Rect*, const SDL_Rect*)'|
if i change it to
1 2 3 4 5 6 7
void fge_RenderCopy(SDL_Renderer * renderer, SDL_Texture * tex, SDL_Rect * srcRect, SDL_Rect * dstRect)
{
if (!renderer||!tex)
fge_BailOut("texture and renderer can not be NULL" );
if (SDL_RenderCopy(renderer, tex, srcRect, dstRect) < 0)
fge_Logger("copying texture to renderer failed" );
}
it gives
multiple definition of `fge_RenderCopy(SDL_Renderer*, SDL_Texture*, SDL_Rect*, SDL_Rect*)'|
i tried many possibilities even the ones dont make sense still couldnt solve it
Last edited on Oct 25, 2013 at 6:44pm UTC
Oct 25, 2013 at 6:46pm UTC
The code you posted looks fine.
I've you're getting the "multiple definition" error then I'd wager that you have the function defined multiple times. =P
Oct 25, 2013 at 6:49pm UTC
well what if i say no what could it be.
even the debugger says fine and returns 0.
is it the compiler code::blocks 12.11(i dont think though)
EDIT: maybe i m missing sth
well yeah i missed sth. i added all the code to header file. now i changed that and everything is fine
ty Disch for your helps
EDIT2: but why is that problem to use it in .h file ??? i didnt even changed anything but it says multiple definition when i created this func in .h file ?????
Last edited on Oct 25, 2013 at 7:05pm UTC