Compare commits
6 Commits
6f31751d42
...
2026-04-03
| Author | SHA1 | Date | |
|---|---|---|---|
| 8538a1047f | |||
| e150097edc | |||
| 5f0d1f9577 | |||
| 6d8d02f0e4 | |||
| 5f7fb8625d | |||
| ce2fcefd71 |
200
CHANGELOG.md
Normal file
200
CHANGELOG.md
Normal file
@@ -0,0 +1,200 @@
|
|||||||
|
# CHANGELOG
|
||||||
|
|
||||||
|
Historial de canvis i novetats de Coffee Crisis Arcade Edition.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2026-04-03
|
||||||
|
|
||||||
|
- **Nova intro cinematogràfica**: les tarjetes s'llancen des dels costats de la pantalla amb zoom, rotació i rebot, simulant tirar cartes sobre una mesa. Les anteriors ixen despedides girant quan arriba la següent. Sombra amb efecte de perspectiva 2D→3D.
|
||||||
|
- **Efectes sonors i visuals en la intro**: shake de pantalla i sons configurables a cada impacte de tarjeta.
|
||||||
|
- **Migració a SDL3 GPU API**: postfx i crtpi migrats a SDL3GPU (Vulkan/Metal/D3D12).
|
||||||
|
- **Migració de configuració a YAML**: eliminat el format antic, ara tot en YAML.
|
||||||
|
- **Afegides opcions al Service Menu**.
|
||||||
|
- **HUD de FPS retocat**, presets per defecte ajustats, finestra a 2x i shader off per defecte.
|
||||||
|
- **Corregit bug d'input**: revertit un canvi que causava bucle infinit en F3 (pantalla completa) i F12 (service menu) en totes les escenes excepte Game.
|
||||||
|
- Neteja de codi: eliminades referencies a OpenGL, fitxers GLSL sobrants, normalitzada la carpeta release i el caption de la finestra.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2025-10-25
|
||||||
|
|
||||||
|
- **Migració a delta_time pur** en credits, instructions i hiscore_table. Eliminat un bug que feia que els credits no acabaren mai si no passaves a mà.
|
||||||
|
- **Corregida deformació subpixel** de textures en instructions i hiscore_table.
|
||||||
|
- **Detecció de fitxers de puntuació corruptes**.
|
||||||
|
- **Efecte de pulsos** afegit al scoreboard.
|
||||||
|
- Al posar nom, el carrusel apareix directament en el caràcter d'acabar si ja havies posat nom abans.
|
||||||
|
- Integrat jail_audio en la càrrega de resources.pack.
|
||||||
|
- Pasaeta de linter en múltiples fitxers.
|
||||||
|
- Nou icon per al joc.
|
||||||
|
- Corregida la versió release de macOS per a funcionar correctament amb resources.pack.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2025-08-21
|
||||||
|
|
||||||
|
- **Integració amb resources.pack**: textures, animacions, textos, dades de la demo i jail_audio integrats amb ResourceHelper.
|
||||||
|
- Actualitzat Makefile per a Windows, Linux i macOS.
|
||||||
|
- Neteja de temporals al acabar.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2025-08-17
|
||||||
|
|
||||||
|
- **Afegit fade RANDOM_SQUARE2** amb timings canviats a mil·lisegons.
|
||||||
|
- **Outline parametritzat** per als textos dels items.
|
||||||
|
- **Colors de camiseta parametritzats** per defecte i quan pillen café.
|
||||||
|
- Creat `defaults.h` amb els valors per defecte de Param.
|
||||||
|
- Afegit `param_red.txt` amb guardes en setParams.
|
||||||
|
- Fix: items que es quedaven engantxats a la part de dalt.
|
||||||
|
- Fix: en el modo demo, assignava cafés al jugador que no jugava.
|
||||||
|
- Fix: bug en l'estat pre del fade.
|
||||||
|
- Fix: globos apareixien un frame mal situats al crear-se des d'un pare.
|
||||||
|
- Afegit suport per a mapejar botons tipus trigger.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2025-08-10
|
||||||
|
|
||||||
|
- **Service Menu complet**: animació d'apertura/tancament, callback per a posar pausa en el joc, refresc visual al canviar mandos.
|
||||||
|
- **Mandos en calent**: es poden connectar i desconnectar mandos durant el joc, amb notificació visual.
|
||||||
|
- **PauseManager** afegit al joc.
|
||||||
|
- **Càrrega de recursos on_demand**.
|
||||||
|
- Afegit `shutdown.h` i `system_utils.h`.
|
||||||
|
- Fix: el nom apareixia duplicat en la tabla de records.
|
||||||
|
- Fix: Game no es desregistrava de ServiceMenu al destruir-se.
|
||||||
|
- Precàrrega de textures del jugador amb variants de paleta.
|
||||||
|
- Actualitzats frameworks per a macOS.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2025-03-25
|
||||||
|
|
||||||
|
- **Nova secció Intro** amb escenes seqüencials, animacions de tarjetes i text narratiu.
|
||||||
|
- **Shaders respecten l'escalat sencer** i SDL_RenderSetLogicalSize en pantalla completa.
|
||||||
|
- **Tecla per canviar l'integer scale** (F-key).
|
||||||
|
- Afegit intro03.png i intro04.png.
|
||||||
|
- Renomenat InputType a InputActions.
|
||||||
|
- Actualitzat gamecontrollerdb.txt amb mappings de la recreativa.
|
||||||
|
- Fix: al fer reset des de Game, en Intro no sonava la música.
|
||||||
|
- Fix: al acabar la partida i vore els records, torna al títol.
|
||||||
|
- Fix: amb l'àudio mutat, el fade per al soroll de boles el tornava a deixar activat.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2025-02-07
|
||||||
|
|
||||||
|
- **EnterName millorat**: si has omplit tots els slots, apretar una volta mes fixa el nom.
|
||||||
|
- **Control de repetició per als eixos del joystick**.
|
||||||
|
- **La tabla de puntuació** mostra amb altre color la puntuació acabada d'afegir i les aconseguides amb 1CC.
|
||||||
|
- Nova font per a la intro.
|
||||||
|
- Afegit efecte d'eixida a les instruccions.
|
||||||
|
- Afegit disparador per a l'aparició de l'enemic nou.
|
||||||
|
- Duplicada la font 04b_25 per a versió gris i versió negra.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2025-01-05
|
||||||
|
|
||||||
|
- **Optimitzat el circuit de render** en pantalla.
|
||||||
|
- **Atenuat de pantalla restaurat**: Fade feia dos SDL_SetRenderDrawBlendMode sense restaurar.
|
||||||
|
- Fix: es podia polsar per a jugar mentre feia el fade cap a la demo.
|
||||||
|
- Fix: error en la seqüència final de retrocedir en el temps.
|
||||||
|
- Calibrats els polsos al gust.
|
||||||
|
- Afegida una lluna i un sol al fondo.
|
||||||
|
- La powerball ja no es pot destruir fins que no ha fet un rebot.
|
||||||
|
- Modificada la cadència de foc sense autofire.
|
||||||
|
- Afegit botó per a activar o desactivar el ratolí.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2024-12-31
|
||||||
|
|
||||||
|
- **Enemic nou** complet: gràfics, comportament, àudio i veus.
|
||||||
|
- **Fade out sincronitzat** de vídeo i àudio en el títol i el joc.
|
||||||
|
- **Roidets de col·lisió** per als globos en certs moments.
|
||||||
|
- La finestra ja es pot fer tan gran com permeta la pantalla (zoom dinàmic).
|
||||||
|
- Afegides veus al jugador i efectes de so al rebotar quan mor.
|
||||||
|
- Afegit delay opcional al flash de Screen.
|
||||||
|
- Afegit botó per activar o desactivar l'autofire.
|
||||||
|
- Fix: mode demo desactivava els sons permanentment.
|
||||||
|
- Actualitzat jail_audio.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2024-12-05
|
||||||
|
|
||||||
|
- **Secció Credits acabada** a 320x240 (i per extensió, a qualsevol resolució).
|
||||||
|
- **Zoom afegit a la classe Sprite** i al subtítol ARCADE EDITION.
|
||||||
|
- Duplicats fitxers de shaders per a resolucions verticals de 256 i 240.
|
||||||
|
- Afegit globalInputs::update() a totes les seccions.
|
||||||
|
- Fix: faltava corregir el flash de destroyAllBalloons().
|
||||||
|
- Fix: si saltes el logo, talla el so a meitat sonar.
|
||||||
|
- Canvi d'idioma amb una tecla (i reinicia).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2024-11-27
|
||||||
|
|
||||||
|
- **Secció Credits**: disseny, música, globos amb play_area definida, opció de canviar la paleta al text.
|
||||||
|
- Afegides traduccions dels credits.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2024-11-20
|
||||||
|
|
||||||
|
- **Nova animació de mort del personatge**: rebots, llengua fora, ulls en X, gràfics de caure derrotat per al segon jugador.
|
||||||
|
- **Powerball redissenyada**: nous gràfics, nou comportament, ja no mata directament.
|
||||||
|
- **Globos fills** ja no ixen centrats al pare (evita apilar-se).
|
||||||
|
- Arreglos en el nom al obtindre la màxima puntuació.
|
||||||
|
- Acabat BalloonManager.
|
||||||
|
- CMakeLists.txt crea l'executable en l'arrel del projecte.
|
||||||
|
- Nova font de text gran amb el doble de definició.
|
||||||
|
- Fix: paleta verda del primer jugador ajustada a l'original.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2024-11-03
|
||||||
|
|
||||||
|
- **Teclat com a control independent**: ja pot jugar un jugador amb teclat i altre amb mando, o assignar el teclat a qualsevol jugador.
|
||||||
|
- **Implementat el final del joc** i l'Attract Mode.
|
||||||
|
- **Nou motor per a textos en pantalla** (game_text amb textures precarregades).
|
||||||
|
- **Noves animacions** per a deixar de disparar.
|
||||||
|
- Al redefinir botons, ja no pots repetir botó.
|
||||||
|
- Fix: l'animació de morir s'actualitzava dos voltes per frame.
|
||||||
|
- Fix: l'efecte de flash tenia un valor massa xicotet.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2024-10-28
|
||||||
|
|
||||||
|
- **Classe PathSprite completada**: el game_text gasta PathSprites en lloc de SmartSprites.
|
||||||
|
- **Time stopper redissenyat**.
|
||||||
|
- La partida sempre comença igual (createTwoBigBalloons).
|
||||||
|
- Revisades les classes Balloon i Bullet.
|
||||||
|
- Millorada l'aparició dels game_text.
|
||||||
|
- Fix: la paleta dels jugadors no s'iniciava correctament.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2024-10-20
|
||||||
|
|
||||||
|
- **Classe Resource creada**: precàrrega de tots els recursos (textures, música, sons, animacions).
|
||||||
|
- **Paletes de color** per a textures GIF amb shared_ptr.
|
||||||
|
- Precàrrega i assignació de paletes.
|
||||||
|
- Implementat comptador per a posar el nom al acabar la partida.
|
||||||
|
- Classe Notifier independitzada de Screen amb codis identificadors.
|
||||||
|
- Afegit codi per a apagar el sistema al eixir del joc.
|
||||||
|
- Fix: globos verds tenien setters mal assignats i velocitat incorrecta.
|
||||||
|
- Fix: no guardar el fitxer de puntuacions en el mode demo.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2024-10-14
|
||||||
|
|
||||||
|
- **Versió inicial**: clon del repositori de Coffee Crisis, adaptat per a Arcade Edition.
|
||||||
|
- Pasaeta de include-what-you-use i cppcheck.
|
||||||
|
- Estandarització de noms segons convencions (CamelCase, camelBack, snake_case).
|
||||||
|
- Herències de les classes Sprite corregides.
|
||||||
|
- Canvi a C++ modern amb smart pointers per a la càrrega de surfaces des de GIF.
|
||||||
|
- Eliminats últims defines i passats a enum class.
|
||||||
16
CLAUDE.md
16
CLAUDE.md
@@ -16,17 +16,15 @@ cmake -B build -DCMAKE_BUILD_TYPE=Debug # configure
|
|||||||
cmake --build build # build
|
cmake --build build # build
|
||||||
```
|
```
|
||||||
|
|
||||||
### Makefile (direct compilation, platform-specific targets)
|
### Makefile (delegates to CMake)
|
||||||
```bash
|
```bash
|
||||||
make linux # build for Linux
|
make # build Release via cmake
|
||||||
make linux_debug # debug build with -DDEBUG -DVERBOSE
|
make debug # build Debug via cmake
|
||||||
|
make release # create release package (auto-detects OS)
|
||||||
make linux_release # release tar.gz with resources.pack
|
make linux_release # release tar.gz with resources.pack
|
||||||
make windows # build for Windows (cross-compile or native)
|
make windows_release # release zip for Windows
|
||||||
make windows_debug # Windows debug build
|
make macos_release # release dmg for macOS (Intel + Apple Silicon)
|
||||||
make macos # build for macOS (arm64)
|
make raspi_release # release tar.gz for Raspberry Pi
|
||||||
make raspi # build for Raspberry Pi
|
|
||||||
make anbernic # build for Anbernic (no shaders, arcade mode)
|
|
||||||
make no_audio # build without audio system
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tools & Resources
|
### Tools & Resources
|
||||||
|
|||||||
@@ -204,7 +204,17 @@ if(WIN32)
|
|||||||
target_link_libraries(${PROJECT_NAME} PRIVATE ws2_32 mingw32)
|
target_link_libraries(${PROJECT_NAME} PRIVATE ws2_32 mingw32)
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
target_compile_definitions(${PROJECT_NAME} PRIVATE MACOS_BUILD)
|
target_compile_definitions(${PROJECT_NAME} PRIVATE MACOS_BUILD)
|
||||||
|
if(NOT CMAKE_OSX_ARCHITECTURES)
|
||||||
set(CMAKE_OSX_ARCHITECTURES "arm64")
|
set(CMAKE_OSX_ARCHITECTURES "arm64")
|
||||||
|
endif()
|
||||||
|
if(MACOS_BUNDLE)
|
||||||
|
target_compile_definitions(${PROJECT_NAME} PRIVATE MACOS_BUNDLE)
|
||||||
|
target_link_options(${PROJECT_NAME} PRIVATE
|
||||||
|
-framework SDL3
|
||||||
|
-F ${CMAKE_SOURCE_DIR}/release/macos/frameworks/SDL3.xcframework/macos-arm64_x86_64
|
||||||
|
-rpath @executable_path/../Frameworks/
|
||||||
|
)
|
||||||
|
endif()
|
||||||
elseif(UNIX AND NOT APPLE)
|
elseif(UNIX AND NOT APPLE)
|
||||||
target_compile_definitions(${PROJECT_NAME} PRIVATE LINUX_BUILD)
|
target_compile_definitions(${PROJECT_NAME} PRIVATE LINUX_BUILD)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
416
Makefile
416
Makefile
@@ -1,234 +1,168 @@
|
|||||||
# Directorios
|
# ==============================================================================
|
||||||
|
# DIRECTORIES
|
||||||
|
# ==============================================================================
|
||||||
DIR_ROOT := $(dir $(abspath $(MAKEFILE_LIST)))
|
DIR_ROOT := $(dir $(abspath $(MAKEFILE_LIST)))
|
||||||
DIR_SOURCES := $(addsuffix /, $(DIR_ROOT)source)
|
|
||||||
DIR_BIN := $(addsuffix /, $(DIR_ROOT))
|
|
||||||
DIR_BUILD := $(addsuffix /, $(DIR_ROOT)build)
|
|
||||||
DIR_TOOLS := $(addsuffix /, $(DIR_ROOT)tools)
|
DIR_TOOLS := $(addsuffix /, $(DIR_ROOT)tools)
|
||||||
|
|
||||||
# Variables
|
# ==============================================================================
|
||||||
|
# TARGET NAMES
|
||||||
|
# ==============================================================================
|
||||||
TARGET_NAME := coffee_crisis_arcade_edition
|
TARGET_NAME := coffee_crisis_arcade_edition
|
||||||
TARGET_FILE := $(DIR_BIN)$(TARGET_NAME)
|
TARGET_FILE := $(DIR_ROOT)$(TARGET_NAME)
|
||||||
APP_NAME := Coffee Crisis Arcade Edition
|
APP_NAME := Coffee Crisis Arcade Edition
|
||||||
DIST_DIR := dist
|
DIST_DIR := dist
|
||||||
RELEASE_FOLDER := dist/_tmp
|
RELEASE_FOLDER := dist/_tmp
|
||||||
RELEASE_FILE := $(RELEASE_FOLDER)/$(TARGET_NAME)
|
RELEASE_FILE := $(RELEASE_FOLDER)/$(TARGET_NAME)
|
||||||
RESOURCE_FILE := release/windows/coffee.res
|
RESOURCE_FILE := release/windows/coffee.res
|
||||||
|
|
||||||
# Variables para herramienta de empaquetado
|
# ==============================================================================
|
||||||
ifeq ($(OS),Windows_NT)
|
# TOOLS
|
||||||
PACK_TOOL := $(DIR_TOOLS)pack_resources/pack_resources.exe
|
# ==============================================================================
|
||||||
PACK_CXX := $(CXX)
|
DIR_PACK_TOOL := $(DIR_TOOLS)pack_resources
|
||||||
else
|
SHADER_SCRIPT := $(DIR_ROOT)tools/shaders/compile_spirv.sh
|
||||||
PACK_TOOL := $(DIR_TOOLS)pack_resources/pack_resources
|
|
||||||
PACK_CXX := $(CXX)
|
|
||||||
endif
|
|
||||||
PACK_SOURCES := $(DIR_TOOLS)pack_resources/pack_resources.cpp $(DIR_SOURCES)resource_pack.cpp
|
|
||||||
PACK_INCLUDES := -I$(DIR_ROOT) -I$(DIR_BUILD)
|
|
||||||
|
|
||||||
# Versión automática basada en la fecha actual (específica por SO)
|
# ==============================================================================
|
||||||
|
# VERSION (fecha actual)
|
||||||
|
# ==============================================================================
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
VERSION := $(shell powershell -Command "Get-Date -Format 'yyyy-MM-dd'")
|
VERSION := $(shell powershell -Command "Get-Date -Format 'yyyy-MM-dd'")
|
||||||
else
|
else
|
||||||
VERSION := $(shell date +%Y-%m-%d)
|
VERSION := $(shell date +%Y-%m-%d)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Variables específicas para Windows (usando APP_NAME)
|
# ==============================================================================
|
||||||
|
# SHELL (Windows usa cmd.exe)
|
||||||
|
# ==============================================================================
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
WIN_TARGET_FILE := $(DIR_BIN)$(APP_NAME)
|
SHELL := cmd.exe
|
||||||
|
endif
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
# WINDOWS-SPECIFIC VARIABLES
|
||||||
|
# ==============================================================================
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
WIN_TARGET_FILE := $(DIR_ROOT)$(APP_NAME)
|
||||||
WIN_RELEASE_FILE := $(RELEASE_FOLDER)/$(APP_NAME)
|
WIN_RELEASE_FILE := $(RELEASE_FOLDER)/$(APP_NAME)
|
||||||
else
|
else
|
||||||
WIN_TARGET_FILE := $(TARGET_FILE)
|
WIN_TARGET_FILE := $(TARGET_FILE)
|
||||||
WIN_RELEASE_FILE := $(RELEASE_FILE)
|
WIN_RELEASE_FILE := $(RELEASE_FILE)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Nombres para los ficheros de lanzamiento
|
# ==============================================================================
|
||||||
|
# RELEASE NAMES
|
||||||
|
# ==============================================================================
|
||||||
WINDOWS_RELEASE := $(DIST_DIR)/$(TARGET_NAME)-$(VERSION)-win32-x64.zip
|
WINDOWS_RELEASE := $(DIST_DIR)/$(TARGET_NAME)-$(VERSION)-win32-x64.zip
|
||||||
MACOS_INTEL_RELEASE := $(DIST_DIR)/$(TARGET_NAME)-$(VERSION)-macos-intel.dmg
|
MACOS_INTEL_RELEASE := $(DIST_DIR)/$(TARGET_NAME)-$(VERSION)-macos-intel.dmg
|
||||||
MACOS_APPLE_SILICON_RELEASE := $(DIST_DIR)/$(TARGET_NAME)-$(VERSION)-macos-apple-silicon.dmg
|
MACOS_APPLE_SILICON_RELEASE := $(DIST_DIR)/$(TARGET_NAME)-$(VERSION)-macos-apple-silicon.dmg
|
||||||
LINUX_RELEASE := $(DIST_DIR)/$(TARGET_NAME)-$(VERSION)-linux.tar.gz
|
LINUX_RELEASE := $(DIST_DIR)/$(TARGET_NAME)-$(VERSION)-linux.tar.gz
|
||||||
RASPI_RELEASE := $(DIST_DIR)/$(TARGET_NAME)-$(VERSION)-raspberry.tar.gz
|
RASPI_RELEASE := $(DIST_DIR)/$(TARGET_NAME)-$(VERSION)-raspberry.tar.gz
|
||||||
|
|
||||||
# Lista completa de archivos fuente (basada en CMakeLists.txt)
|
# ==============================================================================
|
||||||
APP_SOURCES := \
|
# PLATAFORMA
|
||||||
source/asset.cpp \
|
# ==============================================================================
|
||||||
source/audio.cpp \
|
|
||||||
source/director.cpp \
|
|
||||||
source/global_events.cpp \
|
|
||||||
source/global_inputs.cpp \
|
|
||||||
source/input.cpp \
|
|
||||||
source/lang.cpp \
|
|
||||||
source/main.cpp \
|
|
||||||
source/param.cpp \
|
|
||||||
source/resource.cpp \
|
|
||||||
source/resource_helper.cpp \
|
|
||||||
source/resource_loader.cpp \
|
|
||||||
source/resource_pack.cpp \
|
|
||||||
source/screen.cpp \
|
|
||||||
source/text.cpp \
|
|
||||||
source/writer.cpp \
|
|
||||||
source/ui/menu_option.cpp \
|
|
||||||
source/ui/menu_renderer.cpp \
|
|
||||||
source/ui/notifier.cpp \
|
|
||||||
source/ui/service_menu.cpp \
|
|
||||||
source/ui/ui_message.cpp \
|
|
||||||
source/ui/window_message.cpp \
|
|
||||||
source/balloon_formations.cpp \
|
|
||||||
source/balloon_manager.cpp \
|
|
||||||
source/balloon.cpp \
|
|
||||||
source/bullet.cpp \
|
|
||||||
source/bullet_manager.cpp \
|
|
||||||
source/enter_name.cpp \
|
|
||||||
source/explosions.cpp \
|
|
||||||
source/game_logo.cpp \
|
|
||||||
source/item.cpp \
|
|
||||||
source/manage_hiscore_table.cpp \
|
|
||||||
source/player.cpp \
|
|
||||||
source/scoreboard.cpp \
|
|
||||||
source/tabe.cpp \
|
|
||||||
source/sections/credits.cpp \
|
|
||||||
source/sections/game.cpp \
|
|
||||||
source/sections/hiscore_table.cpp \
|
|
||||||
source/sections/instructions.cpp \
|
|
||||||
source/sections/intro.cpp \
|
|
||||||
source/sections/logo.cpp \
|
|
||||||
source/sections/title.cpp \
|
|
||||||
source/animated_sprite.cpp \
|
|
||||||
source/background.cpp \
|
|
||||||
source/card_sprite.cpp \
|
|
||||||
source/fade.cpp \
|
|
||||||
source/moving_sprite.cpp \
|
|
||||||
source/path_sprite.cpp \
|
|
||||||
source/smart_sprite.cpp \
|
|
||||||
source/sprite.cpp \
|
|
||||||
source/texture.cpp \
|
|
||||||
source/tiled_bg.cpp \
|
|
||||||
source/color.cpp \
|
|
||||||
source/demo.cpp \
|
|
||||||
source/define_buttons.cpp \
|
|
||||||
source/difficulty.cpp \
|
|
||||||
source/input_types.cpp \
|
|
||||||
source/mouse.cpp \
|
|
||||||
source/options.cpp \
|
|
||||||
source/shutdown.cpp \
|
|
||||||
source/stage.cpp \
|
|
||||||
source/system_utils.cpp \
|
|
||||||
source/utils.cpp \
|
|
||||||
source/external/jail_audio.cpp \
|
|
||||||
source/external/gif.cpp \
|
|
||||||
source/rendering/sdl3gpu/sdl3gpu_shader.cpp
|
|
||||||
|
|
||||||
# Includes
|
|
||||||
INCLUDES := -Isource -Isource/external -Isource/rendering -Isource/rendering/sdl3gpu -I$(DIR_BUILD)
|
|
||||||
|
|
||||||
# Variables según el sistema operativo
|
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
FixPath = $(subst /,\\,$1)
|
FixPath = $(subst /,\\,$1)
|
||||||
CXXFLAGS := -std=c++20 -Wall -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -static-libgcc -Wl,-Bstatic -lpthread -Wl,-Bdynamic -Wl,-subsystem,windows -DWINDOWS_BUILD
|
|
||||||
CXXFLAGS_DEBUG := -std=c++20 -Wall -g -D_DEBUG -DWINDOWS_BUILD
|
|
||||||
LDFLAGS := -lmingw32 -lws2_32 -lSDL3
|
|
||||||
RM := del /Q
|
RM := del /Q
|
||||||
MKDIR := mkdir
|
MKDIR := mkdir
|
||||||
else
|
else
|
||||||
FixPath = $1
|
FixPath = $1
|
||||||
CXXFLAGS := -std=c++20 -Wall -Os -ffunction-sections -fdata-sections
|
|
||||||
CXXFLAGS_DEBUG := -std=c++20 -Wall -g -D_DEBUG
|
|
||||||
LDFLAGS := -lSDL3
|
|
||||||
RMFILE := rm -f
|
RMFILE := rm -f
|
||||||
RMDIR := rm -rdf
|
RMDIR := rm -rdf
|
||||||
MKDIR := mkdir -p
|
MKDIR := mkdir -p
|
||||||
UNAME_S := $(shell uname -s)
|
UNAME_S := $(shell uname -s)
|
||||||
ifeq ($(UNAME_S),Linux)
|
|
||||||
CXXFLAGS += -DLINUX_BUILD
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
# COMPILACIÓN CON CMAKE
|
||||||
|
# ==============================================================================
|
||||||
|
all:
|
||||||
|
@cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
||||||
|
@cmake --build build
|
||||||
|
|
||||||
|
debug:
|
||||||
|
@cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
|
||||||
|
@cmake --build build
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
# RELEASE AUTOMÁTICO (detecta SO)
|
||||||
|
# ==============================================================================
|
||||||
|
release:
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
@"$(MAKE)" windows_release
|
||||||
|
else
|
||||||
ifeq ($(UNAME_S),Darwin)
|
ifeq ($(UNAME_S),Darwin)
|
||||||
CXXFLAGS += -DMACOS_BUILD
|
@$(MAKE) macos_release
|
||||||
CXXFLAGS_DEBUG += -DMACOS_BUILD
|
else
|
||||||
# Configurar arquitectura (por defecto arm64, como en CMake)
|
@$(MAKE) linux_release
|
||||||
CXXFLAGS += -arch arm64
|
|
||||||
CXXFLAGS_DEBUG += -arch arm64
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Reglas para herramienta de empaquetado y resources.pack
|
# ==============================================================================
|
||||||
$(PACK_TOOL): FORCE
|
# REGLAS PARA HERRAMIENTA DE EMPAQUETADO Y RESOURCES.PACK
|
||||||
@echo "Compilando herramienta de empaquetado..."
|
# ==============================================================================
|
||||||
$(PACK_CXX) -std=c++20 -Wall -Os $(PACK_INCLUDES) $(PACK_SOURCES) -o $(PACK_TOOL)
|
pack_tool:
|
||||||
@echo "✓ Herramienta de empaquetado lista: $(PACK_TOOL)"
|
@$(MAKE) -C $(DIR_PACK_TOOL)
|
||||||
|
|
||||||
pack_tool: $(PACK_TOOL)
|
resources.pack:
|
||||||
|
@$(MAKE) -C $(DIR_PACK_TOOL) pack
|
||||||
|
|
||||||
resources.pack: $(PACK_TOOL)
|
# ==============================================================================
|
||||||
@echo "Generando resources.pack desde directorio data/..."
|
# COMPILACIÓN DE SHADERS
|
||||||
$(PACK_TOOL) data resources.pack
|
# ==============================================================================
|
||||||
@echo "✓ resources.pack generado exitosamente"
|
spirv:
|
||||||
|
@echo "Compilando shaders SPIR-V..."
|
||||||
# Reglas para compilación
|
$(SHADER_SCRIPT)
|
||||||
windows:
|
|
||||||
@echo off
|
|
||||||
@echo Compilando para Windows con nombre: "$(APP_NAME).exe"
|
|
||||||
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
|
|
||||||
|
|
||||||
windows_rec:
|
|
||||||
@echo off
|
|
||||||
@echo Compilando version de grabacion para Windows: "$(APP_NAME)_rec.exe"
|
|
||||||
$(CXX) $(APP_SOURCES) $(INCLUDES) -DRECORDING $(CXXFLAGS) $(LDFLAGS) -o "$(WIN_TARGET_FILE)_rec.exe"
|
|
||||||
|
|
||||||
windows_debug:
|
|
||||||
@echo off
|
|
||||||
@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"
|
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
# COMPILACIÓN PARA WINDOWS (RELEASE)
|
||||||
|
# ==============================================================================
|
||||||
windows_release:
|
windows_release:
|
||||||
@$(MAKE) pack_tool
|
|
||||||
@$(MAKE) resources.pack
|
@$(MAKE) resources.pack
|
||||||
@echo off
|
@echo off
|
||||||
@echo Creando release para Windows - Version: $(VERSION)
|
@echo Creando release para Windows - Version: $(VERSION)
|
||||||
|
|
||||||
|
# Compila con cmake
|
||||||
|
@cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
||||||
|
@cmake --build build
|
||||||
|
|
||||||
# Crea carpeta de distribución y 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 -Command "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 -Command "if (Test-Path '$(RELEASE_FOLDER)') {Remove-Item '$(RELEASE_FOLDER)' -Recurse -Force}"
|
||||||
powershell if (-not (Test-Path "$(RELEASE_FOLDER)")) {New-Item "$(RELEASE_FOLDER)" -ItemType Directory}
|
@powershell -Command "if (-not (Test-Path '$(RELEASE_FOLDER)')) {New-Item '$(RELEASE_FOLDER)' -ItemType Directory}"
|
||||||
|
|
||||||
# Copia la carpeta 'config' y el archivo 'resources.pack'
|
# Copia la carpeta 'config' y el archivo 'resources.pack'
|
||||||
powershell Copy-Item -Path "config" -Destination "$(RELEASE_FOLDER)" -recurse -Force
|
@powershell -Command "Copy-Item -Path 'config' -Destination '$(RELEASE_FOLDER)' -recurse -Force"
|
||||||
powershell Copy-Item -Path "resources.pack" -Destination "$(RELEASE_FOLDER)"
|
@powershell -Command "Copy-Item -Path 'resources.pack' -Destination '$(RELEASE_FOLDER)'"
|
||||||
|
|
||||||
# Copia los ficheros que estan en la raíz del proyecto
|
# Copia los ficheros que estan en la raíz del proyecto
|
||||||
powershell Copy-Item "LICENSE" -Destination "$(RELEASE_FOLDER)"
|
@powershell -Command "Copy-Item 'LICENSE' -Destination '$(RELEASE_FOLDER)'"
|
||||||
powershell Copy-Item "README.md" -Destination "$(RELEASE_FOLDER)"
|
@powershell -Command "Copy-Item 'README.md' -Destination '$(RELEASE_FOLDER)'"
|
||||||
powershell Copy-Item "release\windows\dll\*.dll" -Destination "$(RELEASE_FOLDER)"
|
@powershell -Command "Copy-Item 'release\windows\dll\*.dll' -Destination '$(RELEASE_FOLDER)'"
|
||||||
|
@powershell -Command "Copy-Item -Path '$(TARGET_FILE)' -Destination '\"$(WIN_RELEASE_FILE).exe\"'"
|
||||||
# Compila
|
|
||||||
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
|
strip -s -R .comment -R .gnu.version "$(WIN_RELEASE_FILE).exe" --strip-unneeded
|
||||||
|
|
||||||
# Crea el fichero .zip
|
# Crea el fichero .zip
|
||||||
powershell if (Test-Path "$(WINDOWS_RELEASE)") {Remove-Item "$(WINDOWS_RELEASE)"}
|
@powershell -Command "if (Test-Path '$(WINDOWS_RELEASE)') {Remove-Item '$(WINDOWS_RELEASE)'}"
|
||||||
powershell Compress-Archive -Path "$(RELEASE_FOLDER)"/* -DestinationPath "$(WINDOWS_RELEASE)"
|
@powershell -Command "Compress-Archive -Path '$(RELEASE_FOLDER)/*' -DestinationPath '$(WINDOWS_RELEASE)'"
|
||||||
@echo Release creado: $(WINDOWS_RELEASE)
|
@echo Release creado: $(WINDOWS_RELEASE)
|
||||||
|
|
||||||
# Elimina la carpeta temporal 'RELEASE_FOLDER'
|
# Elimina la carpeta temporal 'RELEASE_FOLDER'
|
||||||
powershell if (Test-Path "$(RELEASE_FOLDER)") {Remove-Item "$(RELEASE_FOLDER)" -Recurse -Force}
|
@powershell -Command "if (Test-Path '$(RELEASE_FOLDER)') {Remove-Item '$(RELEASE_FOLDER)' -Recurse -Force}"
|
||||||
|
|
||||||
macos:
|
|
||||||
@echo "Compilando para macOS: $(TARGET_NAME)"
|
|
||||||
$(CXX) $(APP_SOURCES) $(INCLUDES) $(CXXFLAGS) $(LDFLAGS) -o "$(TARGET_FILE)"
|
|
||||||
|
|
||||||
macos_debug:
|
|
||||||
@echo "Compilando version debug para macOS: $(TARGET_NAME)_debug"
|
|
||||||
$(CXX) $(APP_SOURCES) $(INCLUDES) -DDEBUG -DVERBOSE $(CXXFLAGS_DEBUG) $(LDFLAGS) -o "$(TARGET_FILE)_debug"
|
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
# COMPILACIÓN PARA MACOS (RELEASE)
|
||||||
|
# ==============================================================================
|
||||||
macos_release:
|
macos_release:
|
||||||
@$(MAKE) pack_tool
|
|
||||||
@$(MAKE) resources.pack
|
@$(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
|
# Verificar e instalar create-dmg si es necesario
|
||||||
@which create-dmg > /dev/null || (echo "Instalando create-dmg..." && brew install create-dmg)
|
@which create-dmg > /dev/null || (echo "Instalando create-dmg..." && brew install create-dmg)
|
||||||
|
|
||||||
|
# Compila la versión para procesadores Intel con cmake
|
||||||
|
@cmake -S . -B build/intel -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DMACOS_BUNDLE=ON
|
||||||
|
@cmake --build build/intel
|
||||||
|
|
||||||
# Elimina datos de compilaciones anteriores
|
# Elimina datos de compilaciones anteriores
|
||||||
$(RMDIR) "$(RELEASE_FOLDER)"
|
$(RMDIR) "$(RELEASE_FOLDER)"
|
||||||
$(RMFILE) tmp.dmg
|
$(RMFILE) tmp.dmg
|
||||||
@@ -251,9 +185,8 @@ macos_release:
|
|||||||
cp LICENSE "$(RELEASE_FOLDER)"
|
cp LICENSE "$(RELEASE_FOLDER)"
|
||||||
cp README.md "$(RELEASE_FOLDER)"
|
cp README.md "$(RELEASE_FOLDER)"
|
||||||
|
|
||||||
# Compila la versión para procesadores Intel
|
# Copia el ejecutable Intel al bundle
|
||||||
ifdef ENABLE_MACOS_X86_64
|
cp "$(TARGET_FILE)" "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/MacOS/$(TARGET_NAME)"
|
||||||
$(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 -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
|
# 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"
|
||||||
@@ -274,10 +207,11 @@ ifdef ENABLE_MACOS_X86_64
|
|||||||
"$(MACOS_INTEL_RELEASE)" \
|
"$(MACOS_INTEL_RELEASE)" \
|
||||||
"$(RELEASE_FOLDER)" || true
|
"$(RELEASE_FOLDER)" || true
|
||||||
@echo "Release Intel creado: $(MACOS_INTEL_RELEASE)"
|
@echo "Release Intel creado: $(MACOS_INTEL_RELEASE)"
|
||||||
endif
|
|
||||||
|
|
||||||
# Compila la versión para procesadores Apple Silicon
|
# Compila la versión para procesadores Apple Silicon con cmake
|
||||||
$(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 -ffunction-sections -fdata-sections -o "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/MacOS/$(TARGET_NAME)" -rpath @executable_path/../Frameworks/ -target arm64-apple-macos11
|
@cmake -S . -B build/arm -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DMACOS_BUNDLE=ON
|
||||||
|
@cmake --build build/arm
|
||||||
|
cp "$(TARGET_FILE)" "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/MacOS/$(TARGET_NAME)"
|
||||||
|
|
||||||
# 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"
|
||||||
@@ -301,22 +235,22 @@ endif
|
|||||||
|
|
||||||
# Elimina las carpetas temporales
|
# Elimina las carpetas temporales
|
||||||
$(RMDIR) "$(RELEASE_FOLDER)"
|
$(RMDIR) "$(RELEASE_FOLDER)"
|
||||||
|
$(RMDIR) build/intel
|
||||||
|
$(RMDIR) build/arm
|
||||||
$(RMFILE) "$(DIST_DIR)"/rw.*
|
$(RMFILE) "$(DIST_DIR)"/rw.*
|
||||||
|
|
||||||
linux:
|
# ==============================================================================
|
||||||
@echo "Compilando para Linux: $(TARGET_NAME)"
|
# COMPILACIÓN PARA LINUX (RELEASE)
|
||||||
$(CXX) $(APP_SOURCES) $(INCLUDES) $(CXXFLAGS) $(LDFLAGS) -o "$(TARGET_FILE)"
|
# ==============================================================================
|
||||||
strip -s -R .comment -R .gnu.version "$(TARGET_FILE)" --strip-unneeded
|
|
||||||
|
|
||||||
linux_debug:
|
|
||||||
@echo "Compilando version debug para Linux: $(TARGET_NAME)_debug"
|
|
||||||
$(CXX) $(APP_SOURCES) $(INCLUDES) -DDEBUG -DVERBOSE $(CXXFLAGS_DEBUG) $(LDFLAGS) -o "$(TARGET_FILE)_debug"
|
|
||||||
|
|
||||||
linux_release:
|
linux_release:
|
||||||
@$(MAKE) pack_tool
|
|
||||||
@$(MAKE) resources.pack
|
@$(MAKE) resources.pack
|
||||||
@echo "Creando release para Linux - Version: $(VERSION)"
|
@echo "Creando release para Linux - Version: $(VERSION)"
|
||||||
# Elimina carpetas previas y recrea (crea dist/ si no existe)
|
|
||||||
|
# Compila con cmake
|
||||||
|
@cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
||||||
|
@cmake --build build
|
||||||
|
|
||||||
|
# Elimina carpeta temporal previa y la recrea (crea dist/ si no existe)
|
||||||
$(RMDIR) "$(RELEASE_FOLDER)"
|
$(RMDIR) "$(RELEASE_FOLDER)"
|
||||||
$(MKDIR) "$(RELEASE_FOLDER)"
|
$(MKDIR) "$(RELEASE_FOLDER)"
|
||||||
|
|
||||||
@@ -325,9 +259,7 @@ linux_release:
|
|||||||
cp resources.pack "$(RELEASE_FOLDER)"
|
cp resources.pack "$(RELEASE_FOLDER)"
|
||||||
cp LICENSE "$(RELEASE_FOLDER)"
|
cp LICENSE "$(RELEASE_FOLDER)"
|
||||||
cp README.md "$(RELEASE_FOLDER)"
|
cp README.md "$(RELEASE_FOLDER)"
|
||||||
|
cp "$(TARGET_FILE)" "$(RELEASE_FILE)"
|
||||||
# Compila
|
|
||||||
$(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
|
||||||
@@ -338,10 +270,17 @@ linux_release:
|
|||||||
# Elimina la carpeta temporal
|
# Elimina la carpeta temporal
|
||||||
$(RMDIR) "$(RELEASE_FOLDER)"
|
$(RMDIR) "$(RELEASE_FOLDER)"
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
# COMPILACIÓN PARA LINUX (RELEASE CON INTEGRACIÓN DESKTOP)
|
||||||
|
# ==============================================================================
|
||||||
linux_release_desktop:
|
linux_release_desktop:
|
||||||
@$(MAKE) pack_tool
|
|
||||||
@$(MAKE) resources.pack
|
@$(MAKE) resources.pack
|
||||||
@echo "Creando release con integracion desktop para Linux - Version: $(VERSION)"
|
@echo "Creando release con integracion desktop para Linux - Version: $(VERSION)"
|
||||||
|
|
||||||
|
# Compila con cmake
|
||||||
|
@cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
||||||
|
@cmake --build build
|
||||||
|
|
||||||
# Elimina carpetas previas y recrea (crea dist/ si no existe)
|
# Elimina carpetas previas y recrea (crea dist/ si no existe)
|
||||||
$(RMDIR) "$(RELEASE_FOLDER)"
|
$(RMDIR) "$(RELEASE_FOLDER)"
|
||||||
|
|
||||||
@@ -358,8 +297,8 @@ linux_release_desktop:
|
|||||||
cp LICENSE "$(RELEASE_FOLDER)/$(TARGET_NAME)/"
|
cp LICENSE "$(RELEASE_FOLDER)/$(TARGET_NAME)/"
|
||||||
cp README.md "$(RELEASE_FOLDER)/$(TARGET_NAME)/"
|
cp README.md "$(RELEASE_FOLDER)/$(TARGET_NAME)/"
|
||||||
|
|
||||||
# Compila el ejecutable
|
# Copia el ejecutable
|
||||||
$(CXX) $(APP_SOURCES) $(INCLUDES) -DRELEASE_BUILD $(CXXFLAGS) $(LDFLAGS) -o "$(RELEASE_FOLDER)/$(TARGET_NAME)/bin/$(TARGET_NAME)"
|
cp "$(TARGET_FILE)" "$(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
|
||||||
@@ -433,19 +372,17 @@ linux_release_desktop:
|
|||||||
# Elimina la carpeta temporal
|
# Elimina la carpeta temporal
|
||||||
$(RMDIR) "$(RELEASE_FOLDER)"
|
$(RMDIR) "$(RELEASE_FOLDER)"
|
||||||
|
|
||||||
raspi:
|
# ==============================================================================
|
||||||
@echo "Compilando para Raspberry Pi: $(TARGET_NAME)"
|
# COMPILACIÓN PARA RASPBERRY PI (RELEASE)
|
||||||
$(CXX) $(APP_SOURCES) $(INCLUDES) -DVERBOSE $(CXXFLAGS) $(LDFLAGS) -o $(TARGET_FILE)
|
# ==============================================================================
|
||||||
strip -s -R .comment -R .gnu.version $(TARGET_FILE) --strip-unneeded
|
|
||||||
|
|
||||||
raspi_debug:
|
|
||||||
@echo "Compilando version debug para Raspberry Pi: $(TARGET_NAME)_debug"
|
|
||||||
$(CXX) $(APP_SOURCES) $(INCLUDES) -DVERBOSE -DDEBUG $(CXXFLAGS_DEBUG) $(LDFLAGS) -o "$(TARGET_FILE)_debug"
|
|
||||||
|
|
||||||
raspi_release:
|
raspi_release:
|
||||||
@$(MAKE) pack_tool
|
|
||||||
@$(MAKE) resources.pack
|
@$(MAKE) resources.pack
|
||||||
@echo "Creando release para Raspberry Pi - Version: $(VERSION)"
|
@echo "Creando release para Raspberry Pi - Version: $(VERSION)"
|
||||||
|
|
||||||
|
# Compila con cmake
|
||||||
|
@cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
||||||
|
@cmake --build build
|
||||||
|
|
||||||
# Elimina carpetas previas y recrea (crea dist/ si no existe)
|
# Elimina carpetas previas y recrea (crea dist/ si no existe)
|
||||||
$(RMDIR) "$(RELEASE_FOLDER)"
|
$(RMDIR) "$(RELEASE_FOLDER)"
|
||||||
$(MKDIR) "$(RELEASE_FOLDER)"
|
$(MKDIR) "$(RELEASE_FOLDER)"
|
||||||
@@ -455,9 +392,7 @@ raspi_release:
|
|||||||
cp resources.pack "$(RELEASE_FOLDER)"
|
cp resources.pack "$(RELEASE_FOLDER)"
|
||||||
cp LICENSE "$(RELEASE_FOLDER)"
|
cp LICENSE "$(RELEASE_FOLDER)"
|
||||||
cp README.md "$(RELEASE_FOLDER)"
|
cp README.md "$(RELEASE_FOLDER)"
|
||||||
|
cp "$(TARGET_FILE)" "$(RELEASE_FILE)"
|
||||||
# Compila
|
|
||||||
$(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
|
||||||
@@ -468,59 +403,60 @@ raspi_release:
|
|||||||
# Elimina la carpeta temporal
|
# Elimina la carpeta temporal
|
||||||
$(RMDIR) "$(RELEASE_FOLDER)"
|
$(RMDIR) "$(RELEASE_FOLDER)"
|
||||||
|
|
||||||
anbernic:
|
# ==============================================================================
|
||||||
@$(MAKE) pack_tool
|
# CODE QUALITY (delegados a cmake)
|
||||||
@$(MAKE) resources.pack
|
# ==============================================================================
|
||||||
@echo "Compilando para Anbernic: $(TARGET_NAME)"
|
format:
|
||||||
# Elimina carpetas previas
|
@cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
||||||
$(RMDIR) "$(RELEASE_FOLDER)"_anbernic
|
@cmake --build build --target format
|
||||||
|
|
||||||
# Crea la carpeta temporal para realizar el lanzamiento
|
format-check:
|
||||||
$(MKDIR) "$(RELEASE_FOLDER)"_anbernic
|
@cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
||||||
|
@cmake --build build --target format-check
|
||||||
|
|
||||||
# Copia ficheros
|
tidy:
|
||||||
cp -R config "$(RELEASE_FOLDER)"_anbernic
|
@cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
||||||
cp resources.pack "$(RELEASE_FOLDER)"_anbernic
|
@cmake --build build --target tidy
|
||||||
|
|
||||||
# Compila
|
tidy-fix:
|
||||||
$(CXX) $(APP_SOURCES) $(INCLUDES) -DRELEASE_BUILD -DANBERNIC -DNO_SHADERS -DARCADE -DVERBOSE $(CXXFLAGS) $(LDFLAGS) -o $(RELEASE_FOLDER)_anbernic/$(TARGET_NAME)
|
@cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
||||||
|
@cmake --build build --target tidy-fix
|
||||||
|
|
||||||
# Opción para deshabilitar audio (equivalente a la opción DISABLE_AUDIO de CMake)
|
# ==============================================================================
|
||||||
no_audio:
|
# REGLAS ESPECIALES
|
||||||
@echo "Compilando sin audio: $(TARGET_NAME)_no_audio"
|
# ==============================================================================
|
||||||
$(CXX) $(filter-out source/external/jail_audio.cpp,$(APP_SOURCES)) $(INCLUDES) -DNO_AUDIO $(CXXFLAGS) $(LDFLAGS) -o "$(TARGET_FILE)_no_audio"
|
|
||||||
|
|
||||||
# Regla para mostrar la versión actual
|
|
||||||
show_version:
|
show_version:
|
||||||
@echo "Version actual: $(VERSION)"
|
@echo "Version actual: $(VERSION)"
|
||||||
|
|
||||||
# Regla de ayuda
|
|
||||||
help:
|
help:
|
||||||
@echo "Makefile para Coffee Crisis Arcade Edition"
|
@echo "Makefile para Coffee Crisis Arcade Edition"
|
||||||
@echo "Comandos disponibles:"
|
@echo "Comandos disponibles:"
|
||||||
@echo " windows - Compilar para Windows"
|
@echo ""
|
||||||
@echo " windows_debug - Compilar debug para Windows"
|
@echo " Compilacion:"
|
||||||
@echo " windows_release - Crear release completo para Windows"
|
@echo " make - Compilar con cmake (Release)"
|
||||||
@echo " linux - Compilar para Linux"
|
@echo " make debug - Compilar con cmake (Debug)"
|
||||||
@echo " linux_debug - Compilar debug para Linux"
|
@echo ""
|
||||||
@echo " linux_release - Crear release basico para Linux"
|
@echo " Release:"
|
||||||
@echo " linux_release_desktop - Crear release con integracion desktop para Linux"
|
@echo " make release - Crear release (detecta SO automaticamente)"
|
||||||
@echo " macos - Compilar para macOS"
|
@echo " make windows_release - Crear release para Windows"
|
||||||
@echo " macos_debug - Compilar debug para macOS"
|
@echo " make linux_release - Crear release basico para Linux"
|
||||||
@echo " macos_release - Crear release completo para macOS"
|
@echo " make linux_release_desktop - Crear release con integracion desktop para Linux"
|
||||||
@echo " raspi - Compilar para Raspberry Pi"
|
@echo " make macos_release - Crear release para macOS"
|
||||||
@echo " raspi_release - Crear release completo para Raspberry Pi"
|
@echo " make raspi_release - Crear release para Raspberry Pi"
|
||||||
@echo " anbernic - Compilar para Anbernic"
|
@echo ""
|
||||||
@echo " no_audio - Compilar sin sistema de audio"
|
@echo " Herramientas:"
|
||||||
@echo " pack_tool - Compilar herramienta de empaquetado"
|
@echo " make spirv - Compilar shaders SPIR-V"
|
||||||
@echo " resources.pack - Generar pack de recursos desde data/"
|
@echo " make pack_tool - Compilar herramienta de empaquetado"
|
||||||
@echo " show_version - Mostrar version actual ($(VERSION))"
|
@echo " make resources.pack - Generar pack de recursos desde data/"
|
||||||
@echo " help - Mostrar esta ayuda"
|
@echo ""
|
||||||
|
@echo " Calidad de codigo:"
|
||||||
|
@echo " make format - Formatear codigo con clang-format"
|
||||||
|
@echo " make format-check - Verificar formato sin modificar"
|
||||||
|
@echo " make tidy - Analisis estatico con clang-tidy"
|
||||||
|
@echo " make tidy-fix - Analisis estatico con auto-fix"
|
||||||
|
@echo ""
|
||||||
|
@echo " Otros:"
|
||||||
|
@echo " make show_version - Mostrar version actual ($(VERSION))"
|
||||||
|
@echo " make help - Mostrar esta ayuda"
|
||||||
|
|
||||||
spirv:
|
.PHONY: all debug release windows_release macos_release linux_release linux_release_desktop raspi_release pack_tool resources.pack spirv format format-check tidy tidy-fix show_version help
|
||||||
@echo "Compilando shaders SPIR-V..."
|
|
||||||
tools/shaders/compile_spirv.sh
|
|
||||||
|
|
||||||
.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 spirv
|
|
||||||
|
|
||||||
FORCE:
|
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ service_menu.window_message.text_safety_margin 15.0f # Margen de segu
|
|||||||
service_menu.window_message.animation_duration 0.3f # Duración de animaciones de ventanas (segundos)
|
service_menu.window_message.animation_duration 0.3f # Duración de animaciones de ventanas (segundos)
|
||||||
|
|
||||||
# --- INTRO ---
|
# --- INTRO ---
|
||||||
intro.bg_color 4664BD # Color de fondo de la intro
|
intro.bg_color 41526F # Color de fondo de la intro
|
||||||
intro.card_color CBDBFC # Color de las tarjetas en la intro
|
intro.card_color CBDBFC # Color de las tarjetas en la intro
|
||||||
intro.shadow_color 00000080 # Color de la sombra de las tarjetas en la intro
|
intro.shadow_color 00000080 # Color de la sombra de las tarjetas en la intro
|
||||||
intro.text_distance_from_bottom 48 # Posicion del texto
|
intro.text_distance_from_bottom 48 # Posicion del texto
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ service_menu.window_message.text_safety_margin 15.0f # Margen de segu
|
|||||||
service_menu.window_message.animation_duration 0.3f # Duración de animaciones de ventanas (segundos)
|
service_menu.window_message.animation_duration 0.3f # Duración de animaciones de ventanas (segundos)
|
||||||
|
|
||||||
# --- INTRO ---
|
# --- INTRO ---
|
||||||
intro.bg_color 4664BD # Color de fondo de la intro
|
intro.bg_color 41526F # Color de fondo de la intro
|
||||||
intro.card_color CBDBFC # Color de las tarjetas en la intro
|
intro.card_color CBDBFC # Color de las tarjetas en la intro
|
||||||
intro.shadow_color 00000080 # Color de la sombra de las tarjetas en la intro
|
intro.shadow_color 00000080 # Color de la sombra de las tarjetas en la intro
|
||||||
intro.text_distance_from_bottom 48 # Posición del texto desde la parte inferior
|
intro.text_distance_from_bottom 48 # Posición del texto desde la parte inferior
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ CardSprite::CardSprite(std::shared_ptr<Texture> texture)
|
|||||||
entry_easing_(easeOutBounce) {}
|
entry_easing_(easeOutBounce) {}
|
||||||
|
|
||||||
// Inicia la animación de entrada (solo si está en IDLE)
|
// Inicia la animación de entrada (solo si está en IDLE)
|
||||||
void CardSprite::enable() {
|
auto CardSprite::enable() -> bool {
|
||||||
if (state_ != CardState::IDLE) {
|
if (state_ != CardState::IDLE) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
state_ = CardState::ENTERING;
|
state_ = CardState::ENTERING;
|
||||||
@@ -34,6 +34,7 @@ void CardSprite::enable() {
|
|||||||
rotate_.center = {pos_.w / 2.0F, pos_.h / 2.0F};
|
rotate_.center = {pos_.w / 2.0F, pos_.h / 2.0F};
|
||||||
|
|
||||||
shadow_visible_ = true;
|
shadow_visible_ = true;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inicia la animación de salida (solo si está en LANDED)
|
// Inicia la animación de salida (solo si está en LANDED)
|
||||||
@@ -43,7 +44,7 @@ void CardSprite::startExit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
state_ = CardState::EXITING;
|
state_ = CardState::EXITING;
|
||||||
shadow_visible_ = false;
|
shadow_visible_ = true;
|
||||||
|
|
||||||
// Velocidad y aceleración de salida
|
// Velocidad y aceleración de salida
|
||||||
vx_ = exit_vx_;
|
vx_ = exit_vx_;
|
||||||
@@ -109,11 +110,21 @@ void CardSprite::updateEntering(float delta_time) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Animación de salida: movimiento + rotación continua
|
// Animación de salida: movimiento + rotación continua + zoom opcional
|
||||||
void CardSprite::updateExiting(float delta_time) {
|
void CardSprite::updateExiting(float delta_time) {
|
||||||
move(delta_time);
|
move(delta_time);
|
||||||
rotate(delta_time);
|
rotate(delta_time);
|
||||||
|
|
||||||
|
// Ganar altura gradualmente (zoom hacia el objetivo)
|
||||||
|
if (exit_zoom_speed_ > 0.0F && horizontal_zoom_ < exit_target_zoom_) {
|
||||||
|
float new_zoom = horizontal_zoom_ + exit_zoom_speed_ * delta_time;
|
||||||
|
if (new_zoom > exit_target_zoom_) {
|
||||||
|
new_zoom = exit_target_zoom_;
|
||||||
|
}
|
||||||
|
horizontal_zoom_ = new_zoom;
|
||||||
|
vertical_zoom_ = new_zoom;
|
||||||
|
}
|
||||||
|
|
||||||
if (isOffScreen()) {
|
if (isOffScreen()) {
|
||||||
state_ = CardState::FINISHED;
|
state_ = CardState::FINISHED;
|
||||||
}
|
}
|
||||||
@@ -134,20 +145,31 @@ void CardSprite::render() {
|
|||||||
MovingSprite::render();
|
MovingSprite::render();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Renderiza la sombra con efecto de perspectiva
|
// Renderiza la sombra con efecto de perspectiva 2D→3D (efecto helicóptero)
|
||||||
// Cuanto más alta la tarjeta (zoom grande), la sombra es más pequeña y más separada.
|
//
|
||||||
// Cuando la tarjeta está en la mesa (zoom=1.0), la sombra tiene tamaño real y offset base.
|
// Fuente de luz en la esquina superior izquierda (0,0).
|
||||||
|
// La sombra se mueve con la tarjeta pero desplazada en dirección opuesta a la luz
|
||||||
|
// (abajo-derecha a 45°). Cuanto más alta la tarjeta (zoom > 1.0):
|
||||||
|
// - Más separada de la tarjeta (offset grande)
|
||||||
|
// - Más pequeña (proyección lejana)
|
||||||
|
// Cuando la tarjeta está en la mesa (zoom=1.0):
|
||||||
|
// - Sombra pegada con offset base
|
||||||
|
// - Tamaño real
|
||||||
void CardSprite::renderShadow() {
|
void CardSprite::renderShadow() {
|
||||||
// La sombra siempre está en la mesa: su escala es inversamente proporcional al zoom
|
// Altura sobre la mesa: 0.0 = en la mesa, 0.8 = alta (zoom 1.8)
|
||||||
|
float height = horizontal_zoom_ - 1.0F;
|
||||||
|
|
||||||
|
// Escala: más pequeña cuanto más alta
|
||||||
float shadow_zoom = 1.0F / horizontal_zoom_;
|
float shadow_zoom = 1.0F / horizontal_zoom_;
|
||||||
|
|
||||||
// El offset aumenta con la altura (más lejos de la tarjeta cuanto más alta)
|
// Offset respecto a la tarjeta: base + extra proporcional a la altura
|
||||||
float scaled_offset_x = shadow_offset_x_ * horizontal_zoom_;
|
// La sombra se aleja en diagonal abajo-derecha (opuesta a la luz en 0,0)
|
||||||
float scaled_offset_y = shadow_offset_y_ * horizontal_zoom_;
|
float offset_x = shadow_offset_x_ + height * SHADOW_HEIGHT_MULTIPLIER;
|
||||||
|
float offset_y = shadow_offset_y_ + height * SHADOW_HEIGHT_MULTIPLIER;
|
||||||
|
|
||||||
shadow_texture_->render(
|
shadow_texture_->render(
|
||||||
pos_.x + scaled_offset_x,
|
pos_.x + offset_x,
|
||||||
pos_.y + scaled_offset_y,
|
pos_.y + offset_y,
|
||||||
&sprite_clip_,
|
&sprite_clip_,
|
||||||
shadow_zoom,
|
shadow_zoom,
|
||||||
shadow_zoom,
|
shadow_zoom,
|
||||||
@@ -213,6 +235,11 @@ void CardSprite::setExitParams(float vx, float vy, float ax, float ay, double ro
|
|||||||
exit_rotate_amount_ = rotate_amount;
|
exit_rotate_amount_ = rotate_amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CardSprite::setExitLift(float target_zoom, float zoom_speed) {
|
||||||
|
exit_target_zoom_ = target_zoom;
|
||||||
|
exit_zoom_speed_ = zoom_speed;
|
||||||
|
}
|
||||||
|
|
||||||
void CardSprite::setShadowTexture(std::shared_ptr<Texture> texture) {
|
void CardSprite::setShadowTexture(std::shared_ptr<Texture> texture) {
|
||||||
shadow_texture_ = std::move(texture);
|
shadow_texture_ = std::move(texture);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class CardSprite : public MovingSprite {
|
|||||||
void render() override;
|
void render() override;
|
||||||
|
|
||||||
// --- Control de estado ---
|
// --- Control de estado ---
|
||||||
void enable(); // Inicia la animación de entrada
|
auto enable() -> bool; // Inicia la animación de entrada (true si se activó)
|
||||||
void startExit(); // Inicia la animación de salida
|
void startExit(); // Inicia la animación de salida
|
||||||
|
|
||||||
// --- Consultas de estado ---
|
// --- Consultas de estado ---
|
||||||
@@ -50,6 +50,7 @@ class CardSprite : public MovingSprite {
|
|||||||
|
|
||||||
// --- Configuración de salida ---
|
// --- Configuración de salida ---
|
||||||
void setExitParams(float vx, float vy, float ax, float ay, double rotate_amount);
|
void setExitParams(float vx, float vy, float ax, float ay, double rotate_amount);
|
||||||
|
void setExitLift(float target_zoom, float zoom_speed); // Ganar altura al salir (zoom > 1.0)
|
||||||
|
|
||||||
// --- Sombra ---
|
// --- Sombra ---
|
||||||
void setShadowTexture(std::shared_ptr<Texture> texture);
|
void setShadowTexture(std::shared_ptr<Texture> texture);
|
||||||
@@ -83,6 +84,8 @@ class CardSprite : public MovingSprite {
|
|||||||
float exit_ax_ = 0.0F;
|
float exit_ax_ = 0.0F;
|
||||||
float exit_ay_ = 0.0F;
|
float exit_ay_ = 0.0F;
|
||||||
double exit_rotate_amount_ = 0.0;
|
double exit_rotate_amount_ = 0.0;
|
||||||
|
float exit_target_zoom_ = 1.0F; // Zoom objetivo al salir (>1.0 = se eleva)
|
||||||
|
float exit_zoom_speed_ = 0.0F; // Velocidad de cambio de zoom por segundo
|
||||||
|
|
||||||
// --- Sombra ---
|
// --- Sombra ---
|
||||||
std::shared_ptr<Texture> shadow_texture_;
|
std::shared_ptr<Texture> shadow_texture_;
|
||||||
@@ -94,8 +97,9 @@ class CardSprite : public MovingSprite {
|
|||||||
float screen_width_ = 320.0F;
|
float screen_width_ = 320.0F;
|
||||||
float screen_height_ = 240.0F;
|
float screen_height_ = 240.0F;
|
||||||
|
|
||||||
// --- Margen fuera de pantalla para considerar FINISHED ---
|
// --- Constantes ---
|
||||||
static constexpr float OFF_SCREEN_MARGIN = 50.0F;
|
static constexpr float OFF_SCREEN_MARGIN = 50.0F; // Margen fuera de pantalla para considerar FINISHED
|
||||||
|
static constexpr float SHADOW_HEIGHT_MULTIPLIER = 400.0F; // Pixels de separación de sombra por unidad de altura
|
||||||
|
|
||||||
// --- Métodos internos ---
|
// --- Métodos internos ---
|
||||||
void updateEntering(float delta_time);
|
void updateEntering(float delta_time);
|
||||||
|
|||||||
@@ -325,17 +325,6 @@ void Input::initSDLGamePad() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Input::resetJustPressed() {
|
|
||||||
for (auto& key : keyboard_.bindings) {
|
|
||||||
key.second.just_pressed = false;
|
|
||||||
}
|
|
||||||
for (auto& gamepad : gamepads_) {
|
|
||||||
for (auto& binding : gamepad->bindings) {
|
|
||||||
binding.second.just_pressed = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Input::resetInputStates() {
|
void Input::resetInputStates() {
|
||||||
// Resetear todos los KeyBindings.active a false
|
// Resetear todos los KeyBindings.active a false
|
||||||
for (auto& key : keyboard_.bindings) {
|
for (auto& key : keyboard_.bindings) {
|
||||||
@@ -360,7 +349,7 @@ void Input::update() {
|
|||||||
bool key_is_down_now = key_states[binding.second.scancode];
|
bool key_is_down_now = key_states[binding.second.scancode];
|
||||||
|
|
||||||
// El estado .is_held del fotograma anterior nos sirve para saber si es un pulso nuevo
|
// El estado .is_held del fotograma anterior nos sirve para saber si es un pulso nuevo
|
||||||
binding.second.just_pressed = binding.second.just_pressed || (key_is_down_now && !binding.second.is_held);
|
binding.second.just_pressed = key_is_down_now && !binding.second.is_held;
|
||||||
binding.second.is_held = key_is_down_now;
|
binding.second.is_held = key_is_down_now;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,16 +367,6 @@ void Input::update() {
|
|||||||
|
|
||||||
auto Input::handleEvent(const SDL_Event& event) -> std::string {
|
auto Input::handleEvent(const SDL_Event& event) -> std::string {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_EVENT_KEY_DOWN:
|
|
||||||
if (!event.key.repeat) {
|
|
||||||
for (auto& [action, binding] : keyboard_.bindings) {
|
|
||||||
if (binding.scancode == event.key.scancode) {
|
|
||||||
binding.just_pressed = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SDL_EVENT_GAMEPAD_ADDED:
|
case SDL_EVENT_GAMEPAD_ADDED:
|
||||||
return addGamepad(event.gdevice.which);
|
return addGamepad(event.gdevice.which);
|
||||||
case SDL_EVENT_GAMEPAD_REMOVED:
|
case SDL_EVENT_GAMEPAD_REMOVED:
|
||||||
|
|||||||
@@ -177,7 +177,6 @@ class Input {
|
|||||||
|
|
||||||
// --- Métodos de reseteo de estado de entrada ---
|
// --- Métodos de reseteo de estado de entrada ---
|
||||||
void resetInputStates();
|
void resetInputStates();
|
||||||
void resetJustPressed();
|
|
||||||
|
|
||||||
// --- Eventos ---
|
// --- Eventos ---
|
||||||
auto handleEvent(const SDL_Event& event) -> std::string;
|
auto handleEvent(const SDL_Event& event) -> std::string;
|
||||||
|
|||||||
@@ -1128,7 +1128,6 @@ auto Game::allPlayersAreNotPlaying() -> bool {
|
|||||||
|
|
||||||
// Comprueba los eventos que hay en cola
|
// Comprueba los eventos que hay en cola
|
||||||
void Game::handleEvents() {
|
void Game::handleEvents() {
|
||||||
input_->resetJustPressed();
|
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
while (SDL_PollEvent(&event)) {
|
while (SDL_PollEvent(&event)) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
|
|||||||
@@ -57,10 +57,21 @@ void Intro::checkInput() {
|
|||||||
|
|
||||||
// Actualiza las escenas de la intro
|
// Actualiza las escenas de la intro
|
||||||
void Intro::updateScenes() {
|
void Intro::updateScenes() {
|
||||||
// Cuando la tarjeta actual toca la mesa por primera vez, la anterior sale despedida
|
// Sonido al lanzar la tarjeta (enable() devuelve true solo la primera vez)
|
||||||
if (scene_ > 0 && card_sprites_.at(scene_)->hasFirstTouch()) {
|
if (card_sprites_.at(scene_)->enable()) {
|
||||||
|
Audio::get()->playSound(SFX_CARD_THROW);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cuando la tarjeta actual toca la mesa por primera vez: shake + sonido + la anterior sale despedida
|
||||||
|
if (!shake_done_ && card_sprites_.at(scene_)->hasFirstTouch()) {
|
||||||
|
Screen::get()->shake();
|
||||||
|
Audio::get()->playSound(SFX_CARD_IMPACT);
|
||||||
|
shake_done_ = true;
|
||||||
|
|
||||||
|
if (scene_ > 0) {
|
||||||
card_sprites_.at(scene_ - 1)->startExit();
|
card_sprites_.at(scene_ - 1)->startExit();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (scene_) {
|
switch (scene_) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -87,9 +98,6 @@ void Intro::updateScenes() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Intro::updateScene0() {
|
void Intro::updateScene0() {
|
||||||
// Primera imagen - UPV: activa la tarjeta
|
|
||||||
card_sprites_.at(0)->enable();
|
|
||||||
|
|
||||||
// Primer texto cuando aterriza
|
// Primer texto cuando aterriza
|
||||||
if (card_sprites_.at(0)->hasLanded() && !texts_.at(0)->hasFinished()) {
|
if (card_sprites_.at(0)->hasLanded() && !texts_.at(0)->hasFinished()) {
|
||||||
texts_.at(0)->setEnabled(true);
|
texts_.at(0)->setEnabled(true);
|
||||||
@@ -109,13 +117,11 @@ void Intro::updateScene0() {
|
|||||||
if (texts_.at(2)->hasFinished()) {
|
if (texts_.at(2)->hasFinished()) {
|
||||||
texts_.at(2)->setEnabled(false);
|
texts_.at(2)->setEnabled(false);
|
||||||
scene_++;
|
scene_++;
|
||||||
|
shake_done_ = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Intro::updateScene1() {
|
void Intro::updateScene1() {
|
||||||
// Segunda imagen - Máquina
|
|
||||||
card_sprites_.at(1)->enable();
|
|
||||||
|
|
||||||
// Texto cuando aterriza
|
// Texto cuando aterriza
|
||||||
if (card_sprites_.at(1)->hasLanded() && !texts_.at(3)->hasFinished()) {
|
if (card_sprites_.at(1)->hasLanded() && !texts_.at(3)->hasFinished()) {
|
||||||
texts_.at(3)->setEnabled(true);
|
texts_.at(3)->setEnabled(true);
|
||||||
@@ -125,12 +131,12 @@ void Intro::updateScene1() {
|
|||||||
if (texts_.at(3)->hasFinished()) {
|
if (texts_.at(3)->hasFinished()) {
|
||||||
texts_.at(3)->setEnabled(false);
|
texts_.at(3)->setEnabled(false);
|
||||||
scene_++;
|
scene_++;
|
||||||
|
shake_done_ = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Intro::updateScene2() {
|
void Intro::updateScene2() {
|
||||||
// Tercera imagen - GRITO: tarjeta y texto a la vez
|
// Tercera imagen - GRITO: tarjeta y texto a la vez
|
||||||
card_sprites_.at(2)->enable();
|
|
||||||
if (!texts_.at(4)->hasFinished()) {
|
if (!texts_.at(4)->hasFinished()) {
|
||||||
texts_.at(4)->setEnabled(true);
|
texts_.at(4)->setEnabled(true);
|
||||||
}
|
}
|
||||||
@@ -139,13 +145,12 @@ void Intro::updateScene2() {
|
|||||||
if (card_sprites_.at(2)->hasLanded() && texts_.at(4)->hasFinished()) {
|
if (card_sprites_.at(2)->hasLanded() && texts_.at(4)->hasFinished()) {
|
||||||
texts_.at(4)->setEnabled(false);
|
texts_.at(4)->setEnabled(false);
|
||||||
scene_++;
|
scene_++;
|
||||||
|
shake_done_ = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Intro::updateScene3() {
|
void Intro::updateScene3() {
|
||||||
// Cuarta imagen - Reflexión
|
// Cuarta imagen - Reflexión
|
||||||
card_sprites_.at(3)->enable();
|
|
||||||
|
|
||||||
if (!texts_.at(5)->hasFinished()) {
|
if (!texts_.at(5)->hasFinished()) {
|
||||||
texts_.at(5)->setEnabled(true);
|
texts_.at(5)->setEnabled(true);
|
||||||
}
|
}
|
||||||
@@ -159,13 +164,12 @@ void Intro::updateScene3() {
|
|||||||
if (card_sprites_.at(3)->hasLanded() && texts_.at(6)->hasFinished()) {
|
if (card_sprites_.at(3)->hasLanded() && texts_.at(6)->hasFinished()) {
|
||||||
texts_.at(6)->setEnabled(false);
|
texts_.at(6)->setEnabled(false);
|
||||||
scene_++;
|
scene_++;
|
||||||
|
shake_done_ = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Intro::updateScene4() {
|
void Intro::updateScene4() {
|
||||||
// Quinta imagen - Patada
|
// Quinta imagen - Patada
|
||||||
card_sprites_.at(4)->enable();
|
|
||||||
|
|
||||||
if (!texts_.at(7)->hasFinished()) {
|
if (!texts_.at(7)->hasFinished()) {
|
||||||
texts_.at(7)->setEnabled(true);
|
texts_.at(7)->setEnabled(true);
|
||||||
}
|
}
|
||||||
@@ -174,13 +178,12 @@ void Intro::updateScene4() {
|
|||||||
if (card_sprites_.at(4)->hasLanded() && texts_.at(7)->hasFinished()) {
|
if (card_sprites_.at(4)->hasLanded() && texts_.at(7)->hasFinished()) {
|
||||||
texts_.at(7)->setEnabled(false);
|
texts_.at(7)->setEnabled(false);
|
||||||
scene_++;
|
scene_++;
|
||||||
|
shake_done_ = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Intro::updateScene5() {
|
void Intro::updateScene5() {
|
||||||
// Sexta imagen - Globos de café
|
// Sexta imagen - Globos de café
|
||||||
card_sprites_.at(5)->enable();
|
|
||||||
|
|
||||||
if (!texts_.at(8)->hasFinished()) {
|
if (!texts_.at(8)->hasFinished()) {
|
||||||
texts_.at(8)->setEnabled(true);
|
texts_.at(8)->setEnabled(true);
|
||||||
}
|
}
|
||||||
@@ -213,6 +216,11 @@ void Intro::update(float delta_time) {
|
|||||||
|
|
||||||
switch (state_) {
|
switch (state_) {
|
||||||
case State::SCENES:
|
case State::SCENES:
|
||||||
|
// Pausa inicial antes de empezar
|
||||||
|
if (initial_elapsed_ < INITIAL_DELAY_S) {
|
||||||
|
initial_elapsed_ += delta_time;
|
||||||
|
break;
|
||||||
|
}
|
||||||
updateSprites(delta_time);
|
updateSprites(delta_time);
|
||||||
updateTexts(delta_time);
|
updateTexts(delta_time);
|
||||||
updateScenes();
|
updateScenes();
|
||||||
@@ -408,6 +416,11 @@ void Intro::initSprites() {
|
|||||||
// Límites de pantalla
|
// Límites de pantalla
|
||||||
card->setScreenBounds(param.game.width, param.game.height);
|
card->setScreenBounds(param.game.width, param.game.height);
|
||||||
|
|
||||||
|
// Última tarjeta: gana algo de altura al salir (se la lleva el viento)
|
||||||
|
if (i == TOTAL_SPRITES - 1) {
|
||||||
|
card->setExitLift(1.2F, 0.15F); // Hasta zoom 1.2, a 0.15/s
|
||||||
|
}
|
||||||
|
|
||||||
card_sprites_.push_back(std::move(card));
|
card_sprites_.push_back(std::move(card));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,11 @@ class Intro {
|
|||||||
static constexpr float TEXT_DISPLAY_DURATION_S = 3.0F; // Duración de visualización de texto
|
static constexpr float TEXT_DISPLAY_DURATION_S = 3.0F; // Duración de visualización de texto
|
||||||
static constexpr float POST_BG_STOP_DELAY_S = 1.0F; // Retraso antes de detener el fondo
|
static constexpr float POST_BG_STOP_DELAY_S = 1.0F; // Retraso antes de detener el fondo
|
||||||
static constexpr float POST_END_DELAY_S = 1.0F; // Retraso antes de finalizar intro
|
static constexpr float POST_END_DELAY_S = 1.0F; // Retraso antes de finalizar intro
|
||||||
|
static constexpr float INITIAL_DELAY_S = 2.0F; // Pausa antes de empezar las escenas
|
||||||
|
|
||||||
|
// --- Constantes de sonido ---
|
||||||
|
static constexpr const char* SFX_CARD_THROW = "service_menu_select.wav"; // Sonido al lanzar una tarjeta
|
||||||
|
static constexpr const char* SFX_CARD_IMPACT = "player_collision.wav"; // Sonido al impactar en la mesa
|
||||||
|
|
||||||
// --- Constantes de layout ---
|
// --- Constantes de layout ---
|
||||||
static constexpr float CARD_BORDER_SIZE = 2.0F; // Tamaño del borde de tarjetas
|
static constexpr float CARD_BORDER_SIZE = 2.0F; // Tamaño del borde de tarjetas
|
||||||
@@ -92,6 +97,8 @@ class Intro {
|
|||||||
PostState post_state_ = PostState::STOP_BG; // Estado POST
|
PostState post_state_ = PostState::STOP_BG; // Estado POST
|
||||||
float state_start_time_ = 0.0F; // Tiempo de inicio del estado actual (segundos)
|
float state_start_time_ = 0.0F; // Tiempo de inicio del estado actual (segundos)
|
||||||
Color bg_color_ = param.intro.bg_color; // Color de fondo
|
Color bg_color_ = param.intro.bg_color; // Color de fondo
|
||||||
|
bool shake_done_ = false; // Evita shake repetido en la misma escena
|
||||||
|
float initial_elapsed_ = 0.0F; // Tiempo acumulado antes de empezar
|
||||||
|
|
||||||
// --- Métodos internos ---
|
// --- Métodos internos ---
|
||||||
void update(float delta_time); // Actualiza las variables del objeto
|
void update(float delta_time); // Actualiza las variables del objeto
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
CXX := g++
|
CXX := g++
|
||||||
CXXFLAGS := -std=c++20 -Wall -Os -I../../
|
CXXFLAGS := -std=c++20 -Wall -Os
|
||||||
SOURCES := pack_resources.cpp ../../source/resource_pack.cpp
|
SOURCES := pack_resources.cpp ../../source/resource_pack.cpp
|
||||||
TARGET := pack_resources
|
TARGET := pack_resources
|
||||||
CLEAN_FILES := pack_resources *.pack *.o
|
CLEAN_FILES := pack_resources *.pack *.o
|
||||||
@@ -21,7 +21,7 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# Reglas principales
|
# Reglas principales
|
||||||
.PHONY: all pack_tool clean help test_pack
|
.PHONY: all pack_tool pack clean help test_pack
|
||||||
|
|
||||||
# Compilar herramienta de empaquetado
|
# Compilar herramienta de empaquetado
|
||||||
all: pack_tool
|
all: pack_tool
|
||||||
@@ -37,6 +37,14 @@ clean:
|
|||||||
$(CLEAN_CMD) $(call FixPath,$(CLEAN_FILES))
|
$(CLEAN_CMD) $(call FixPath,$(CLEAN_FILES))
|
||||||
@echo "✓ Archivos limpiados"
|
@echo "✓ Archivos limpiados"
|
||||||
|
|
||||||
|
# Crear pack de recursos final (invocado desde Makefile raíz)
|
||||||
|
pack: pack_tool
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
.\$(TARGET) ..\..\data ..\..\resources.pack
|
||||||
|
else
|
||||||
|
./$(TARGET) ../../data ../../resources.pack
|
||||||
|
endif
|
||||||
|
|
||||||
# Crear pack de recursos de prueba
|
# Crear pack de recursos de prueba
|
||||||
test_pack: pack_tool
|
test_pack: pack_tool
|
||||||
@echo "Creando pack de recursos de prueba..."
|
@echo "Creando pack de recursos de prueba..."
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "../source/resource_pack.hpp"
|
#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>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user