0
如何更改SDL_Texture的不透明度?而且我不知道如何在我的功能中应用不透明度数字。SDL_Texture不透明度
我的代码
void drawTexture(SDL_Texture *img, int x, int y, int width, int height, double opacity)
{
SDL_Rect SrcR;
SDL_Rect DestR;
SrcR.x = 0;
SrcR.y = 0;
SrcR.w = width;
SrcR.h = height;
DestR.x = x;
DestR.y = y;
DestR.w = width;
DestR.h = height;
SDL_RenderCopy(_main::_main_renderer, img, &SrcR, &DestR);
}
谢谢,但必须有不透明度0-255。 – PSSGCSim
在这种情况下,您可以将它传递给像这样的函数: 'SDL_SetTextureAlphaMod(img,opacity/255.0);' – xorguy