This commit is contained in:
2025-11-07 17:01:29 +01:00
parent 84b5ff05ad
commit 6e3cd05cd2
12 changed files with 129 additions and 38 deletions

View File

@@ -35,8 +35,8 @@ void Resource::destroy() { delete Resource::resource; }
auto Resource::get() -> Resource* { return Resource::resource; }
// Constructor
Resource::Resource() {
loading_text_ = Screen::get()->getText();
Resource::Resource()
: loading_text_(Screen::get()->getText()) {
load();
}
@@ -353,9 +353,9 @@ void Resource::createText() {
{"subatomic", "subatomic.gif", "subatomic.txt"},
{"8bithud", "8bithud.gif", "8bithud.txt"}};
for (const auto& resource : resources) {
texts_.emplace_back(resource.key, std::make_shared<Text>(getSurface(resource.texture_file), getTextFile(resource.text_file)));
printWithDots("Text : ", resource.key, "[ DONE ]");
for (const auto& res_info : resources) {
texts_.emplace_back(res_info.key, std::make_shared<Text>(getSurface(res_info.texture_file), getTextFile(res_info.text_file)));
printWithDots("Text : ", res_info.key, "[ DONE ]");
}
}
@@ -415,7 +415,7 @@ void Resource::renderProgress() {
Screen::get()->clearSurface(static_cast<Uint8>(PaletteColor::BLACK));
auto surface = Screen::get()->getRendererSurface();
const auto TEXT_COLOR = static_cast<Uint8>(PaletteColor::BRIGHT_WHITE);
const auto LOADING_TEXT_COLOR = static_cast<Uint8>(PaletteColor::BRIGHT_WHITE);
const auto BAR_COLOR = static_cast<Uint8>(PaletteColor::WHITE);
const int TEXT_HEIGHT = loading_text_->getCharacterSize();
const int CENTER_X = Options::game.width / 2;
@@ -427,7 +427,7 @@ void Resource::renderProgress() {
CENTER_X - (loading_text_->lenght(APP_NAME) / 2),
CENTER_Y - TEXT_HEIGHT,
APP_NAME,
TEXT_COLOR);
LOADING_TEXT_COLOR);
// Draw VERSION centered below center
const std::string VERSION_TEXT = "(" + std::string(Version::GIT_HASH) + ")";
@@ -435,7 +435,7 @@ void Resource::renderProgress() {
CENTER_X - (loading_text_->lenght(VERSION_TEXT) / 2),
CENTER_Y + TEXT_HEIGHT,
VERSION_TEXT,
TEXT_COLOR);
LOADING_TEXT_COLOR);
// Draw progress bar border
const float WIRED_BAR_WIDTH = Options::game.width - (X_PADDING * 2);