Compare commits

12 Commits

18 changed files with 301 additions and 223 deletions

7
.gitignore vendored
View File

@@ -18,6 +18,9 @@ debug.txt
cppcheck-result* cppcheck-result*
desktop.ini desktop.ini
ccae_release/ ccae_release/
Frameworks/
resources.pack resources.pack
tools/pack_resources.cpp
pack_resources.cpp # Herramienta pack_resources (todas las plataformas)
tools/pack_resources
tools/pack_resources.exe

View File

@@ -150,7 +150,7 @@ else
endif endif
# Reglas para herramienta de empaquetado y resources.pack # Reglas para herramienta de empaquetado y resources.pack
$(PACK_TOOL): $(PACK_SOURCES) $(PACK_TOOL): FORCE
@echo "Compilando herramienta de empaquetado..." @echo "Compilando herramienta de empaquetado..."
$(PACK_CXX) -std=c++20 -Wall -Os $(PACK_INCLUDES) $(PACK_SOURCES) -o $(PACK_TOOL) $(PACK_CXX) -std=c++20 -Wall -Os $(PACK_INCLUDES) $(PACK_SOURCES) -o $(PACK_TOOL)
@echo "✓ Herramienta de empaquetado lista: $(PACK_TOOL)" @echo "✓ Herramienta de empaquetado lista: $(PACK_TOOL)"
@@ -180,7 +180,9 @@ windows_debug:
@echo Compilando version debug para Windows: "$(APP_NAME)_debug.exe" @echo Compilando version debug para Windows: "$(APP_NAME)_debug.exe"
$(CXX) $(APP_SOURCES) $(INCLUDES) -DDEBUG -DVERBOSE $(CXXFLAGS_DEBUG) $(LDFLAGS) -o "$(WIN_TARGET_FILE)_debug.exe" $(CXX) $(APP_SOURCES) $(INCLUDES) -DDEBUG -DVERBOSE $(CXXFLAGS_DEBUG) $(LDFLAGS) -o "$(WIN_TARGET_FILE)_debug.exe"
windows_release: resources.pack windows_release:
@$(MAKE) pack_tool
@$(MAKE) resources.pack
@echo off @echo off
@echo Creando release para Windows - Version: $(VERSION) @echo Creando release para Windows - Version: $(VERSION)
@@ -199,7 +201,7 @@ windows_release: resources.pack
# Compila # Compila
windres release/coffee.rc -O coff -o $(RESOURCE_FILE) windres release/coffee.rc -O coff -o $(RESOURCE_FILE)
$(CXX) $(APP_SOURCES) $(RESOURCE_FILE) $(INCLUDES) $(CXXFLAGS) $(LDFLAGS) -o "$(WIN_RELEASE_FILE).exe" $(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 strip -s -R .comment -R .gnu.version "$(WIN_RELEASE_FILE).exe" --strip-unneeded
# Crea el fichero .zip # Crea el fichero .zip
@@ -218,8 +220,14 @@ macos_debug:
@echo "Compilando version debug para macOS: $(TARGET_NAME)_debug" @echo "Compilando version debug para macOS: $(TARGET_NAME)_debug"
$(CXX) $(APP_SOURCES) $(INCLUDES) -DDEBUG -DVERBOSE $(CXXFLAGS_DEBUG) $(LDFLAGS) -o "$(TARGET_FILE)_debug" $(CXX) $(APP_SOURCES) $(INCLUDES) -DDEBUG -DVERBOSE $(CXXFLAGS_DEBUG) $(LDFLAGS) -o "$(TARGET_FILE)_debug"
macos_release: resources.pack macos_release:
@$(MAKE) pack_tool
@$(MAKE) resources.pack
@echo "Creando release para macOS - Version: $(VERSION)" @echo "Creando release para macOS - Version: $(VERSION)"
# Verificar e instalar create-dmg si es necesario
@which create-dmg > /dev/null || (echo "Instalando create-dmg..." && brew install create-dmg)
# Elimina datos de compilaciones anteriores # Elimina datos de compilaciones anteriores
$(RMDIR) "$(RELEASE_FOLDER)" $(RMDIR) "$(RELEASE_FOLDER)"
$(RMDIR) Frameworks $(RMDIR) Frameworks
@@ -243,33 +251,52 @@ macos_release: resources.pack
cp LICENSE "$(RELEASE_FOLDER)" cp LICENSE "$(RELEASE_FOLDER)"
cp README.md "$(RELEASE_FOLDER)" cp README.md "$(RELEASE_FOLDER)"
# Crea enlaces
ln -s /Applications "$(RELEASE_FOLDER)"/Applications
# Compila la versión para procesadores Intel # Compila la versión para procesadores Intel
ifdef ENABLE_MACOS_X86_64 ifdef ENABLE_MACOS_X86_64
$(CXX) $(APP_SOURCES) $(INCLUDES) -DMACOS_BUNDLE $(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 -DRELEASE_BUILD $(CXXFLAGS) $(LDFLAGS) -o "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/MacOS/$(TARGET_NAME)" -rpath @executable_path/../Frameworks/ -target x86_64-apple-macos10.15
# Firma la aplicación # Firma la aplicación
codesign --deep --force --sign - --timestamp=none "$(RELEASE_FOLDER)/$(APP_NAME).app" codesign --deep --force --sign - --timestamp=none "$(RELEASE_FOLDER)/$(APP_NAME).app"
# Empaqueta el .dmg de la versión Intel # Empaqueta el .dmg de la versión Intel con create-dmg
hdiutil create tmp.dmg -ov -volname "$(APP_NAME)" -fs HFS+ -srcfolder "$(RELEASE_FOLDER)" @echo "Creando DMG Intel con iconos de 96x96..."
hdiutil convert tmp.dmg -format UDZO -o "$(MACOS_INTEL_RELEASE)" create-dmg \
$(RMFILE) tmp.dmg --volname "$(APP_NAME)" \
--window-pos 200 120 \
--window-size 720 300 \
--icon-size 96 \
--text-size 12 \
--icon "$(APP_NAME).app" 278 102 \
--icon "LICENSE" 441 102 \
--icon "README.md" 604 102 \
--app-drop-link 115 102 \
--hide-extension "$(APP_NAME).app" \
"$(MACOS_INTEL_RELEASE)" \
"$(RELEASE_FOLDER)" || true
@echo "Release Intel creado: $(MACOS_INTEL_RELEASE)" @echo "Release Intel creado: $(MACOS_INTEL_RELEASE)"
endif endif
# Compila la versión para procesadores Apple Silicon # Compila la versión para procesadores Apple Silicon
$(CXX) $(APP_SOURCES) $(INCLUDES) -DMACOS_BUNDLE -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 -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
# Firma la aplicación # Firma la aplicación
codesign --deep --force --sign - --timestamp=none "$(RELEASE_FOLDER)/$(APP_NAME).app" codesign --deep --force --sign - --timestamp=none "$(RELEASE_FOLDER)/$(APP_NAME).app"
# Empaqueta el .dmg de la versión Apple Silicon # Empaqueta el .dmg de la versión Apple Silicon con create-dmg
hdiutil create tmp.dmg -ov -volname "$(APP_NAME)" -fs HFS+ -srcfolder "$(RELEASE_FOLDER)" @echo "Creando DMG Apple Silicon con iconos de 96x96..."
hdiutil convert tmp.dmg -format UDZO -o "$(MACOS_APPLE_SILICON_RELEASE)" create-dmg \
$(RMFILE) tmp.dmg --volname "$(APP_NAME)" \
--window-pos 200 120 \
--window-size 720 300 \
--icon-size 96 \
--text-size 12 \
--icon "$(APP_NAME).app" 278 102 \
--icon "LICENSE" 441 102 \
--icon "README.md" 604 102 \
--app-drop-link 115 102 \
--hide-extension "$(APP_NAME).app" \
"$(MACOS_APPLE_SILICON_RELEASE)" \
"$(RELEASE_FOLDER)" || true
@echo "Release Apple Silicon creado: $(MACOS_APPLE_SILICON_RELEASE)" @echo "Release Apple Silicon creado: $(MACOS_APPLE_SILICON_RELEASE)"
# Elimina las carpetas temporales # Elimina las carpetas temporales
@@ -285,7 +312,9 @@ linux_debug:
@echo "Compilando version debug para Linux: $(TARGET_NAME)_debug" @echo "Compilando version debug para Linux: $(TARGET_NAME)_debug"
$(CXX) $(APP_SOURCES) $(INCLUDES) -DDEBUG -DVERBOSE $(CXXFLAGS_DEBUG) $(LDFLAGS) -o "$(TARGET_FILE)_debug" $(CXX) $(APP_SOURCES) $(INCLUDES) -DDEBUG -DVERBOSE $(CXXFLAGS_DEBUG) $(LDFLAGS) -o "$(TARGET_FILE)_debug"
linux_release: resources.pack linux_release:
@$(MAKE) pack_tool
@$(MAKE) resources.pack
@echo "Creando release para Linux - Version: $(VERSION)" @echo "Creando release para Linux - Version: $(VERSION)"
# Elimina carpetas previas # Elimina carpetas previas
$(RMDIR) "$(RELEASE_FOLDER)" $(RMDIR) "$(RELEASE_FOLDER)"
@@ -300,7 +329,7 @@ linux_release: resources.pack
cp README.md "$(RELEASE_FOLDER)" cp README.md "$(RELEASE_FOLDER)"
# Compila # Compila
$(CXX) $(APP_SOURCES) $(INCLUDES) $(CXXFLAGS) $(LDFLAGS) -o "$(RELEASE_FILE)" $(CXX) $(APP_SOURCES) $(INCLUDES) -DRELEASE_BUILD $(CXXFLAGS) $(LDFLAGS) -o "$(RELEASE_FILE)"
strip -s -R .comment -R .gnu.version "$(RELEASE_FILE)" --strip-unneeded strip -s -R .comment -R .gnu.version "$(RELEASE_FILE)" --strip-unneeded
# Empaqueta ficheros # Empaqueta ficheros
@@ -311,7 +340,9 @@ linux_release: resources.pack
# Elimina la carpeta temporal # Elimina la carpeta temporal
$(RMDIR) "$(RELEASE_FOLDER)" $(RMDIR) "$(RELEASE_FOLDER)"
linux_release_desktop: resources.pack linux_release_desktop:
@$(MAKE) pack_tool
@$(MAKE) resources.pack
@echo "Creando release con integracion desktop para Linux - Version: $(VERSION)" @echo "Creando release con integracion desktop para Linux - Version: $(VERSION)"
# Elimina carpetas previas # Elimina carpetas previas
$(RMDIR) "$(RELEASE_FOLDER)" $(RMDIR) "$(RELEASE_FOLDER)"
@@ -330,7 +361,7 @@ linux_release_desktop: resources.pack
cp README.md "$(RELEASE_FOLDER)/$(TARGET_NAME)/" cp README.md "$(RELEASE_FOLDER)/$(TARGET_NAME)/"
# Compila el ejecutable # Compila el ejecutable
$(CXX) $(APP_SOURCES) $(INCLUDES) $(CXXFLAGS) $(LDFLAGS) -o "$(RELEASE_FOLDER)/$(TARGET_NAME)/bin/$(TARGET_NAME)" $(CXX) $(APP_SOURCES) $(INCLUDES) -DRELEASE_BUILD $(CXXFLAGS) $(LDFLAGS) -o "$(RELEASE_FOLDER)/$(TARGET_NAME)/bin/$(TARGET_NAME)"
strip -s -R .comment -R .gnu.version "$(RELEASE_FOLDER)/$(TARGET_NAME)/bin/$(TARGET_NAME)" --strip-unneeded strip -s -R .comment -R .gnu.version "$(RELEASE_FOLDER)/$(TARGET_NAME)/bin/$(TARGET_NAME)" --strip-unneeded
# Crea el archivo .desktop # Crea el archivo .desktop
@@ -416,7 +447,9 @@ raspi_debug:
@echo "Compilando version debug para Raspberry Pi: $(TARGET_NAME)_debug" @echo "Compilando version debug para Raspberry Pi: $(TARGET_NAME)_debug"
$(CXX) $(APP_SOURCES) $(INCLUDES) -DVERBOSE -DDEBUG $(CXXFLAGS_DEBUG) $(LDFLAGS) -o "$(TARGET_FILE)_debug" $(CXX) $(APP_SOURCES) $(INCLUDES) -DVERBOSE -DDEBUG $(CXXFLAGS_DEBUG) $(LDFLAGS) -o "$(TARGET_FILE)_debug"
raspi_release: resources.pack raspi_release:
@$(MAKE) pack_tool
@$(MAKE) resources.pack
@echo "Creando release para Raspberry Pi - Version: $(VERSION)" @echo "Creando release para Raspberry Pi - Version: $(VERSION)"
# Elimina carpetas previas # Elimina carpetas previas
$(RMDIR) "$(RELEASE_FOLDER)" $(RMDIR) "$(RELEASE_FOLDER)"
@@ -431,7 +464,7 @@ raspi_release: resources.pack
cp README.md "$(RELEASE_FOLDER)" cp README.md "$(RELEASE_FOLDER)"
# Compila # Compila
$(CXX) $(APP_SOURCES) $(INCLUDES) -DVERBOSE $(CXXFLAGS) $(LDFLAGS) -o "$(RELEASE_FILE)" $(CXX) $(APP_SOURCES) $(INCLUDES) -DRELEASE_BUILD -DVERBOSE $(CXXFLAGS) $(LDFLAGS) -o "$(RELEASE_FILE)"
strip -s -R .comment -R .gnu.version "$(RELEASE_FILE)" --strip-unneeded strip -s -R .comment -R .gnu.version "$(RELEASE_FILE)" --strip-unneeded
# Empaqueta ficheros # Empaqueta ficheros
@@ -442,7 +475,9 @@ raspi_release: resources.pack
# Elimina la carpeta temporal # Elimina la carpeta temporal
$(RMDIR) "$(RELEASE_FOLDER)" $(RMDIR) "$(RELEASE_FOLDER)"
anbernic: resources.pack anbernic:
@$(MAKE) pack_tool
@$(MAKE) resources.pack
@echo "Compilando para Anbernic: $(TARGET_NAME)" @echo "Compilando para Anbernic: $(TARGET_NAME)"
# Elimina carpetas previas # Elimina carpetas previas
$(RMDIR) "$(RELEASE_FOLDER)"_anbernic $(RMDIR) "$(RELEASE_FOLDER)"_anbernic
@@ -455,7 +490,7 @@ anbernic: resources.pack
cp resources.pack "$(RELEASE_FOLDER)"_anbernic cp resources.pack "$(RELEASE_FOLDER)"_anbernic
# Compila # Compila
$(CXX) $(APP_SOURCES) $(INCLUDES) -DANBERNIC -DNO_SHADERS -DARCADE -DVERBOSE $(CXXFLAGS) $(LDFLAGS) -o $(RELEASE_FOLDER)_anbernic/$(TARGET_NAME) $(CXX) $(APP_SOURCES) $(INCLUDES) -DRELEASE_BUILD -DANBERNIC -DNO_SHADERS -DARCADE -DVERBOSE $(CXXFLAGS) $(LDFLAGS) -o $(RELEASE_FOLDER)_anbernic/$(TARGET_NAME)
# Opción para deshabilitar audio (equivalente a la opción DISABLE_AUDIO de CMake) # Opción para deshabilitar audio (equivalente a la opción DISABLE_AUDIO de CMake)
no_audio: no_audio:
@@ -489,4 +524,6 @@ help:
@echo " show_version - Mostrar version actual ($(VERSION))" @echo " show_version - Mostrar version actual ($(VERSION))"
@echo " help - Mostrar esta ayuda" @echo " help - Mostrar esta ayuda"
.PHONY: windows windows_rec windows_debug windows_release macos macos_debug macos_release linux linux_debug linux_release linux_release_desktop raspi raspi_debug raspi_release anbernic no_audio show_version help pack_tool .PHONY: windows windows_rec windows_debug windows_release macos macos_debug macos_release linux linux_debug linux_release linux_release_desktop raspi raspi_debug raspi_release anbernic no_audio show_version help pack_tool resources.pack
FORCE:

View File

@@ -1,6 +1,8 @@
# Coffee Crisis Arcade Edition <div align="center">
<img src="https://php.sustancia.synology.me/images/ccae/coffee_crisis_arcade_edition_cover_web.png" width="600" alt="Coffee Crisis Cover">
</div>
<img src="https://php.sustancia.synology.me/images/ccae/coffee_crisis_arcade_edition_cover_web.png" width="300" align="left" style="margin-right: 20px; margin-bottom: 10px;" alt="Coffee Crisis Cover"> # Coffee Crisis Arcade Edition
## ¡La batalla definitiva pel cafè està ací! ## ¡La batalla definitiva pel cafè està ací!
@@ -35,10 +37,7 @@ El joc està optimitzat per a ser jugat amb un mando de jocs, encara que un dels
> Nota: El joc suporta nomes un jugador amb teclat. > Nota: El joc suporta nomes un jugador amb teclat.
<p align="center"> ![Coffee Crisis Arcade Edition - Gameplay](https://php.sustancia.synology.me/images/ccae/ccae1.png)
<img src="https://php.sustancia.synology.me/images/ccae/ccae1.png" alt="Joc" width="45%" />
<img src="https://php.sustancia.synology.me/images/ccae/ccae3.png" alt="Joc" width="45%" />
</p>
## Altres tecles ## Altres tecles
@@ -64,6 +63,8 @@ El joc està optimitzat per a ser jugat amb un mando de jocs, encara que un dels
2. Descomprimix i executa l'arxiu `coffee_crisis_arcade_edition.exe`. 2. Descomprimix i executa l'arxiu `coffee_crisis_arcade_edition.exe`.
3. Gaudeix del joc! 3. Gaudeix del joc!
![Coffee Crisis Arcade Edition - Gameplay](https://php.sustancia.synology.me/images/ccae/ccae3.png)
## Agraïments ## Agraïments
Vull expressar la meua gratitud a **ChatGPT** i **GitHub Copilot**. Gràcies per ser un suport constant en el desenvolupament d'aquest joc! Vull expressar la meua gratitud a **ChatGPT** i **GitHub Copilot**. Gràcies per ser un suport constant en el desenvolupament d'aquest joc!

View File

@@ -18,191 +18,191 @@ DATA|${PREFIX}/config/pools.txt
DATA|${PREFIX}/config/stages.txt DATA|${PREFIX}/config/stages.txt
# Archivos con los datos de la demo # Archivos con los datos de la demo
DEMODATA|${PREFIX}/data/demo/demo1.bin DEMODATA|/data/demo/demo1.bin
DEMODATA|${PREFIX}/data/demo/demo2.bin DEMODATA|/data/demo/demo2.bin
DEMODATA|${PREFIX}/data/demo/demo3.bin DEMODATA|/data/demo/demo3.bin
# Música # Música
MUSIC|${PREFIX}/data/music/congratulations.ogg MUSIC|/data/music/congratulations.ogg
MUSIC|${PREFIX}/data/music/credits.ogg MUSIC|/data/music/credits.ogg
MUSIC|${PREFIX}/data/music/intro.ogg MUSIC|/data/music/intro.ogg
MUSIC|${PREFIX}/data/music/playing.ogg MUSIC|/data/music/playing.ogg
MUSIC|${PREFIX}/data/music/title.ogg MUSIC|/data/music/title.ogg
# Sonidos # Sonidos
SOUND|${PREFIX}/data/sound/balloon_bounce0.wav SOUND|/data/sound/balloon_bounce0.wav
SOUND|${PREFIX}/data/sound/balloon_bounce1.wav SOUND|/data/sound/balloon_bounce1.wav
SOUND|${PREFIX}/data/sound/balloon_bounce2.wav SOUND|/data/sound/balloon_bounce2.wav
SOUND|${PREFIX}/data/sound/balloon_bounce3.wav SOUND|/data/sound/balloon_bounce3.wav
SOUND|${PREFIX}/data/sound/balloon_pop0.wav SOUND|/data/sound/balloon_pop0.wav
SOUND|${PREFIX}/data/sound/balloon_pop1.wav SOUND|/data/sound/balloon_pop1.wav
SOUND|${PREFIX}/data/sound/balloon_pop2.wav SOUND|/data/sound/balloon_pop2.wav
SOUND|${PREFIX}/data/sound/balloon_pop3.wav SOUND|/data/sound/balloon_pop3.wav
SOUND|${PREFIX}/data/sound/bullet1p.wav SOUND|/data/sound/bullet1p.wav
SOUND|${PREFIX}/data/sound/bullet2p.wav SOUND|/data/sound/bullet2p.wav
SOUND|${PREFIX}/data/sound/clock.wav SOUND|/data/sound/clock.wav
SOUND|${PREFIX}/data/sound/coffee_out.wav SOUND|/data/sound/coffee_out.wav
SOUND|${PREFIX}/data/sound/continue_clock.wav SOUND|/data/sound/continue_clock.wav
SOUND|${PREFIX}/data/sound/credit.wav SOUND|/data/sound/credit.wav
SOUND|${PREFIX}/data/sound/debian_drop.wav SOUND|/data/sound/debian_drop.wav
SOUND|${PREFIX}/data/sound/debian_pickup.wav SOUND|/data/sound/debian_pickup.wav
SOUND|${PREFIX}/data/sound/hi_score_achieved.wav SOUND|/data/sound/hi_score_achieved.wav
SOUND|${PREFIX}/data/sound/item_drop.wav SOUND|/data/sound/item_drop.wav
SOUND|${PREFIX}/data/sound/item_pickup.wav SOUND|/data/sound/item_pickup.wav
SOUND|${PREFIX}/data/sound/jump.wav SOUND|/data/sound/jump.wav
SOUND|${PREFIX}/data/sound/logo.wav SOUND|/data/sound/logo.wav
SOUND|${PREFIX}/data/sound/name_input_accept.wav SOUND|/data/sound/name_input_accept.wav
SOUND|${PREFIX}/data/sound/notify.wav SOUND|/data/sound/notify.wav
SOUND|${PREFIX}/data/sound/player_collision.wav SOUND|/data/sound/player_collision.wav
SOUND|${PREFIX}/data/sound/power_ball_explosion.wav SOUND|/data/sound/power_ball_explosion.wav
SOUND|${PREFIX}/data/sound/service_menu_adjust.wav SOUND|/data/sound/service_menu_adjust.wav
SOUND|${PREFIX}/data/sound/service_menu_back.wav SOUND|/data/sound/service_menu_back.wav
SOUND|${PREFIX}/data/sound/service_menu_move.wav SOUND|/data/sound/service_menu_move.wav
SOUND|${PREFIX}/data/sound/service_menu_select.wav SOUND|/data/sound/service_menu_select.wav
SOUND|${PREFIX}/data/sound/stage_change.wav SOUND|/data/sound/stage_change.wav
SOUND|${PREFIX}/data/sound/tabe_hit.wav SOUND|/data/sound/tabe_hit.wav
SOUND|${PREFIX}/data/sound/tabe.wav SOUND|/data/sound/tabe.wav
SOUND|${PREFIX}/data/sound/title.wav SOUND|/data/sound/title.wav
SOUND|${PREFIX}/data/sound/voice_aw_aw_aw.wav SOUND|/data/sound/voice_aw_aw_aw.wav
SOUND|${PREFIX}/data/sound/voice_coffee.wav SOUND|/data/sound/voice_coffee.wav
SOUND|${PREFIX}/data/sound/voice_credit_thankyou.wav SOUND|/data/sound/voice_credit_thankyou.wav
SOUND|${PREFIX}/data/sound/voice_game_over.wav SOUND|/data/sound/voice_game_over.wav
SOUND|${PREFIX}/data/sound/voice_get_ready.wav SOUND|/data/sound/voice_get_ready.wav
SOUND|${PREFIX}/data/sound/voice_no.wav SOUND|/data/sound/voice_no.wav
SOUND|${PREFIX}/data/sound/voice_power_up.wav SOUND|/data/sound/voice_power_up.wav
SOUND|${PREFIX}/data/sound/voice_recover.wav SOUND|/data/sound/voice_recover.wav
SOUND|${PREFIX}/data/sound/voice_thankyou.wav SOUND|/data/sound/voice_thankyou.wav
SOUND|${PREFIX}/data/sound/walk.wav SOUND|/data/sound/walk.wav
# Shaders OpenGL Desktop 3.3 (Windows/Linux) # Shaders OpenGL Desktop 3.3 (Windows/Linux)
DATA|${PREFIX}/data/shaders/crtpi_vertex.glsl DATA|/data/shaders/crtpi_vertex.glsl
DATA|${PREFIX}/data/shaders/crtpi_fragment.glsl DATA|/data/shaders/crtpi_fragment.glsl
# Shaders OpenGL ES 3.0 (Raspberry Pi) - opcionales # Shaders OpenGL ES 3.0 (Raspberry Pi) - opcionales
DATA|${PREFIX}/data/shaders/crtpi_vertex_es.glsl|optional DATA|/data/shaders/crtpi_vertex_es.glsl|optional
DATA|${PREFIX}/data/shaders/crtpi_fragment_es.glsl|optional DATA|/data/shaders/crtpi_fragment_es.glsl|optional
# Texturas - Balloons # Texturas - Balloons
ANIMATION|${PREFIX}/data/gfx/balloon/balloon0.ani ANIMATION|/data/gfx/balloon/balloon0.ani
ANIMATION|${PREFIX}/data/gfx/balloon/balloon1.ani ANIMATION|/data/gfx/balloon/balloon1.ani
ANIMATION|${PREFIX}/data/gfx/balloon/balloon2.ani ANIMATION|/data/gfx/balloon/balloon2.ani
ANIMATION|${PREFIX}/data/gfx/balloon/balloon3.ani ANIMATION|/data/gfx/balloon/balloon3.ani
BITMAP|${PREFIX}/data/gfx/balloon/balloon0.png BITMAP|/data/gfx/balloon/balloon0.png
BITMAP|${PREFIX}/data/gfx/balloon/balloon1.png BITMAP|/data/gfx/balloon/balloon1.png
BITMAP|${PREFIX}/data/gfx/balloon/balloon2.png BITMAP|/data/gfx/balloon/balloon2.png
BITMAP|${PREFIX}/data/gfx/balloon/balloon3.png BITMAP|/data/gfx/balloon/balloon3.png
# Texturas - Explosiones # Texturas - Explosiones
ANIMATION|${PREFIX}/data/gfx/balloon/explosion0.ani ANIMATION|/data/gfx/balloon/explosion0.ani
ANIMATION|${PREFIX}/data/gfx/balloon/explosion1.ani ANIMATION|/data/gfx/balloon/explosion1.ani
ANIMATION|${PREFIX}/data/gfx/balloon/explosion2.ani ANIMATION|/data/gfx/balloon/explosion2.ani
ANIMATION|${PREFIX}/data/gfx/balloon/explosion3.ani ANIMATION|/data/gfx/balloon/explosion3.ani
BITMAP|${PREFIX}/data/gfx/balloon/explosion0.png BITMAP|/data/gfx/balloon/explosion0.png
BITMAP|${PREFIX}/data/gfx/balloon/explosion1.png BITMAP|/data/gfx/balloon/explosion1.png
BITMAP|${PREFIX}/data/gfx/balloon/explosion2.png BITMAP|/data/gfx/balloon/explosion2.png
BITMAP|${PREFIX}/data/gfx/balloon/explosion3.png BITMAP|/data/gfx/balloon/explosion3.png
# Texturas - Power Ball # Texturas - Power Ball
ANIMATION|${PREFIX}/data/gfx/balloon/powerball.ani ANIMATION|/data/gfx/balloon/powerball.ani
BITMAP|${PREFIX}/data/gfx/balloon/powerball.png BITMAP|/data/gfx/balloon/powerball.png
# Texturas - Bala # Texturas - Bala
ANIMATION|${PREFIX}/data/gfx/bullet/bullet.ani ANIMATION|/data/gfx/bullet/bullet.ani
BITMAP|${PREFIX}/data/gfx/bullet/bullet.png BITMAP|/data/gfx/bullet/bullet.png
# Texturas - Tabe # Texturas - Tabe
ANIMATION|${PREFIX}/data/gfx/tabe/tabe.ani ANIMATION|/data/gfx/tabe/tabe.ani
BITMAP|${PREFIX}/data/gfx/tabe/tabe.png BITMAP|/data/gfx/tabe/tabe.png
# Texturas - Juego # Texturas - Juego
BITMAP|${PREFIX}/data/gfx/game/game_buildings.png BITMAP|/data/gfx/game/game_buildings.png
BITMAP|${PREFIX}/data/gfx/game/game_clouds1.png BITMAP|/data/gfx/game/game_clouds1.png
BITMAP|${PREFIX}/data/gfx/game/game_clouds2.png BITMAP|/data/gfx/game/game_clouds2.png
ANIMATION|${PREFIX}/data/gfx/game/game_grass.ani ANIMATION|/data/gfx/game/game_grass.ani
BITMAP|${PREFIX}/data/gfx/game/game_grass.png BITMAP|/data/gfx/game/game_grass.png
BITMAP|${PREFIX}/data/gfx/game/game_moon.png BITMAP|/data/gfx/game/game_moon.png
BITMAP|${PREFIX}/data/gfx/game/game_power_meter.png BITMAP|/data/gfx/game/game_power_meter.png
BITMAP|${PREFIX}/data/gfx/game/game_sky_colors.png BITMAP|/data/gfx/game/game_sky_colors.png
BITMAP|${PREFIX}/data/gfx/game/game_sun.png BITMAP|/data/gfx/game/game_sun.png
# Texturas - Intro # Texturas - Intro
BITMAP|${PREFIX}/data/gfx/intro/intro1.png BITMAP|/data/gfx/intro/intro1.png
BITMAP|${PREFIX}/data/gfx/intro/intro2.png BITMAP|/data/gfx/intro/intro2.png
BITMAP|${PREFIX}/data/gfx/intro/intro3.png BITMAP|/data/gfx/intro/intro3.png
BITMAP|${PREFIX}/data/gfx/intro/intro4.png BITMAP|/data/gfx/intro/intro4.png
BITMAP|${PREFIX}/data/gfx/intro/intro5.png BITMAP|/data/gfx/intro/intro5.png
BITMAP|${PREFIX}/data/gfx/intro/intro6.png BITMAP|/data/gfx/intro/intro6.png
# Texturas - Logo # Texturas - Logo
BITMAP|${PREFIX}/data/gfx/logo/logo_jailgames_mini.png BITMAP|/data/gfx/logo/logo_jailgames_mini.png
BITMAP|${PREFIX}/data/gfx/logo/logo_jailgames.png BITMAP|/data/gfx/logo/logo_jailgames.png
BITMAP|${PREFIX}/data/gfx/logo/logo_since_1998.png BITMAP|/data/gfx/logo/logo_since_1998.png
# Texturas - Items # Texturas - Items
ANIMATION|${PREFIX}/data/gfx/item/item_clock.ani ANIMATION|/data/gfx/item/item_clock.ani
ANIMATION|${PREFIX}/data/gfx/item/item_coffee_machine.ani ANIMATION|/data/gfx/item/item_coffee_machine.ani
ANIMATION|${PREFIX}/data/gfx/item/item_coffee.ani ANIMATION|/data/gfx/item/item_coffee.ani
ANIMATION|${PREFIX}/data/gfx/item/item_debian.ani ANIMATION|/data/gfx/item/item_debian.ani
ANIMATION|${PREFIX}/data/gfx/item/item_points1_disk.ani ANIMATION|/data/gfx/item/item_points1_disk.ani
ANIMATION|${PREFIX}/data/gfx/item/item_points2_gavina.ani ANIMATION|/data/gfx/item/item_points2_gavina.ani
ANIMATION|${PREFIX}/data/gfx/item/item_points3_pacmar.ani ANIMATION|/data/gfx/item/item_points3_pacmar.ani
BITMAP|${PREFIX}/data/gfx/item/item_clock.png BITMAP|/data/gfx/item/item_clock.png
BITMAP|${PREFIX}/data/gfx/item/item_coffee_machine.png BITMAP|/data/gfx/item/item_coffee_machine.png
BITMAP|${PREFIX}/data/gfx/item/item_coffee.png BITMAP|/data/gfx/item/item_coffee.png
BITMAP|${PREFIX}/data/gfx/item/item_debian.png BITMAP|/data/gfx/item/item_debian.png
BITMAP|${PREFIX}/data/gfx/item/item_points1_disk.png BITMAP|/data/gfx/item/item_points1_disk.png
BITMAP|${PREFIX}/data/gfx/item/item_points2_gavina.png BITMAP|/data/gfx/item/item_points2_gavina.png
BITMAP|${PREFIX}/data/gfx/item/item_points3_pacmar.png BITMAP|/data/gfx/item/item_points3_pacmar.png
# Texturas - Titulo # Texturas - Titulo
ANIMATION|${PREFIX}/data/gfx/title/title_dust.ani ANIMATION|/data/gfx/title/title_dust.ani
BITMAP|${PREFIX}/data/gfx/title/title_arcade_edition.png BITMAP|/data/gfx/title/title_arcade_edition.png
BITMAP|${PREFIX}/data/gfx/title/title_bg_tile.png BITMAP|/data/gfx/title/title_bg_tile.png
BITMAP|${PREFIX}/data/gfx/title/title_coffee.png BITMAP|/data/gfx/title/title_coffee.png
BITMAP|${PREFIX}/data/gfx/title/title_crisis.png BITMAP|/data/gfx/title/title_crisis.png
BITMAP|${PREFIX}/data/gfx/title/title_dust.png BITMAP|/data/gfx/title/title_dust.png
# Texturas - Jugador 1 # Texturas - Jugador 1
BITMAP|${PREFIX}/data/gfx/player/player1_power.png BITMAP|/data/gfx/player/player1_power.png
BITMAP|${PREFIX}/data/gfx/player/player1.gif BITMAP|/data/gfx/player/player1.gif
PALETTE|${PREFIX}/data/gfx/player/player1_coffee1.pal PALETTE|/data/gfx/player/player1_coffee1.pal
PALETTE|${PREFIX}/data/gfx/player/player1_coffee2.pal PALETTE|/data/gfx/player/player1_coffee2.pal
PALETTE|${PREFIX}/data/gfx/player/player1_invencible.pal PALETTE|/data/gfx/player/player1_invencible.pal
# Texturas - Jugador 2 # Texturas - Jugador 2
BITMAP|${PREFIX}/data/gfx/player/player2_power.png BITMAP|/data/gfx/player/player2_power.png
BITMAP|${PREFIX}/data/gfx/player/player2.gif BITMAP|/data/gfx/player/player2.gif
PALETTE|${PREFIX}/data/gfx/player/player2_coffee1.pal PALETTE|/data/gfx/player/player2_coffee1.pal
PALETTE|${PREFIX}/data/gfx/player/player2_coffee2.pal PALETTE|/data/gfx/player/player2_coffee2.pal
PALETTE|${PREFIX}/data/gfx/player/player2_invencible.pal PALETTE|/data/gfx/player/player2_invencible.pal
# Animaciones del jugador # Animaciones del jugador
ANIMATION|${PREFIX}/data/gfx/player/player_power.ani ANIMATION|/data/gfx/player/player_power.ani
ANIMATION|${PREFIX}/data/gfx/player/player1.ani ANIMATION|/data/gfx/player/player1.ani
ANIMATION|${PREFIX}/data/gfx/player/player2.ani ANIMATION|/data/gfx/player/player2.ani
# Fuentes de texto # Fuentes de texto
BITMAP|${PREFIX}/data/font/04b_25_2x.png BITMAP|/data/font/04b_25_2x.png
BITMAP|${PREFIX}/data/font/04b_25_2x_white.png BITMAP|/data/font/04b_25_2x_white.png
BITMAP|${PREFIX}/data/font/04b_25_flat_2x.png BITMAP|/data/font/04b_25_flat_2x.png
BITMAP|${PREFIX}/data/font/04b_25_flat.png BITMAP|/data/font/04b_25_flat.png
BITMAP|${PREFIX}/data/font/04b_25_grey.png BITMAP|/data/font/04b_25_grey.png
BITMAP|${PREFIX}/data/font/04b_25_metal.png BITMAP|/data/font/04b_25_metal.png
BITMAP|${PREFIX}/data/font/04b_25_reversed_2x.png BITMAP|/data/font/04b_25_reversed_2x.png
BITMAP|${PREFIX}/data/font/04b_25_reversed.png BITMAP|/data/font/04b_25_reversed.png
BITMAP|${PREFIX}/data/font/04b_25_white.png BITMAP|/data/font/04b_25_white.png
BITMAP|${PREFIX}/data/font/04b_25.png BITMAP|/data/font/04b_25.png
BITMAP|${PREFIX}/data/font/8bithud.png BITMAP|/data/font/8bithud.png
BITMAP|${PREFIX}/data/font/aseprite.png BITMAP|/data/font/aseprite.png
BITMAP|${PREFIX}/data/font/smb2_grad.png BITMAP|/data/font/smb2_grad.png
BITMAP|${PREFIX}/data/font/smb2.png BITMAP|/data/font/smb2.png
FONT|${PREFIX}/data/font/04b_25_2x.txt FONT|/data/font/04b_25_2x.txt
FONT|${PREFIX}/data/font/04b_25.txt FONT|/data/font/04b_25.txt
FONT|${PREFIX}/data/font/8bithud.txt FONT|/data/font/8bithud.txt
FONT|${PREFIX}/data/font/aseprite.txt FONT|/data/font/aseprite.txt
FONT|${PREFIX}/data/font/smb2.txt FONT|/data/font/smb2.txt
# Idiomas # Idiomas
LANG|${PREFIX}/data/lang/ba_BA.json LANG|/data/lang/ba_BA.json
LANG|${PREFIX}/data/lang/en_UK.json LANG|/data/lang/en_UK.json
LANG|${PREFIX}/data/lang/es_ES.json LANG|/data/lang/es_ES.json

View File

@@ -1,7 +1,18 @@
#!/bin/bash #!/bin/bash
# Script para ejecutar clang-tidy en múltiples directorios # Script para ejecutar clang-tidy en múltiples directorios
# Uso: ./run_clang-tidy.sh # Uso: ./run_clang-tidy.sh [--fix]
# --fix: Aplica las correcciones automáticamente (opcional)
# Detectar si se pasó el parámetro --fix
FIX_FLAG=""
if [[ "$1" == "--fix" ]]; then
FIX_FLAG="--fix"
echo "Modo: Aplicando correcciones automáticamente (--fix)"
else
echo "Modo: Solo análisis (sin --fix)"
fi
echo
# Lista de rutas donde ejecutar clang-tidy # Lista de rutas donde ejecutar clang-tidy
PATHS=( PATHS=(
@@ -31,8 +42,8 @@ process_directory() {
cd "$dir" || return 1 cd "$dir" || return 1
# Buscar archivos .cpp, .h, .hpp solo en el nivel actual (no subdirectorios) # Buscar archivos .cpp, .h, .hpp solo en el nivel actual (no subdirectorios)
find . -maxdepth 1 \( -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \) | \ find . -maxdepth 1 \( -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \) -print0 | \
xargs -P4 -I{} bash -c 'echo "Procesando: {}"; clang-tidy {} -p '"$BUILD_DIR"' --fix' xargs -0 -P4 -I{} bash -c 'echo "Procesando: {}"; clang-tidy {} -p '"$BUILD_DIR"' '"$FIX_FLAG"
echo "=== Completado: $dir ===" echo "=== Completado: $dir ==="
echo echo

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 438 KiB

After

Width:  |  Height:  |  Size: 504 KiB

View File

@@ -197,8 +197,12 @@ auto Asset::check() const -> bool {
// Comprueba que existe un fichero // Comprueba que existe un fichero
auto Asset::checkFile(const std::string& path) const -> bool { auto Asset::checkFile(const std::string& path) const -> bool {
// Construir ruta del pack usando executable_path_ // Construir ruta del pack usando executable_path_ (misma lógica que Director::init)
#ifdef MACOS_BUNDLE
std::string pack_path = executable_path_ + "../Resources/resources.pack";
#else
std::string pack_path = executable_path_ + "resources.pack"; std::string pack_path = executable_path_ + "resources.pack";
#endif
bool pack_exists = std::filesystem::exists(pack_path); bool pack_exists = std::filesystem::exists(pack_path);
if (pack_exists) { if (pack_exists) {

View File

@@ -81,11 +81,22 @@ void Director::init() {
// Configuración inicial de parametros // Configuración inicial de parametros
Asset::init(executable_path_); // Inicializa el sistema de gestión de archivos Asset::init(executable_path_); // Inicializa el sistema de gestión de archivos
// Determinar ruta del pack según la plataforma
#ifdef MACOS_BUNDLE #ifdef MACOS_BUNDLE
ResourceHelper::initializeResourceSystem(executable_path_ + "../Resources/resources.pack"); std::string pack_path = executable_path_ + "../Resources/resources.pack";
#else #else
ResourceHelper::initializeResourceSystem(executable_path_ + "resources.pack"); std::string pack_path = executable_path_ + "resources.pack";
#endif #endif
// Inicializar sistema de recursos con o sin fallback según el tipo de build
#ifdef RELEASE_BUILD
// Release: Sin fallback - Solo resources.pack (estricto)
ResourceHelper::initializeResourceSystem(pack_path, false);
#else
// Desarrollo: Con fallback - Puede usar data/ si falta el pack (flexible)
ResourceHelper::initializeResourceSystem(pack_path, true);
#endif
loadAssets(); // Crea el índice de archivos loadAssets(); // Crea el índice de archivos
Logger::section("INIT INPUT"); Logger::section("INIT INPUT");

View File

@@ -2,6 +2,7 @@
#include <SDL3/SDL.h> #include <SDL3/SDL.h>
#include <array>
#include <cstring> #include <cstring>
#include <stdexcept> #include <stdexcept>
#include <vector> #include <vector>
@@ -76,8 +77,8 @@ auto OpenGLShader::compileShader(const std::string& source, GLenum shader_type)
return 0; return 0;
} }
const char* sources[1] = {source.c_str()}; std::array<const char*, 1> sources = {source.c_str()};
glShaderSource(shader_id, 1, sources, nullptr); glShaderSource(shader_id, 1, sources.data(), nullptr);
checkGLError("glShaderSource"); checkGLError("glShaderSource");
glCompileShader(shader_id); glCompileShader(shader_id);
@@ -149,7 +150,7 @@ auto OpenGLShader::linkProgram(GLuint vertex_shader, GLuint fragment_shader) ->
void OpenGLShader::createQuadGeometry() { void OpenGLShader::createQuadGeometry() {
// Datos del quad: posición (x, y) + coordenadas de textura (u, v) // Datos del quad: posición (x, y) + coordenadas de textura (u, v)
// Formato: x, y, u, v // Formato: x, y, u, v
float vertices[] = { std::array<float, 16> vertices = {
// Posición // TexCoords // Posición // TexCoords
-1.0F, -1.0F,
-1.0F, -1.0F,
@@ -170,7 +171,7 @@ void OpenGLShader::createQuadGeometry() {
}; };
// Índices para dibujar el quad con dos triángulos // Índices para dibujar el quad con dos triángulos
unsigned int indices[] = { std::array<unsigned int, 6> indices = {
0, 0,
1, 1,
2, // Primer triángulo 2, // Primer triángulo
@@ -187,22 +188,22 @@ void OpenGLShader::createQuadGeometry() {
// Generar y configurar VBO // Generar y configurar VBO
glGenBuffers(1, &vbo_); glGenBuffers(1, &vbo_);
glBindBuffer(GL_ARRAY_BUFFER, vbo_); glBindBuffer(GL_ARRAY_BUFFER, vbo_);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices.data(), GL_STATIC_DRAW);
checkGLError("glBufferData(VBO)"); checkGLError("glBufferData(VBO)");
// Generar y configurar EBO // Generar y configurar EBO
glGenBuffers(1, &ebo_); glGenBuffers(1, &ebo_);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo_); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo_);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices.data(), GL_STATIC_DRAW);
checkGLError("glBufferData(EBO)"); checkGLError("glBufferData(EBO)");
// Atributo 0: Posición (2 floats) // Atributo 0: Posición (2 floats)
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)0); glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), nullptr);
glEnableVertexAttribArray(0); glEnableVertexAttribArray(0);
checkGLError("glVertexAttribPointer(position)"); checkGLError("glVertexAttribPointer(position)");
// Atributo 1: Coordenadas de textura (2 floats) // Atributo 1: Coordenadas de textura (2 floats)
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)(2 * sizeof(float))); glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), static_cast<const void*>(static_cast<const char*>(nullptr) + 2 * sizeof(float)));
glEnableVertexAttribArray(1); glEnableVertexAttribArray(1);
checkGLError("glVertexAttribPointer(texcoord)"); checkGLError("glVertexAttribPointer(texcoord)");
@@ -212,7 +213,9 @@ void OpenGLShader::createQuadGeometry() {
} }
auto OpenGLShader::getTextureID(SDL_Texture* texture) -> GLuint { auto OpenGLShader::getTextureID(SDL_Texture* texture) -> GLuint {
if (!texture) return 1; if (texture == nullptr) {
return 1;
}
SDL_PropertiesID props = SDL_GetTextureProperties(texture); SDL_PropertiesID props = SDL_GetTextureProperties(texture);
GLuint texture_id = 0; GLuint texture_id = 0;
@@ -245,7 +248,7 @@ auto OpenGLShader::init(SDL_Window* window,
back_buffer_ = texture; back_buffer_ = texture;
renderer_ = SDL_GetRenderer(window); renderer_ = SDL_GetRenderer(window);
if (!renderer_) { if (renderer_ == nullptr) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
"Error: No se pudo obtener el renderer"); "Error: No se pudo obtener el renderer");
return false; return false;
@@ -276,10 +279,10 @@ auto OpenGLShader::init(SDL_Window* window,
// Verificar que es OpenGL // Verificar que es OpenGL
const char* renderer_name = SDL_GetRendererName(renderer_); const char* renderer_name = SDL_GetRendererName(renderer_);
if (!renderer_name || strncmp(renderer_name, "opengl", 6) != 0) { if ((renderer_name == nullptr) || strncmp(renderer_name, "opengl", 6) != 0) {
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
"Renderer no es OpenGL: %s", "Renderer no es OpenGL: %s",
renderer_name ? renderer_name : "unknown"); (renderer_name != nullptr) ? renderer_name : "unknown");
return false; return false;
} }
@@ -305,8 +308,12 @@ auto OpenGLShader::init(SDL_Window* window,
if (vertex_shader == 0 || fragment_shader == 0) { if (vertex_shader == 0 || fragment_shader == 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
"Error al compilar shaders"); "Error al compilar shaders");
if (vertex_shader != 0) glDeleteShader(vertex_shader); if (vertex_shader != 0) {
if (fragment_shader != 0) glDeleteShader(fragment_shader); glDeleteShader(vertex_shader);
}
if (fragment_shader != 0) {
glDeleteShader(fragment_shader);
}
return false; return false;
} }
@@ -370,15 +377,16 @@ void OpenGLShader::render() {
} }
// Obtener tamaño actual de ventana (puede haber cambiado) // Obtener tamaño actual de ventana (puede haber cambiado)
int current_width, current_height; int current_width;
int current_height;
SDL_GetWindowSize(window_, &current_width, &current_height); SDL_GetWindowSize(window_, &current_width, &current_height);
// Guardar estados OpenGL // Guardar estados OpenGL
GLint old_program; GLint old_program;
glGetIntegerv(GL_CURRENT_PROGRAM, &old_program); glGetIntegerv(GL_CURRENT_PROGRAM, &old_program);
GLint old_viewport[4]; std::array<GLint, 4> old_viewport{};
glGetIntegerv(GL_VIEWPORT, old_viewport); glGetIntegerv(GL_VIEWPORT, old_viewport.data());
GLboolean was_texture_enabled = glIsEnabled(GL_TEXTURE_2D); GLboolean was_texture_enabled = glIsEnabled(GL_TEXTURE_2D);
GLint old_texture; GLint old_texture;
@@ -403,7 +411,8 @@ void OpenGLShader::render() {
checkGLError("glUseProgram"); checkGLError("glUseProgram");
// Configurar viewport (obtener tamaño lógico de SDL) // Configurar viewport (obtener tamaño lógico de SDL)
int logical_w, logical_h; int logical_w;
int logical_h;
SDL_RendererLogicalPresentation mode; SDL_RendererLogicalPresentation mode;
SDL_GetRenderLogicalPresentation(renderer_, &logical_w, &logical_h, &mode); SDL_GetRenderLogicalPresentation(renderer_, &logical_w, &logical_h, &mode);
@@ -413,14 +422,16 @@ void OpenGLShader::render() {
} }
// Calcular viewport considerando aspect ratio // Calcular viewport considerando aspect ratio
int viewport_x = 0, viewport_y = 0; int viewport_x = 0;
int viewport_w = current_width, viewport_h = current_height; int viewport_y = 0;
int viewport_w = current_width;
int viewport_h = current_height;
if (mode == SDL_LOGICAL_PRESENTATION_INTEGER_SCALE) { if (mode == SDL_LOGICAL_PRESENTATION_INTEGER_SCALE) {
int scale_x = current_width / logical_w; int scale_x = current_width / logical_w;
int scale_y = current_height / logical_h; int scale_y = current_height / logical_h;
int scale = (scale_x < scale_y) ? scale_x : scale_y; int scale = (scale_x < scale_y) ? scale_x : scale_y;
if (scale < 1) scale = 1; scale = std::max(scale, 1);
viewport_w = logical_w * scale; viewport_w = logical_w * scale;
viewport_h = logical_h * scale; viewport_h = logical_h * scale;
@@ -444,7 +455,7 @@ void OpenGLShader::render() {
// Dibujar quad usando VAO // Dibujar quad usando VAO
glBindVertexArray(vao_); glBindVertexArray(vao_);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0); glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, nullptr);
checkGLError("glDrawElements"); checkGLError("glDrawElements");
// Presentar // Presentar
@@ -453,7 +464,7 @@ void OpenGLShader::render() {
// Restaurar estados OpenGL // Restaurar estados OpenGL
glUseProgram(old_program); glUseProgram(old_program);
glBindTexture(GL_TEXTURE_2D, old_texture); glBindTexture(GL_TEXTURE_2D, old_texture);
if (!was_texture_enabled) { if (was_texture_enabled == 0U) {
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
} }
glBindVertexArray(old_vao); glBindVertexArray(old_vao);

View File

@@ -30,7 +30,7 @@ class OpenGLShader : public ShaderBackend {
void render() override; void render() override;
void setTextureSize(float width, float height) override; void setTextureSize(float width, float height) override;
void cleanup() override final; void cleanup() final;
[[nodiscard]] auto isHardwareAccelerated() const -> bool override { return is_initialized_; } [[nodiscard]] auto isHardwareAccelerated() const -> bool override { return is_initialized_; }
private: private:
@@ -39,8 +39,8 @@ class OpenGLShader : public ShaderBackend {
auto compileShader(const std::string& source, GLenum shader_type) -> GLuint; auto compileShader(const std::string& source, GLenum shader_type) -> GLuint;
auto linkProgram(GLuint vertex_shader, GLuint fragment_shader) -> GLuint; auto linkProgram(GLuint vertex_shader, GLuint fragment_shader) -> GLuint;
void createQuadGeometry(); void createQuadGeometry();
auto getTextureID(SDL_Texture* texture) -> GLuint; static auto getTextureID(SDL_Texture* texture) -> GLuint;
void checkGLError(const char* operation); static void checkGLError(const char* operation);
// Estado SDL // Estado SDL
SDL_Window* window_ = nullptr; SDL_Window* window_ = nullptr;

View File

@@ -10,9 +10,9 @@
namespace ResourceHelper { namespace ResourceHelper {
static bool resource_system_initialized = false; static bool resource_system_initialized = false;
auto initializeResourceSystem(const std::string& pack_file) -> bool { auto initializeResourceSystem(const std::string& pack_file, bool enable_fallback) -> bool {
auto& loader = ResourceLoader::getInstance(); auto& loader = ResourceLoader::getInstance();
resource_system_initialized = loader.initialize(pack_file, true); resource_system_initialized = loader.initialize(pack_file, enable_fallback);
if (resource_system_initialized) { if (resource_system_initialized) {
std::cout << "Resource system initialized with pack: " << pack_file << '\n'; std::cout << "Resource system initialized with pack: " << pack_file << '\n';

View File

@@ -9,7 +9,7 @@
// Helper functions para integrar ResourceLoader con el sistema existente // Helper functions para integrar ResourceLoader con el sistema existente
namespace ResourceHelper { namespace ResourceHelper {
// Inicializa ResourceLoader (llamar al inicio del programa) // Inicializa ResourceLoader (llamar al inicio del programa)
auto initializeResourceSystem(const std::string& pack_file = "resources.pack") -> bool; auto initializeResourceSystem(const std::string& pack_file = "resources.pack", bool enable_fallback = true) -> bool;
// Cierra ResourceLoader // Cierra ResourceLoader
void shutdownResourceSystem(); void shutdownResourceSystem();

View File

@@ -337,11 +337,11 @@ class Game {
// --- Gestion y dibujado de jugadores en z-order --- // --- Gestion y dibujado de jugadores en z-order ---
static void buildPlayerDrawList(const Players& elements, Players& draw_list); // Construye el draw_list a partir del vector principal static void buildPlayerDrawList(const Players& elements, Players& draw_list); // Construye el draw_list a partir del vector principal
void updatePlayerDrawList(const Players& elements, Players& draw_list); // Actualiza draw_list tras cambios en los z_order static void updatePlayerDrawList(const Players& elements, Players& draw_list); // Actualiza draw_list tras cambios en los z_order
static void renderPlayerDrawList(const Players& draw_list); // Dibuja en el orden definido static void renderPlayerDrawList(const Players& draw_list); // Dibuja en el orden definido
static auto findPlayerIndex(const Players& elems, const std::shared_ptr<Player>& who) -> size_t; static auto findPlayerIndex(const Players& elems, const std::shared_ptr<Player>& who) -> size_t;
void sendPlayerToBack(Players& elements, const std::shared_ptr<Player>& who, Players& draw_list); // Envia al jugador al fondo de la pantalla static void sendPlayerToBack(Players& elements, const std::shared_ptr<Player>& who, Players& draw_list); // Envia al jugador al fondo de la pantalla
void bringPlayerToFront(Players& elements, const std::shared_ptr<Player>& who, Players& draw_list); // Envia al jugador al frente de la pantalla static void bringPlayerToFront(Players& elements, const std::shared_ptr<Player>& who, Players& draw_list); // Envia al jugador al frente de la pantalla
// --- Varios --- // --- Varios ---
void onPauseStateChanged(bool is_paused); void onPauseStateChanged(bool is_paused);

Binary file not shown.

View File

@@ -1,4 +1,4 @@
#include "../source/resource_pack.h" #include "../source/resource_pack.hpp"
#include "../build/version.h" // Para Version::APP_NAME #include "../build/version.h" // Para Version::APP_NAME
#include <iostream> #include <iostream>
#include <filesystem> #include <filesystem>