65,210
社区成员
发帖
与我相关
我的任务
分享
void printSurface(SDL_Surface* source, int x,int y,int w,int h,
SDL_Surface* dest, int dx, int dy)
{
SDL_Rect src, dst;
src.x = x; src.y = y; src.w = w; src.h = h;
dst.x = dx; dst.y = dy; dst.w = src.w; dst.h = src.h;
//Blit
SDL_BlitSurface( source,&src, dest, &dst );
SDL_Flip(screen);
}
int hide(int direction, My_Surface* p)
{
int Hide_Speed =10;
int dist=p->wi;
int remain = dist%Hide_Speed;
for(int i=0; i<=dist;i+=Hide_Speed){
//cover the original
printSurface(p->background,p->x,p->y, p->wi, p->hi, p->parent, p->x, p->y);
//hide to the left;
printSurface(p->surface,i,0, p->wi, p->hi, p->parent, p->x, p->y);
}
if(remain>0){
//get ride of the remaining
printSurface(p->background,p->x,p->y, p->wi, p->hi, p->parent, p->x, p->y);
}
return 0;
}