Sign in to follow this  
raptorstrike

Coulor key setting in ()

Recommended Posts

my debugger keeps pointing me back to this function void TempRectBlit(SDL_Surface* src,SDL_Surface* dst,SDL_Rect Parent_Rect) { SDL_Rect TempRect = Parent_Rect; SDL_SetColorKey(src, SDL_SRCCOLORKEY, SDL_MapRGB(src->format, 0, 0,0)); SDL_BlitSurface(src,NULL,dst,&TempRect); }; and im wondering if its okay to set a color key within a function thanks [grin] C++ Dev-Cpp API:SDL

Share this post


Link to post
Share on other sites
You could overload it and have something like this:


void TempRectBlit(SDL_Surface* src,SDL_Surface* dst,SDL_Rect Parent_Rect)
{
SDL_Rect TempRect = Parent_Rect;
SDL_BlitSurface(src,NULL,dst,&TempRect);
};

void TempRectBlit(SDL_Surface* src,SDL_Surface* dst,SDL_Rect Parent_Rect, int transR, int transG, int transB)
{
SDL_Rect TempRect = Parent_Rect;
SDL_SetColorKey(src, SDL_SRCCOLORKEY, SDL_MapRGB(src->format, transR, transG, transB));
SDL_BlitSurface(src,NULL,dst,&TempRect);
}

void TempRectBlit(SDL_Surface* src,SDL_Surface* dst,SDL_Rect Parent_Rect, bool BlackTrans)
{
SDL_Rect TempRect = Parent_Rect;
SDL_SetColorKey(src, SDL_SRCCOLORKEY, SDL_MapRGB(src->format, 0, 0, 0));
SDL_BlitSurface(src,NULL,dst,&TempRect);
}



I haven't tried compiling it so be warned.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this