本文整理汇总了C++中LTexture::setBlendMode方法的典型用法代码示例。如果您正苦于以下问题:C++ LTexture::setBlendMode方法的具体用法?C++ LTexture::setBlendMode怎么用?C++ LTexture::setBlendMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LTexture
的用法示例。
在下文中一共展示了LTexture::setBlendMode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadMedia
bool loadMedia()
{
//Loading success flag
bool success = true;
//Load front alpha texture
if( !gModulatedTexture.loadFromFile( "13_alpha_blending/fadeout.png" ) )
{
printf( "Failed to load front texture!\n" );
success = false;
}
else
{
//Set standard alpha blending
gModulatedTexture.setBlendMode( SDL_BLENDMODE_BLEND );
}
//Load background texture
if( !gBackgroundTexture.loadFromFile( "13_alpha_blending/fadein.png" ) )
{
printf( "Failed to load background texture!\n" );
success = false;
}
return success;
}
示例2: render
void Scoreboard::render( SDL_Renderer* gRenderer, TTF_Font* gFont, LTexture gTextTexture ) {
string s = std::to_string( static_cast<long long>( score ) );
s = string( 10 - s.size(), ' ' ) + s;
string text = "Score: " + s;
gTextTexture.loadFromRenderedText( text, textColor );
gTextTexture.setBlendMode( SDL_BLENDMODE_BLEND );
gTextTexture.setAlpha( 150 );
gTextTexture.render( xPos, yPos, gRenderer );
}
示例3:
int
load_media(void)
{
/* load front alpha texture */
if (gModulatedTexture.loadFromFile("fadeout.png") == -1) {
fprintf(stderr, "Failed to load front texture!\n");
return -1;
} else {
/*set standard alpha blending */
gModulatedTexture.setBlendMode(SDL_BLENDMODE_BLEND);
}
/* load background texture */
if (gBackgroundTexture.loadFromFile("fadein.png") == -1) {
fprintf(stderr, "Failed to load background texture!\n");
return -1;
}
return 0;
}