|
本帖最后由 Riemann 于 2012-7-25 21:35 编辑
int JY_Background(int x1,int y1,int x2,int y2,int Bright)
{
SDL_Surface* lps1;
SDL_Rect r;
if(x2<=x1 || y2<=y1)
return 0;
Bright=256-Bright;
if(Bright>255)
Bright=255;
lps1=SDL_CreateRGBSurface(SDL_SWSURFACE,x2-x1,y2-y1,g_Surface->format->BitsPerPixel,
g_Surface->format->Rmask,g_Surface->format->Gmask,g_Surface->format->Bmask,0);
SDL_FillRect(lps1,NULL,0);
SDL_SetAlpha(lps1,SDL_SRCALPHA,(Uint8)Bright);
r.x=x1;
r.y=y1;
SDL_BlitSurface(lps1,NULL,g_Surface,&r);
SDL_FreeSurface(lps1);
return 1;
}int JY_Background(int x1,int y1,int x2,int y2,int Bright)
{
SDL_Surface* lps1;
SDL_Rect r;
if(x2<=x1 || y2<=y1)
return 0;
Bright=256-Bright;
if(Bright>255)
Bright=255;
lps1=SDL_CreateRGBSurface(SDL_SWSURFACE,x2-x1,y2-y1,g_Surface->format->BitsPerPixel,
g_Surface->format->Rmask,g_Surface->format->Gmask,g_Surface->format->Bmask,0);
SDL_FillRect(lps1,NULL,0);
SDL_SetAlpha(lps1,SDL_SRCALPHA,(Uint8)Bright);
r.x=x1;
r.y=y1;
SDL_BlitSurface(lps1,NULL,g_Surface,&r);
SDL_FreeSurface(lps1);
return 1;
}
想请教下各位大大,以下三个参数有接口调吗,就是能不能画有颜色的背景块啊,不想要灰色的
g_Surface->format->Rmask,g_Surface->format->Gmask,g_Surface->format->Bmask |
|