diff --git a/.clang-format b/.clang-format index 58bffd5..e148dad 100644 --- a/.clang-format +++ b/.clang-format @@ -1,6 +1,7 @@ BasedOnStyle: Google IndentWidth: 4 -IndentAccessModifiers: true +NamespaceIndentation: All +IndentAccessModifiers: false ColumnLimit: 0 # Sin límite de longitud de línea BreakBeforeBraces: Attach # Llaves en la misma línea AllowShortIfStatementsOnASingleLine: true diff --git a/.clang-format-ignore b/.clang-format-ignore deleted file mode 100644 index a3e6670..0000000 --- a/.clang-format-ignore +++ /dev/null @@ -1 +0,0 @@ -source/external/** \ No newline at end of file diff --git a/.clang-format.bak b/.clang-format.bak deleted file mode 100644 index 6c97bba..0000000 --- a/.clang-format.bak +++ /dev/null @@ -1,12 +0,0 @@ -BasedOnStyle: Google -IndentWidth: 4 -IndentAccessModifiers: true -ColumnLimit: 0 # Sin límite de longitud de línea -BreakBeforeBraces: Attach # Llaves en la misma línea -AllowShortIfStatementsOnASingleLine: true -AllowShortBlocksOnASingleLine: true -AllowShortFunctionsOnASingleLine: All -AlignOperands: false -AlignAfterOpenBracket: DontAlign -BinPackArguments: false -BinPackParameters: false diff --git a/.clang-tidy.bak b/.clang-tidy.bak deleted file mode 100644 index 7011b46..0000000 --- a/.clang-tidy.bak +++ /dev/null @@ -1,68 +0,0 @@ -Checks: > - readability-identifier-naming, - readability-*, - modernize-*, - clang-analyzer-*, - -readability-identifier-length, - -readability-magic-numbers - -WarningsAsErrors: '*' - -HeaderFilterRegex: '.*' -FormatStyle: file - -CheckOptions: - # Variables locales en snake_case - - { key: readability-identifier-naming.VariableCase, value: lower_case } - - # Miembros privados en snake_case con sufijo _ - - { key: readability-identifier-naming.PrivateMemberCase, value: lower_case } - - { key: readability-identifier-naming.PrivateMemberSuffix, value: _ } - - # Miembros protegidos en snake_case con sufijo _ - - { key: readability-identifier-naming.ProtectedMemberCase, value: lower_case } - - { key: readability-identifier-naming.ProtectedMemberSuffix, value: _ } - - # Miembros públicos en snake_case (sin sufijo) - - { key: readability-identifier-naming.PublicMemberCase, value: lower_case } - - # Namespaces en CamelCase - - { key: readability-identifier-naming.NamespaceCase, value: CamelCase } - - # Constantes globales en UPPER_CASE - - { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE } - - # Variables constexpr globales en UPPER_CASE - - { key: readability-identifier-naming.ConstexprVariableCase, value: UPPER_CASE } - - # Constantes locales en UPPER_CASE - - { key: readability-identifier-naming.LocalConstantCase, value: UPPER_CASE } - - # Constantes estáticas dentro de clases en UPPER_CASE (sin sufijo) - - { key: readability-identifier-naming.StaticConstantCase, value: UPPER_CASE } - - # Constexpr miembros en UPPER_CASE (sin sufijo) - - { key: readability-identifier-naming.ConstexprMemberCase, value: UPPER_CASE } - - # Constexpr miembros privados/protegidos con sufijo _ - - { key: readability-identifier-naming.ConstexprMethodCase, value: UPPER_CASE } - - # Clases, structs y enums en CamelCase - - { key: readability-identifier-naming.ClassCase, value: CamelCase } - - { key: readability-identifier-naming.StructCase, value: CamelCase } - - { key: readability-identifier-naming.EnumCase, value: CamelCase } - - # Valores de enums en UPPER_CASE - - { key: readability-identifier-naming.EnumConstantCase, value: UPPER_CASE } - - # Métodos en camelBack (sin sufijos) - - { key: readability-identifier-naming.MethodCase, value: camelBack } - - { key: readability-identifier-naming.PrivateMethodCase, value: camelBack } - - { key: readability-identifier-naming.ProtectedMethodCase, value: camelBack } - - { key: readability-identifier-naming.PublicMethodCase, value: camelBack } - - # Funciones en camelBack - - { key: readability-identifier-naming.FunctionCase, value: camelBack } - - # Parámetros en lower_case - - { key: readability-identifier-naming.ParameterCase, value: lower_case } \ No newline at end of file diff --git a/.gitignore b/.gitignore index c954fe1..a21f596 100644 --- a/.gitignore +++ b/.gitignore @@ -18,8 +18,8 @@ coffee_crisis* debug.txt cppcheck-result* desktop.ini -ccae_release/ -Frameworks/ +dist/ +release/windows/coffee.res resources.pack # Herramienta pack_resources (todas las plataformas) diff --git a/Makefile b/Makefile index 759cf38..febe360 100644 --- a/Makefile +++ b/Makefile @@ -9,9 +9,10 @@ DIR_TOOLS := $(addsuffix /, $(DIR_ROOT)tools) TARGET_NAME := coffee_crisis_arcade_edition TARGET_FILE := $(DIR_BIN)$(TARGET_NAME) APP_NAME := Coffee Crisis Arcade Edition -RELEASE_FOLDER := ccae_release +DIST_DIR := dist +RELEASE_FOLDER := dist/_tmp RELEASE_FILE := $(RELEASE_FOLDER)/$(TARGET_NAME) -RESOURCE_FILE := release/coffee.res +RESOURCE_FILE := release/windows/coffee.res # Variables para herramienta de empaquetado ifeq ($(OS),Windows_NT) @@ -41,11 +42,11 @@ else endif # Nombres para los ficheros de lanzamiento -WINDOWS_RELEASE := $(TARGET_NAME)-$(VERSION)-win32-x64.zip -MACOS_INTEL_RELEASE := $(TARGET_FILE)-$(VERSION)-macos-intel.dmg -MACOS_APPLE_SILICON_RELEASE := $(TARGET_FILE)-$(VERSION)-macos-apple-silicon.dmg -LINUX_RELEASE := $(TARGET_FILE)-$(VERSION)-linux.tar.gz -RASPI_RELEASE := $(TARGET_FILE)-$(VERSION)-raspberry.tar.gz +WINDOWS_RELEASE := $(DIST_DIR)/$(TARGET_NAME)-$(VERSION)-win32-x64.zip +MACOS_INTEL_RELEASE := $(DIST_DIR)/$(TARGET_NAME)-$(VERSION)-macos-intel.dmg +MACOS_APPLE_SILICON_RELEASE := $(DIST_DIR)/$(TARGET_NAME)-$(VERSION)-macos-apple-silicon.dmg +LINUX_RELEASE := $(DIST_DIR)/$(TARGET_NAME)-$(VERSION)-linux.tar.gz +RASPI_RELEASE := $(DIST_DIR)/$(TARGET_NAME)-$(VERSION)-raspberry.tar.gz # Lista completa de archivos fuente (basada en CMakeLists.txt) APP_SOURCES := \ @@ -166,7 +167,7 @@ resources.pack: $(PACK_TOOL) windows: @echo off @echo Compilando para Windows con nombre: "$(APP_NAME).exe" - windres release/coffee.rc -O coff -o $(RESOURCE_FILE) + windres release/windows/coffee.rc -O coff -o $(RESOURCE_FILE) $(CXX) $(APP_SOURCES) $(RESOURCE_FILE) $(INCLUDES) $(CXXFLAGS) $(LDFLAGS) -o "$(WIN_TARGET_FILE).exe" strip -s -R .comment -R .gnu.version "$(WIN_TARGET_FILE).exe" --strip-unneeded @@ -186,7 +187,8 @@ windows_release: @echo off @echo Creando release para Windows - Version: $(VERSION) -# Crea carpeta temporal 'RELEASE_FOLDER' +# Crea carpeta de distribución y carpeta temporal 'RELEASE_FOLDER' + powershell if (-not (Test-Path "$(DIST_DIR)")) {New-Item "$(DIST_DIR)" -ItemType Directory} powershell if (Test-Path "$(RELEASE_FOLDER)") {Remove-Item "$(RELEASE_FOLDER)" -Recurse -Force} powershell if (-not (Test-Path "$(RELEASE_FOLDER)")) {New-Item "$(RELEASE_FOLDER)" -ItemType Directory} @@ -197,10 +199,10 @@ windows_release: # Copia los ficheros que estan en la raíz del proyecto powershell Copy-Item "LICENSE" -Destination "$(RELEASE_FOLDER)" powershell Copy-Item "README.md" -Destination "$(RELEASE_FOLDER)" - powershell Copy-Item "release\*.dll" -Destination "$(RELEASE_FOLDER)" + powershell Copy-Item "release\windows\dll\*.dll" -Destination "$(RELEASE_FOLDER)" # Compila - windres release/coffee.rc -O coff -o $(RESOURCE_FILE) + windres release/windows/coffee.rc -O coff -o $(RESOURCE_FILE) $(CXX) $(APP_SOURCES) $(RESOURCE_FILE) $(INCLUDES) -DRELEASE_BUILD $(CXXFLAGS) $(LDFLAGS) -o "$(WIN_RELEASE_FILE).exe" strip -s -R .comment -R .gnu.version "$(WIN_RELEASE_FILE).exe" --strip-unneeded @@ -230,30 +232,29 @@ macos_release: # Elimina datos de compilaciones anteriores $(RMDIR) "$(RELEASE_FOLDER)" - $(RMDIR) Frameworks $(RMFILE) tmp.dmg + $(RMFILE) "$(DIST_DIR)"/rw.* $(RMFILE) "$(MACOS_INTEL_RELEASE)" $(RMFILE) "$(MACOS_APPLE_SILICON_RELEASE)" -# Crea la carpeta temporal para hacer el trabajo y las carpetas obligatorias para crear una app de macos +# Crea la carpeta de distribución y la carpeta temporal con las carpetas obligatorias para una app macOS + $(MKDIR) "$(DIST_DIR)" $(MKDIR) "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Frameworks" $(MKDIR) "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/MacOS" $(MKDIR) "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Resources" - $(MKDIR) Frameworks # Copia carpetas y ficheros cp -R config "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Resources" cp resources.pack "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Resources" - cp -R release/frameworks/SDL3.xcframework "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Frameworks" - cp -R release/frameworks/SDL3.xcframework Frameworks - cp release/*.icns "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Resources" - cp release/Info.plist "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents" + cp -R release/macos/frameworks/SDL3.xcframework/macos-arm64_x86_64/SDL3.framework "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Frameworks" + cp release/icons/*.icns "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Resources" + cp release/macos/Info.plist "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents" cp LICENSE "$(RELEASE_FOLDER)" cp README.md "$(RELEASE_FOLDER)" # Compila la versión para procesadores Intel ifdef ENABLE_MACOS_X86_64 - $(CXX) $(APP_SOURCES) $(INCLUDES) -DMACOS_BUNDLE -DRELEASE_BUILD $(CXXFLAGS) $(LDFLAGS) -o "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/MacOS/$(TARGET_NAME)" -rpath @executable_path/../Frameworks/ -target x86_64-apple-macos10.15 + $(CXX) $(APP_SOURCES) $(INCLUDES) -DMACOS_BUNDLE -DMACOS_BUILD -DRELEASE_BUILD -std=c++20 -Wall -Os -Wno-deprecated -framework SDL3 -F release/macos/frameworks/SDL3.xcframework/macos-arm64_x86_64 -framework OpenGL -ffunction-sections -fdata-sections -o "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/MacOS/$(TARGET_NAME)" -rpath @executable_path/../Frameworks/ -target x86_64-apple-macos10.15 # Firma la aplicación codesign --deep --force --sign - --timestamp=none "$(RELEASE_FOLDER)/$(APP_NAME).app" @@ -277,7 +278,7 @@ ifdef ENABLE_MACOS_X86_64 endif # Compila la versión para procesadores Apple Silicon - $(CXX) $(APP_SOURCES) $(INCLUDES) -DMACOS_BUNDLE -DRELEASE_BUILD -DSDL_DISABLE_IMMINTRIN_H $(CXXFLAGS) $(LDFLAGS) -o "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/MacOS/$(TARGET_NAME)" -rpath @executable_path/../Frameworks/ -target arm64-apple-macos11 + $(CXX) $(APP_SOURCES) $(INCLUDES) -DMACOS_BUNDLE -DMACOS_BUILD -DRELEASE_BUILD -DSDL_DISABLE_IMMINTRIN_H -std=c++20 -Wall -Os -Wno-deprecated -framework SDL3 -F release/macos/frameworks/SDL3.xcframework/macos-arm64_x86_64 -framework OpenGL -ffunction-sections -fdata-sections -o "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/MacOS/$(TARGET_NAME)" -rpath @executable_path/../Frameworks/ -target arm64-apple-macos11 # Firma la aplicación codesign --deep --force --sign - --timestamp=none "$(RELEASE_FOLDER)/$(APP_NAME).app" @@ -300,8 +301,8 @@ endif @echo "Release Apple Silicon creado: $(MACOS_APPLE_SILICON_RELEASE)" # Elimina las carpetas temporales - $(RMDIR) Frameworks $(RMDIR) "$(RELEASE_FOLDER)" + $(RMFILE) "$(DIST_DIR)"/rw.* linux: @echo "Compilando para Linux: $(TARGET_NAME)" @@ -316,10 +317,8 @@ linux_release: @$(MAKE) pack_tool @$(MAKE) resources.pack @echo "Creando release para Linux - Version: $(VERSION)" -# Elimina carpetas previas +# Elimina carpetas previas y recrea (crea dist/ si no existe) $(RMDIR) "$(RELEASE_FOLDER)" - -# Crea la carpeta temporal para realizar el lanzamiento $(MKDIR) "$(RELEASE_FOLDER)" # Copia ficheros @@ -344,7 +343,7 @@ linux_release_desktop: @$(MAKE) pack_tool @$(MAKE) resources.pack @echo "Creando release con integracion desktop para Linux - Version: $(VERSION)" -# Elimina carpetas previas +# Elimina carpetas previas y recrea (crea dist/ si no existe) $(RMDIR) "$(RELEASE_FOLDER)" # Crea la estructura de directorios estándar para Linux @@ -379,25 +378,22 @@ linux_release_desktop: @echo 'Keywords=arcade;action;shooter;retro;' >> "$(RELEASE_FOLDER)/$(TARGET_NAME)/share/applications/$(TARGET_NAME).desktop" # Copia el icono (si existe) y lo redimensiona si es necesario - @if [ -f "release/icon.png" ]; then \ + @if [ -f "release/icons/icon.png" ]; then \ if command -v magick >/dev/null 2>&1; then \ - magick "release/icon.png" -resize 256x256 "$(RELEASE_FOLDER)/$(TARGET_NAME)/share/icons/hicolor/256x256/apps/$(TARGET_NAME).png"; \ - echo "Icono redimensionado de release/icon.png (usando ImageMagick)"; \ + magick "release/icons/icon.png" -resize 256x256 "$(RELEASE_FOLDER)/$(TARGET_NAME)/share/icons/hicolor/256x256/apps/$(TARGET_NAME).png"; \ + echo "Icono redimensionado de release/icons/icon.png (usando ImageMagick)"; \ elif command -v convert >/dev/null 2>&1; then \ - convert "release/icon.png" -resize 256x256 "$(RELEASE_FOLDER)/$(TARGET_NAME)/share/icons/hicolor/256x256/apps/$(TARGET_NAME).png"; \ - echo "Icono redimensionado de release/icon.png (usando ImageMagick legacy)"; \ + convert "release/icons/icon.png" -resize 256x256 "$(RELEASE_FOLDER)/$(TARGET_NAME)/share/icons/hicolor/256x256/apps/$(TARGET_NAME).png"; \ + echo "Icono redimensionado de release/icons/icon.png (usando ImageMagick legacy)"; \ elif command -v ffmpeg >/dev/null 2>&1; then \ - ffmpeg -i "release/icon.png" -vf scale=256:256 "$(RELEASE_FOLDER)/$(TARGET_NAME)/share/icons/hicolor/256x256/apps/$(TARGET_NAME).png" -y -loglevel quiet; \ - echo "Icono redimensionado de release/icon.png (usando ffmpeg)"; \ + ffmpeg -i "release/icons/icon.png" -vf scale=256:256 "$(RELEASE_FOLDER)/$(TARGET_NAME)/share/icons/hicolor/256x256/apps/$(TARGET_NAME).png" -y -loglevel quiet; \ + echo "Icono redimensionado de release/icons/icon.png (usando ffmpeg)"; \ else \ - cp "release/icon.png" "$(RELEASE_FOLDER)/$(TARGET_NAME)/share/icons/hicolor/256x256/apps/$(TARGET_NAME).png"; \ + cp "release/icons/icon.png" "$(RELEASE_FOLDER)/$(TARGET_NAME)/share/icons/hicolor/256x256/apps/$(TARGET_NAME).png"; \ echo "Icono copiado sin redimensionar (instalar ImageMagick o ffmpeg para redimensionado automatico)"; \ fi; \ - elif [ -f "release/coffee.png" ]; then \ - cp "release/coffee.png" "$(RELEASE_FOLDER)/$(TARGET_NAME)/share/icons/hicolor/256x256/apps/$(TARGET_NAME).png"; \ - echo "Icono copiado desde release/coffee.png"; \ else \ - echo "Advertencia: No se encontró release/icon.png ni release/coffee.png - crear icono manualmente"; \ + echo "Advertencia: No se encontró release/icons/icon.png - crear icono manualmente"; \ fi # Crea script de instalación @@ -430,9 +426,9 @@ linux_release_desktop: chmod +x "$(RELEASE_FOLDER)/$(TARGET_NAME)/uninstall.sh" # Empaqueta ficheros - $(RMFILE) "$(TARGET_NAME)-$(VERSION)-linux-desktop.tar.gz" - tar -czvf "$(TARGET_NAME)-$(VERSION)-linux-desktop.tar.gz" -C "$(RELEASE_FOLDER)" . - @echo "Release con integracion desktop creado: $(TARGET_NAME)-$(VERSION)-linux-desktop.tar.gz" + $(RMFILE) "$(DIST_DIR)/$(TARGET_NAME)-$(VERSION)-linux-desktop.tar.gz" + tar -czvf "$(DIST_DIR)/$(TARGET_NAME)-$(VERSION)-linux-desktop.tar.gz" -C "$(RELEASE_FOLDER)" . + @echo "Release con integracion desktop creado: $(DIST_DIR)/$(TARGET_NAME)-$(VERSION)-linux-desktop.tar.gz" @echo "Para instalar: extraer y ejecutar ./$(TARGET_NAME)/install.sh" # Elimina la carpeta temporal @@ -451,10 +447,8 @@ raspi_release: @$(MAKE) pack_tool @$(MAKE) resources.pack @echo "Creando release para Raspberry Pi - Version: $(VERSION)" -# Elimina carpetas previas +# Elimina carpetas previas y recrea (crea dist/ si no existe) $(RMDIR) "$(RELEASE_FOLDER)" - -# Crea la carpeta temporal para realizar el lanzamiento $(MKDIR) "$(RELEASE_FOLDER)" # Copia ficheros diff --git a/release/windows/dll/libwinpthread-1.dll b/release/windows/dll/libwinpthread-1.dll new file mode 100644 index 0000000..500de9d Binary files /dev/null and b/release/windows/dll/libwinpthread-1.dll differ