- actualització masiva de CLAUDE.md

- pujat a versió 1.13
This commit is contained in:
2026-04-02 09:20:27 +02:00
parent 405f2248ec
commit 0bfb535d4d
2 changed files with 93 additions and 63 deletions

154
CLAUDE.md
View File

@@ -53,7 +53,7 @@ cmake --build build --clean-first
./jaildoctors_dilemma ./jaildoctors_dilemma
``` ```
**Important:** The build directory is `/Users/sergio/Gitea/jaildoctors_dilemma/build` and the output executable is placed in the project root directory. **Important:** The build directory is `build/` relative to the project root and the output executable is placed in the project root directory.
### Testing in Headless Environment (SSH/Remote Server) ### Testing in Headless Environment (SSH/Remote Server)
@@ -67,17 +67,12 @@ sudo apt-get install xvfb
#### Running the Game in Headless Mode #### Running the Game in Headless Mode
**Option 1: Using the wrapper script (RECOMMENDED)** **Option 1: Using xvfb-run directly (RECOMMENDED)**
```bash
./run_headless.sh
```
**Option 2: Using xvfb-run directly**
```bash ```bash
xvfb-run -a ./jaildoctors_dilemma xvfb-run -a ./jaildoctors_dilemma
``` ```
**Option 3: Custom display configuration** **Option 2: Custom display configuration**
```bash ```bash
xvfb-run -a -s "-screen 0 1280x720x24" ./jaildoctors_dilemma xvfb-run -a -s "-screen 0 1280x720x24" ./jaildoctors_dilemma
``` ```
@@ -238,26 +233,39 @@ The architecture follows a **layered, modular design** with clear separation of
source/ source/
├── core/ # Core engine systems ├── core/ # Core engine systems
│ ├── audio/ # Audio management │ ├── audio/ # Audio management
│ │ ── audio.hpp/cpp # Audio singleton (music, sounds, volumes) │ │ ── audio.hpp/cpp # Audio singleton (music, sounds, volumes)
│ │ └── jail_audio.hpp # Custom jail_audio library wrapper
│ ├── input/ # Input handling │ ├── input/ # Input handling
│ │ ├── input.hpp/cpp # Input manager (keyboard, gamepad) │ │ ├── input.hpp/cpp # Input manager (keyboard, gamepad)
│ │ ├── input_types.hpp # Input type definitions
│ │ ├── global_inputs.hpp # Global input state │ │ ├── global_inputs.hpp # Global input state
│ │ └── mouse.hpp # Mouse input │ │ └── mouse.hpp # Mouse input
│ ├── locale/ # Localization
│ │ └── locale.hpp # Locale/language support
│ ├── rendering/ # Graphics rendering │ ├── rendering/ # Graphics rendering
│ │ ├── screen.hpp/cpp # Screen/window singleton, SDL renderer │ │ ├── screen.hpp/cpp # Screen/window singleton, SDL renderer
│ │ ├── surface.hpp/cpp # 8-bit indexed color surface abstraction │ │ ├── surface.hpp/cpp # 8-bit indexed color surface abstraction
│ │ ├── surface_sprite.hpp # Static sprite rendering │ │ ├── sprite/ # Sprite rendering classes
│ │ ├── surface_animated_sprite.hpp # Animated sprite with frame data │ │ ├── sprite.hpp # Static sprite rendering
│ │ ├── surface_moving_sprite.hpp # Moving sprite with velocity │ │ │ ├── animated_sprite.hpp # Animated sprite with frame data
│ │ ├── texture.hpp/cpp # SDL texture wrapper │ │ │ ├── moving_sprite.hpp # Moving sprite with velocity
│ │ │ └── dissolve_sprite.hpp # Dissolve transition sprite
│ │ ├── text.hpp/cpp # Text rendering system │ │ ├── text.hpp/cpp # Text rendering system
│ │ ├── gif.hpp/cpp # GIF image loader │ │ ├── gif.hpp/cpp # GIF image loader
│ │ ├── opengl/ # OpenGL shader backend │ │ ├── pixel_reveal.hpp # Pixel reveal effect
│ │ │ └── opengl_shader.hpp/cpp # CRT shader effects │ │ ├── render_info.hpp # Render information data
│ │ ├── palette_manager.hpp # Palette management
│ │ ├── sdl3gpu/ # SDL3 GPU shader backend
│ │ │ ├── sdl3gpu_shader.hpp/cpp # CRT/post-processing shader effects
│ │ │ └── *_spv.h # Pre-compiled SPIR-V shader headers
│ │ └── shader_backend.hpp # Abstract shader interface │ │ └── shader_backend.hpp # Abstract shader interface
│ ├── resources/ # Asset & Resource management │ ├── resources/ # Asset & Resource management
│ │ ├── asset.hpp/cpp # Asset registry (file path mapping) │ │ ├── resource_list.hpp # Asset path registry (O(1) lookups)
│ │ ── resource.hpp/cpp # Resource singleton (loads/caches assets) │ │ ── resource_cache.hpp # Resource caching singleton
│ │ ├── resource_loader.hpp # Asset loading logic
│ │ ├── resource_pack.hpp # Resource pack handling
│ │ ├── resource_helper.hpp # Resource utility functions
│ │ └── resource_types.hpp # Resource type definitions
│ └── system/ # System management │ └── system/ # System management
│ ├── director.hpp/cpp # Main application controller │ ├── director.hpp/cpp # Main application controller
│ ├── debug.hpp/cpp # Debug info overlay │ ├── debug.hpp/cpp # Debug info overlay
@@ -268,8 +276,13 @@ source/
│ │ ├── enemy.hpp/cpp # Enemy entities │ │ ├── enemy.hpp/cpp # Enemy entities
│ │ └── item.hpp/cpp # Collectible items │ │ └── item.hpp/cpp # Collectible items
│ ├── gameplay/ # Core gameplay systems │ ├── gameplay/ # Core gameplay systems
│ │ ├── room.hpp/cpp # Room/level logic, tilemap, collision │ │ ├── room.hpp/cpp # Room/level logic, collision
│ │ ├── room_loader.hpp/cpp # Room loading from YAML files
│ │ ├── room_tracker.hpp/cpp # Tracks visited rooms │ │ ├── room_tracker.hpp/cpp # Tracks visited rooms
│ │ ├── collision_map.hpp/cpp # Collision map data
│ │ ├── tilemap_renderer.hpp/cpp # Tilemap rendering
│ │ ├── enemy_manager.hpp/cpp # Enemy lifecycle management
│ │ ├── item_manager.hpp/cpp # Item lifecycle management
│ │ ├── scoreboard.hpp/cpp # Score display & data │ │ ├── scoreboard.hpp/cpp # Score display & data
│ │ ├── item_tracker.hpp/cpp # Tracks collected items │ │ ├── item_tracker.hpp/cpp # Tracks collected items
│ │ ├── stats.hpp/cpp # Game statistics │ │ ├── stats.hpp/cpp # Game statistics
@@ -284,18 +297,20 @@ source/
│ │ ├── ending2.hpp/cpp # Ending sequence 2 │ │ ├── ending2.hpp/cpp # Ending sequence 2
│ │ └── credits.hpp/cpp # Credits screen │ │ └── credits.hpp/cpp # Credits screen
│ ├── ui/ # User interface │ ├── ui/ # User interface
│ │ ── notifier.hpp/cpp # Achievement/notification display │ │ ── notifier.hpp/cpp # Achievement/notification display
│ │ ├── console.hpp/cpp # In-game debug console
│ │ └── console_commands.hpp/cpp # Console command definitions
│ ├── options.hpp/cpp # Game configuration/options │ ├── options.hpp/cpp # Game configuration/options
│ ├── game_control.hpp # Game control logic
│ ├── scene_manager.hpp # Scene flow state machine │ ├── scene_manager.hpp # Scene flow state machine
── defaults.hpp # Game defaults constants ── defaults.hpp # Game defaults constants
│ └── gameplay.hpp # Gameplay constants
├── external/ # Third-party libraries ├── external/ # Third-party libraries
│ ├── jail_audio.hpp/cpp # Custom audio library │ ├── fkyaml_node.hpp # YAML parsing library
│ ├── jail_audio.h # C interface for jail_audio
│ ├── stb_image.h # Image loading library │ ├── stb_image.h # Image loading library
│ └── stb_vorbis.h # OGG Vorbis audio decoding │ └── stb_vorbis.h # OGG Vorbis audio decoding
├── utils/ # Utility code ├── utils/ # Utility code
│ ├── delta_timer.hpp/cpp # Frame-rate independent timing │ ├── delta_timer.hpp/cpp # Frame-rate independent timing
│ ├── easing_functions.hpp # Easing/interpolation functions
│ ├── defines.hpp # Game constants (resolutions, block sizes) │ ├── defines.hpp # Game constants (resolutions, block sizes)
│ └── utils.hpp/cpp # Helper functions (colors, math) │ └── utils.hpp/cpp # Helper functions (colors, math)
└── main.cpp # Application entry point └── main.cpp # Application entry point
@@ -360,7 +375,7 @@ The game uses a scene manager to control application flow:
// namespace SceneManager // namespace SceneManager
enum class Scene { enum class Scene {
LOGO, LOADING_SCREEN, TITLE, CREDITS, GAME, DEMO, LOGO, LOADING_SCREEN, TITLE, CREDITS, GAME, DEMO,
GAME_OVER, ENDING, ENDING2, QUIT GAME_OVER, ENDING, ENDING2, RESTART_CURRENT, QUIT
}; };
inline Scene current = Scene::LOGO; // Global scene state inline Scene current = Scene::LOGO; // Global scene state
@@ -397,9 +412,10 @@ Display
**Key Components:** **Key Components:**
- `Surface` - 8-bit indexed pixel buffer with palette support - `Surface` - 8-bit indexed pixel buffer with palette support
- `SurfaceSprite` - Renders a fixed region of a surface - `Sprite` - Renders a fixed region of a surface
- `SurfaceAnimatedSprite` - Frame-based animation on top of sprite - `AnimatedSprite` - Frame-based animation on top of sprite
- `SurfaceMovingSprite` - Adds velocity/position to animated sprite - `MovingSprite` - Adds velocity/position to animated sprite
- `DissolveSprite` - Dissolve transition effect sprite
- Supports color replacement, palette swapping, and shader effects (CRT) - Supports color replacement, palette swapping, and shader effects (CRT)
### 3.5 Tile-Based Collision System ### 3.5 Tile-Based Collision System
@@ -439,8 +455,8 @@ struct AnimationData {
int counter; int counter;
}; };
// Loaded from .ani files (list of animation names) // Loaded from .yaml animation definition files
// Rendered with SurfaceAnimatedSprite // Rendered with AnimatedSprite
``` ```
--- ---
@@ -454,7 +470,7 @@ main()
Director::Director() [Initialization] Director::Director() [Initialization]
├─ Resource::List::init() - Initialize asset registry singleton ├─ Resource::List::init() - Initialize asset registry singleton
├─ Director::setFileList() - Load assets.yaml configuration (no verification) ├─ Director::setFileList() - Load assets.yaml via Resource::List (no verification)
├─ Options::loadFromFile() - Load game configuration ├─ Options::loadFromFile() - Load game configuration
├─ Audio::init() - Initialize SDL audio ├─ Audio::init() - Initialize SDL audio
├─ Screen::init() - Create window, SDL renderer ├─ Screen::init() - Create window, SDL renderer
@@ -510,7 +526,7 @@ Game::run() {
``` ```
Director::setFileList() Director::setFileList()
└─ Asset::loadFromFile(config_path, PREFIX, system_folder_) └─ Resource::List::loadFromFile(config_path, PREFIX, system_folder_)
├─ Read config/assets.yaml - Parse text configuration file ├─ Read config/assets.yaml - Parse text configuration file
├─ Parse YAML structure: assets grouped by category ├─ Parse YAML structure: assets grouped by category
├─ Replace variables (${PREFIX}, ${SYSTEM_FOLDER}) ├─ Replace variables (${PREFIX}, ${SYSTEM_FOLDER})
@@ -570,7 +586,7 @@ Game code
**Classes:** **Classes:**
- `PascalCase` for classes: `Player`, `Room`, `Screen`, `Director` - `PascalCase` for classes: `Player`, `Room`, `Screen`, `Director`
- Suffix `Sprite` for sprite classes: `SurfaceSprite`, `SurfaceAnimatedSprite` - Suffix `Sprite` for sprite classes: `Sprite`, `AnimatedSprite`, `MovingSprite`
**Methods:** **Methods:**
- `get*()` for getters: `getWidth()`, `getRect()` - `get*()` for getters: `getWidth()`, `getRect()`
@@ -613,8 +629,9 @@ Provides **time scaling** for slow-motion effects.
### 5.4 Palette System ### 5.4 Palette System
- 8-bit indexed color (256 colors per palette) - 8-bit indexed color (256 colors per palette)
- Multiple palettes can be loaded and swapped - Multiple palettes can be loaded and swapped via `PaletteManager`
- `Surface::setPalette()` changes rendering colors - `Screen::setPaletteByName()` changes the active palette
- Supports palette sort modes (by luminosity, similarity to Spectrum palette, etc.)
- Supports color replacement per-render: `renderWithColorReplace()` - Supports color replacement per-render: `renderWithColorReplace()`
- CRT shader effects can modify colors in real-time - CRT shader effects can modify colors in real-time
@@ -664,7 +681,7 @@ Achievements trigger notifications on unlock.
| Component | Technology | Version | Role | | Component | Technology | Version | Role |
|-----------|-----------|---------|------| |-----------|-----------|---------|------|
| **Graphics** | SDL3 | Latest | Window, rendering, input | | **Graphics** | SDL3 | Latest | Window, rendering, input |
| **GPU Rendering** | OpenGL | 3.2+ | Shader effects (CRT) | | **GPU Rendering** | SDL3 GPU | Latest | Shader effects (CRT, post-processing via SPIR-V) |
| **Audio** | SDL3 Audio | Latest | Audio device, mixing | | **Audio** | SDL3 Audio | Latest | Audio device, mixing |
| **Audio Decoding** | jail_audio (custom) | 1.x | OGG/WAV playback | | **Audio Decoding** | jail_audio (custom) | 1.x | OGG/WAV playback |
| **Image Loading** | stb_image | v2.x | PNG/GIF image loading | | **Image Loading** | stb_image | v2.x | PNG/GIF image loading |
@@ -700,6 +717,7 @@ Achievements trigger notifications on unlock.
| `Audio` | Music and SFX playback | Singleton | | `Audio` | Music and SFX playback | Singleton |
| `Resource::Cache` | Asset caching and loading (with detailed error messages) | Singleton | | `Resource::Cache` | Asset caching and loading (with detailed error messages) | Singleton |
| `Resource::List` | Asset path registry from config/assets.yaml, O(1) lookups, variable substitution | Singleton | | `Resource::List` | Asset path registry from config/assets.yaml, O(1) lookups, variable substitution | Singleton |
| `PaletteManager` | Palette loading, switching, and sorting | Managed by Screen |
| `Debug` | Debug overlay information | Singleton | | `Debug` | Debug overlay information | Singleton |
| `globalEvents` | Global SDL event handling (quit, device reset, mouse) | Namespace | | `globalEvents` | Global SDL event handling (quit, device reset, mouse) | Namespace |
@@ -709,7 +727,12 @@ Achievements trigger notifications on unlock.
|-------|---------| |-------|---------|
| `Game` | Main gameplay scene, orchestrates update/render | | `Game` | Main gameplay scene, orchestrates update/render |
| `Player` | Player entity with physics and animation | | `Player` | Player entity with physics and animation |
| `Room` | Level data, collision detection, tilemap rendering | | `Room` | Level data, collision detection |
| `RoomLoader` | Room loading from YAML files |
| `TilemapRenderer` | Tilemap rendering |
| `CollisionMap` | Collision map data |
| `EnemyManager` | Enemy lifecycle management |
| `ItemManager` | Item lifecycle management |
| `Enemy` | Enemy entity behavior and rendering | | `Enemy` | Enemy entity behavior and rendering |
| `Item` | Collectible items | | `Item` | Collectible items |
| `Scoreboard` | HUD display data | | `Scoreboard` | HUD display data |
@@ -722,17 +745,20 @@ Achievements trigger notifications on unlock.
| Class | Purpose | | Class | Purpose |
|-------|---------| |-------|---------|
| `Surface` | 8-bit indexed color pixel buffer with palette | | `Surface` | 8-bit indexed color pixel buffer with palette |
| `SurfaceSprite` | Renders a sprite region | | `Sprite` | Renders a sprite region |
| `SurfaceAnimatedSprite` | Frame-based animation rendering | | `AnimatedSprite` | Frame-based animation rendering |
| `SurfaceMovingSprite` | Sprite with velocity/position | | `MovingSprite` | Sprite with velocity/position |
| `DissolveSprite` | Dissolve transition sprite |
| `Text` | Text rendering system | | `Text` | Text rendering system |
| `OpenGLShader` | Shader compilation and effects | | `Sdl3gpuShader` | SDL3 GPU shader compilation and effects |
| `PaletteManager` | Palette loading and management |
### Utility Classes ### Utility Classes
| Class | Purpose | | Class/Header | Purpose |
|-------|---------| |-------|---------|
| `DeltaTimer` | Frame-rate independent timing | | `DeltaTimer` | Frame-rate independent timing |
| `easing_functions.hpp` | Easing/interpolation functions for animations |
--- ---
@@ -848,7 +874,7 @@ assets:
- type: BITMAP - type: BITMAP
path: ${PREFIX}/data/font/smb2.gif path: ${PREFIX}/data/font/smb2.gif
- type: FONT - type: FONT
path: ${PREFIX}/data/font/smb2.txt path: ${PREFIX}/data/font/smb2.fnt
# PLAYER # PLAYER
player: player:
@@ -892,23 +918,26 @@ assets:
- `${PREFIX}` - Replaced with `/../Resources` on macOS bundles, empty otherwise - `${PREFIX}` - Replaced with `/../Resources` on macOS bundles, empty otherwise
- `${SYSTEM_FOLDER}` - Replaced with user's system config folder - `${SYSTEM_FOLDER}` - Replaced with user's system config folder
### Animation Files (.ani) ### Animation Files (.yaml)
List of animation names, one per line: YAML-based animation definitions with frame data:
``` ```yaml
default animations:
jump - name: default
run frameWidth: 16
fall frameHeight: 16
speed: 100
loop: 0
frames: [...]
``` ```
### Room Data Files (.room) ### Room Data Files (.yaml)
Key-value pairs defining room properties: YAML-based room definitions:
``` ```yaml
number=01 room:
name=Starting Room name_en: Starting Room
bg_color=0x000000 bgColor: 0x000000
border_color=0xFF00FF connections: [...]
... tilemap: [...]
``` ```
### Tilemap Files (.tmx) ### Tilemap Files (.tmx)
@@ -923,7 +952,8 @@ Binary 256-color palette format (256 × 4 bytes RGBA).
### For Graphics Issues ### For Graphics Issues
- `Screen::render()` - Main rendering method - `Screen::render()` - Main rendering method
- `Screen::setPalete()` - Palette application - `Screen::setPaletteByName()` - Palette switching
- `PaletteManager` - Palette loading and sorting
- `Surface` class - Pixel buffer operations - `Surface` class - Pixel buffer operations
### For Input Issues ### For Input Issues
@@ -942,10 +972,10 @@ Binary 256-color palette format (256 × 4 bytes RGBA).
### For Asset Management ### For Asset Management
- `config/assets.yaml` - Asset configuration file (text-based, no recompilation needed) - `config/assets.yaml` - Asset configuration file (text-based, no recompilation needed)
- `Asset::loadFromFile()` - Loads assets from config file - `Resource::List::loadFromFile()` - Loads asset registry from config file
- `Resource::List::get()` - Retrieves asset path (O(1) lookup with unordered_map) - `Resource::List::get()` - Retrieves asset path (O(1) lookup with unordered_map)
- `Resource::load()` - Asset loading - `Resource::Cache` - Asset loading and caching
- `Director::setFileList()` - Calls `Asset::loadFromFile()` with PREFIX and system_folder - `Director::setFileList()` - Calls `Resource::List::loadFromFile()` with PREFIX and system_folder
--- ---
@@ -985,6 +1015,6 @@ Binary 256-color palette format (256 × 4 bytes RGBA).
--- ---
**Last Updated:** November 2022 (per README) **Last Updated:** April 2026
**Original Author:** JailDesigner **Original Author:** JailDesigner
**Repository:** Gitea (internal) **Repository:** Gitea (internal)

View File

@@ -6,7 +6,7 @@
namespace Texts { namespace Texts {
constexpr const char* WINDOW_CAPTION = "© 2022 JailDoctor's Dilemma — JailDesigner"; constexpr const char* WINDOW_CAPTION = "© 2022 JailDoctor's Dilemma — JailDesigner";
constexpr const char* COPYRIGHT = "@2022 JailDesigner"; constexpr const char* COPYRIGHT = "@2022 JailDesigner";
constexpr const char* VERSION = "1.12"; // Versión por defecto constexpr const char* VERSION = "1.13"; // Versión por defecto
} // namespace Texts } // namespace Texts
// Tamaño de bloque // Tamaño de bloque