From d493ebf4f0f7d731aa12dfa9217f0558d9474e54 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Tue, 14 Apr 2026 17:38:27 +0200 Subject: [PATCH] =?UTF-8?q?afegida=20versi=C3=B3=20controlada,=20no=20auto?= =?UTF-8?q?matica?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 6 +++--- source/core/resources/resource.cpp | 5 +++-- source/utils/defines.hpp | 5 +++++ 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 source/utils/defines.hpp diff --git a/Makefile b/Makefile index 91d295b..a9e33a0 100644 --- a/Makefile +++ b/Makefile @@ -26,12 +26,12 @@ DIR_PACK_TOOL := $(DIR_TOOLS)pack_resources SHADER_SCRIPT := $(DIR_ROOT)tools/shaders/compile_spirv.sh # ============================================================================== -# VERSION (fecha actual) +# VERSION (extraída de defines.hpp) # ============================================================================== ifeq ($(OS),Windows_NT) - VERSION := $(shell powershell -Command "Get-Date -Format 'yyyy-MM-dd'") + VERSION := $(shell powershell -Command "(Select-String -Path 'source/utils/defines.hpp' -Pattern 'constexpr const char\* VERSION = \"(.+?)\"').Matches.Groups[1].Value") else - VERSION := $(shell date +%Y-%m-%d) + VERSION := $(shell grep 'constexpr const char\* VERSION' source/utils/defines.hpp | sed -E 's/.*VERSION = "([^"]+)".*/\1/') endif # ============================================================================== diff --git a/source/core/resources/resource.cpp b/source/core/resources/resource.cpp index 079e73a..fad56c3 100644 --- a/source/core/resources/resource.cpp +++ b/source/core/resources/resource.cpp @@ -20,6 +20,7 @@ #include "core/resources/resource_helper.hpp" // Para loadFile #include "game/options.hpp" // Para Options::loading #include "utils/color.hpp" // Para Color, NO_COLOR_MOD +#include "utils/defines.hpp" // Para Texts::VERSION #include "utils/param.hpp" // Para Param, param, ParamPlayer, ParamResource, ParamGame #include "utils/utils.hpp" // Para getFileName #include "version.h" // Para APP_NAME, GIT_HASH @@ -793,12 +794,12 @@ void Resource::renderProgress() { 1, text_color); - // Muestra la versión + // Muestra la versión y el hash del commit loading_text_->writeDX( Text::CENTER | Text::COLOR, param.game.game_area.center_x, param.game.game_area.center_y + TEXT_HEIGHT, - "(" + std::string(Version::GIT_HASH) + ")", + "ver. " + std::string(Texts::VERSION) + " (" + std::string(Version::GIT_HASH) + ")", 1, text_color); diff --git a/source/utils/defines.hpp b/source/utils/defines.hpp new file mode 100644 index 0000000..b98ad2d --- /dev/null +++ b/source/utils/defines.hpp @@ -0,0 +1,5 @@ +#pragma once + +namespace Texts { + constexpr const char* VERSION = "2026-04-14"; // Versión del juego (también usada por el Makefile) +} // namespace Texts