noves coses chules en la clase text

This commit is contained in:
2025-08-17 14:25:17 +02:00
parent fe0083abd4
commit ff2a51a507
7 changed files with 184 additions and 19 deletions

View File

@@ -626,9 +626,9 @@ void Resource::createTextTextures() {
{"game_text_stop", Lang::getText("[GAME_TEXT] 6")},
{"game_text_1000000_points", Lang::getText("[GAME_TEXT] 8")}};
auto text = getText("04b_25");
auto text = getText("04b_25_enhanced");
for (const auto &s : strings) {
textures_.emplace_back(s.name, text->writeToTexture(s.text, 1, -2));
textures_.emplace_back(s.name, text->writeDXToTexture(Text::STROKE, s.text, -2, NO_TEXT_COLOR, 1, Color(255, 255, 0, 255)));
printWithDots("Texture : ", s.name, "[ DONE ]");
}
@@ -653,15 +653,18 @@ void Resource::createText() {
std::string key;
std::string texture_file;
std::string text_file;
std::string white_texture_file; // Textura blanca opcional
ResourceInfo(std::string k, std::string t_file, std::string txt_file)
: key(std::move(k)), texture_file(std::move(t_file)), text_file(std::move(txt_file)) {}
ResourceInfo(std::string k, std::string t_file, std::string txt_file, std::string w_file = "")
: key(std::move(k)), texture_file(std::move(t_file)), text_file(std::move(txt_file)), white_texture_file(std::move(w_file)) {}
};
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n>> CREATING TEXT OBJECTS");
std::vector<ResourceInfo> resources = {
{"04b_25", "04b_25.png", "04b_25.txt"},
{"04b_25_enhanced", "04b_25.png", "04b_25.txt", "04b_25_white.png"}, // Nueva fuente con textura blanca
{"04b_25_white", "04b_25_white.png", "04b_25.txt"},
{"04b_25_2x", "04b_25_2x.png", "04b_25_2x.txt"},
{"04b_25_metal", "04b_25_metal.png", "04b_25.txt"},
{"04b_25_grey", "04b_25_grey.png", "04b_25.txt"},
@@ -675,7 +678,13 @@ void Resource::createText() {
{"smb2_grad", "smb2_grad.png", "smb2.txt"}};
for (const auto &resource : resources) {
texts_.emplace_back(resource.key, std::make_shared<Text>(getTexture(resource.texture_file), getTextFile(resource.text_file)));
if (!resource.white_texture_file.empty()) {
// Crear texto con textura blanca
texts_.emplace_back(resource.key, std::make_shared<Text>(getTexture(resource.texture_file), getTexture(resource.white_texture_file), getTextFile(resource.text_file)));
} else {
// Crear texto normal
texts_.emplace_back(resource.key, std::make_shared<Text>(getTexture(resource.texture_file), getTextFile(resource.text_file)));
}
printWithDots("Text : ", resource.key, "[ DONE ]");
}
}