El game_text dels items ja son textures generades i precarregades
This commit is contained in:
@@ -140,12 +140,13 @@ void Text::write(int x, int y, const std::string &text, int kerning, int lenght)
|
||||
}
|
||||
|
||||
// Escribe el texto en una textura
|
||||
std::shared_ptr<Texture> Text::writeToTexture(int x, int y, const std::string &text, int kerning)
|
||||
std::shared_ptr<Texture> Text::writeToTexture(const std::string &text, int kerning)
|
||||
{
|
||||
auto renderer = Screen::get()->getRenderer();
|
||||
auto texture = std::make_shared<Texture>(renderer);
|
||||
auto width = lenght(text, kerning);
|
||||
texture->createBlank(width, box_height_);
|
||||
texture->createBlank(width, box_height_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET);
|
||||
texture->setBlendMode(SDL_BLENDMODE_BLEND);
|
||||
texture->setAsRenderTarget(renderer);
|
||||
write(0, 0, text, kerning);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user