nou: afegida versió de git en la pantalla de carrega

This commit is contained in:
2025-09-27 00:20:46 +02:00
parent b9e26aa755
commit d056a5e336
5 changed files with 38 additions and 6 deletions

View File

@@ -14,6 +14,22 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
cmake_policy(SET CMP0072 NEW)
set(OpenGL_GL_PREFERENCE GLVND)
# --- GENERACIÓN DE VERSIÓN AUTOMÁTICA ---
find_package(Git QUIET)
if(GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short=7 HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
else()
set(GIT_HASH "unknown")
endif()
# Configurar archivo de versión
configure_file(${CMAKE_SOURCE_DIR}/source/version.h.in ${CMAKE_BINARY_DIR}/version.h @ONLY)
# --- 1. LISTA EXPLÍCITA DE FUENTES ---
set(APP_SOURCES

View File

@@ -6,6 +6,7 @@
#include "color.h"
#include "ui/notifier.h" // Para Notifier::Position
#include "version.h" // Para Version::APP_NAME
// --- Namespace GameDefaults: configuración centralizada con valores por defecto del juego ---
namespace GameDefaults {
@@ -211,7 +212,7 @@ constexpr const char* PLAYER1 = "422028FF";
// --- OPTIONS ---
namespace Options {
// Window
constexpr const char* WINDOW_CAPTION = "Coffee Crisis Arcade Edition";
constexpr const char* WINDOW_CAPTION = Version::APP_NAME;
constexpr int WINDOW_ZOOM = 2;
constexpr int WINDOW_MAX_ZOOM = 2;

View File

@@ -12,6 +12,7 @@
#include "asset.h" // Para Asset
#include "color.h" // Para Color
#include "version.h" // Para Version::APP_NAME y Version::GIT_HASH
#ifndef NO_AUDIO
#include "external/jail_audio.h" // Para JA_LoadMusic, JA_LoadSound, JA_DeleteMusic, JA_DeleteSound
#endif
@@ -809,20 +810,27 @@ void Resource::renderProgress() {
Lang::getText("[RESOURCE] LOADING") + " : " + loading_resource_name_,
param.resource.color);
// Muestra información del monitor alineada con la barra de carga
// Muestra nombre de la aplicación y versión
loading_text_->writeColored(
X_PADDING,
Y_PADDING,
std::string(Version::APP_NAME) + " (" + Version::GIT_HASH + ")",
param.resource.color);
// Muestra información del monitor desplazada hacia abajo
loading_text_->writeColored(
X_PADDING,
Y_PADDING + 18,
screen->getDisplayMonitorName(),
param.resource.color);
loading_text_->writeColored(
X_PADDING,
Y_PADDING + 9,
Y_PADDING + 27,
std::to_string(screen->getDisplayMonitorWidth()) + "x" + std::to_string(screen->getDisplayMonitorHeight()),
param.resource.color);
loading_text_->writeColored(
X_PADDING,
Y_PADDING + 18,
Y_PADDING + 36,
std::to_string(screen->getDisplayMonitorRefreshRate()) + "Hz",
param.resource.color);

6
source/version.h.in Normal file
View File

@@ -0,0 +1,6 @@
#pragma once
namespace Version {
constexpr const char* GIT_HASH = "@GIT_HASH@";
constexpr const char* APP_NAME = "Coffee Crisis Arcade Edition";
}

View File

@@ -1,9 +1,10 @@
#include "../source/resource_pack.h"
#include "../build/version.h" // Para Version::APP_NAME
#include <iostream>
#include <filesystem>
void showHelp() {
std::cout << "Coffee Crisis Arcade Edition - Resource Packer" << std::endl;
std::cout << Version::APP_NAME << " - Resource Packer" << std::endl;
std::cout << "===============================================" << std::endl;
std::cout << "Usage: pack_resources [options] [input_dir] [output_file]" << std::endl;
std::cout << std::endl;
@@ -71,7 +72,7 @@ int main(int argc, char* argv[]) {
return 0;
}
std::cout << "Coffee Crisis Arcade Edition - Resource Packer" << std::endl;
std::cout << Version::APP_NAME << " - Resource Packer" << std::endl;
std::cout << "===============================================" << std::endl;
std::cout << "Input directory: " << dataDir << std::endl;
std::cout << "Output file: " << outputFile << std::endl;