El game_text dels items ja son textures generades i precarregades

This commit is contained in:
2024-10-29 16:04:14 +01:00
parent e2abf835f9
commit d83c05bad4
12 changed files with 48 additions and 30 deletions

View File

@@ -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);