Hey, I am having trouble trying to set a default value for a function in one of my classes.
Here is where I am trying to set it:
void Sprite::Spr_Blit(SDL_Surface* source, SDL_Surface* dest, SDL_Rect* clip = NULL)
{
SDL_Rect offset;
offset.x = getX();
offset.y =getY();
SDL_BlitSurface(source,clip,dest,&offset);
}
Here is the Spr_Blit defined in my header:
void Spr_Blit(SDL_Surface* source, SDL_Surface* dest, SDL_Rect* clip);
And here is where I call this function in main:
//refresh the bg
g_level.Spr_Blit(g_level.getSprite(),g_SrWindow);
//draw player
// g_player.Spr_Blit(g_player.getSprite(),g_SrWindow);
This is the error I receive:
main.cpp||In function ‘int main(int, char**)’:|
main.cpp
|163|error: no matching function for call to ‘Sprite::Spr_Blit(SDL_Surface*, SDL_Surface*&)’|
Sprite.h
|15|note: candidates are: void Sprite::Spr_Blit(SDL_Surface*, SDL_Surface*, SDL_Rect*)|
main.cpp
|165|error: no matching function for call to ‘Player::Spr_Blit(SDL_Surface*, SDL_Surface*&)’|
Sprite.h
|15|note: candidates are: void Sprite::Spr_Blit(SDL_Surface*, SDL_Surface*, SDL_Rect*)|
||=== Build finished: 2 errors, 0 warnings ===|
It looks like it is trying to combine the last 2 arguments or something? Can anyone give me a push?