Coulor key setting in ()
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
yes, but since it is a one-time operation, don't do it in your rendering/blitting function.
yes but what if the image is constantly being re-asigned and its former state is being push into a vector?? complicated i know
thanks for the reply [smile]
thanks for the reply [smile]
You could overload it and have something like this:
I haven't tried compiling it so be warned.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement