Пример #1
0
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;
}
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
0
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;
}