- actualització masiva de CLAUDE.md
- pujat a versió 1.13
This commit is contained in:
154
CLAUDE.md
154
CLAUDE.md
@@ -53,7 +53,7 @@ cmake --build build --clean-first
|
||||
./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)
|
||||
|
||||
@@ -67,17 +67,12 @@ sudo apt-get install xvfb
|
||||
|
||||
#### Running the Game in Headless Mode
|
||||
|
||||
**Option 1: Using the wrapper script (RECOMMENDED)**
|
||||
```bash
|
||||
./run_headless.sh
|
||||
```
|
||||
|
||||
**Option 2: Using xvfb-run directly**
|
||||
**Option 1: Using xvfb-run directly (RECOMMENDED)**
|
||||
```bash
|
||||
xvfb-run -a ./jaildoctors_dilemma
|
||||
```
|
||||
|
||||
**Option 3: Custom display configuration**
|
||||
**Option 2: Custom display configuration**
|
||||
```bash
|
||||
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/
|
||||
├── core/ # Core engine systems
|
||||
│ ├── 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.hpp/cpp # Input manager (keyboard, gamepad)
|
||||
│ │ ├── input_types.hpp # Input type definitions
|
||||
│ │ ├── global_inputs.hpp # Global input state
|
||||
│ │ └── mouse.hpp # Mouse input
|
||||
│ ├── locale/ # Localization
|
||||
│ │ └── locale.hpp # Locale/language support
|
||||
│ ├── rendering/ # Graphics rendering
|
||||
│ │ ├── screen.hpp/cpp # Screen/window singleton, SDL renderer
|
||||
│ │ ├── surface.hpp/cpp # 8-bit indexed color surface abstraction
|
||||
│ │ ├── surface_sprite.hpp # Static sprite rendering
|
||||
│ │ ├── surface_animated_sprite.hpp # Animated sprite with frame data
|
||||
│ │ ├── surface_moving_sprite.hpp # Moving sprite with velocity
|
||||
│ │ ├── texture.hpp/cpp # SDL texture wrapper
|
||||
│ │ ├── sprite/ # Sprite rendering classes
|
||||
│ │ │ ├── sprite.hpp # Static sprite rendering
|
||||
│ │ │ ├── animated_sprite.hpp # Animated sprite with frame data
|
||||
│ │ │ ├── moving_sprite.hpp # Moving sprite with velocity
|
||||
│ │ │ └── dissolve_sprite.hpp # Dissolve transition sprite
|
||||
│ │ ├── text.hpp/cpp # Text rendering system
|
||||
│ │ ├── gif.hpp/cpp # GIF image loader
|
||||
│ │ ├── opengl/ # OpenGL shader backend
|
||||
│ │ │ └── opengl_shader.hpp/cpp # CRT shader effects
|
||||
│ │ ├── pixel_reveal.hpp # Pixel reveal effect
|
||||
│ │ ├── 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
|
||||
│ ├── resources/ # Asset & Resource management
|
||||
│ │ ├── asset.hpp/cpp # Asset registry (file path mapping)
|
||||
│ │ └── resource.hpp/cpp # Resource singleton (loads/caches assets)
|
||||
│ │ ├── resource_list.hpp # Asset path registry (O(1) lookups)
|
||||
│ │ ├── 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
|
||||
│ ├── director.hpp/cpp # Main application controller
|
||||
│ ├── debug.hpp/cpp # Debug info overlay
|
||||
@@ -268,8 +276,13 @@ source/
|
||||
│ │ ├── enemy.hpp/cpp # Enemy entities
|
||||
│ │ └── item.hpp/cpp # Collectible items
|
||||
│ ├── 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
|
||||
│ │ ├── 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
|
||||
│ │ ├── item_tracker.hpp/cpp # Tracks collected items
|
||||
│ │ ├── stats.hpp/cpp # Game statistics
|
||||
@@ -284,18 +297,20 @@ source/
|
||||
│ │ ├── ending2.hpp/cpp # Ending sequence 2
|
||||
│ │ └── credits.hpp/cpp # Credits screen
|
||||
│ ├── 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
|
||||
│ ├── game_control.hpp # Game control logic
|
||||
│ ├── scene_manager.hpp # Scene flow state machine
|
||||
│ ├── defaults.hpp # Game defaults constants
|
||||
│ └── gameplay.hpp # Gameplay constants
|
||||
│ └── defaults.hpp # Game defaults constants
|
||||
├── external/ # Third-party libraries
|
||||
│ ├── jail_audio.hpp/cpp # Custom audio library
|
||||
│ ├── jail_audio.h # C interface for jail_audio
|
||||
│ ├── fkyaml_node.hpp # YAML parsing library
|
||||
│ ├── stb_image.h # Image loading library
|
||||
│ └── stb_vorbis.h # OGG Vorbis audio decoding
|
||||
├── utils/ # Utility code
|
||||
│ ├── delta_timer.hpp/cpp # Frame-rate independent timing
|
||||
│ ├── easing_functions.hpp # Easing/interpolation functions
|
||||
│ ├── defines.hpp # Game constants (resolutions, block sizes)
|
||||
│ └── utils.hpp/cpp # Helper functions (colors, math)
|
||||
└── main.cpp # Application entry point
|
||||
@@ -360,7 +375,7 @@ The game uses a scene manager to control application flow:
|
||||
// namespace SceneManager
|
||||
enum class Scene {
|
||||
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
|
||||
@@ -397,9 +412,10 @@ Display
|
||||
|
||||
**Key Components:**
|
||||
- `Surface` - 8-bit indexed pixel buffer with palette support
|
||||
- `SurfaceSprite` - Renders a fixed region of a surface
|
||||
- `SurfaceAnimatedSprite` - Frame-based animation on top of sprite
|
||||
- `SurfaceMovingSprite` - Adds velocity/position to animated sprite
|
||||
- `Sprite` - Renders a fixed region of a surface
|
||||
- `AnimatedSprite` - Frame-based animation on top of sprite
|
||||
- `MovingSprite` - Adds velocity/position to animated sprite
|
||||
- `DissolveSprite` - Dissolve transition effect sprite
|
||||
- Supports color replacement, palette swapping, and shader effects (CRT)
|
||||
|
||||
### 3.5 Tile-Based Collision System
|
||||
@@ -439,8 +455,8 @@ struct AnimationData {
|
||||
int counter;
|
||||
};
|
||||
|
||||
// Loaded from .ani files (list of animation names)
|
||||
// Rendered with SurfaceAnimatedSprite
|
||||
// Loaded from .yaml animation definition files
|
||||
// Rendered with AnimatedSprite
|
||||
```
|
||||
|
||||
---
|
||||
@@ -454,7 +470,7 @@ main()
|
||||
↓
|
||||
Director::Director() [Initialization]
|
||||
├─ 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
|
||||
├─ Audio::init() - Initialize SDL audio
|
||||
├─ Screen::init() - Create window, SDL renderer
|
||||
@@ -510,7 +526,7 @@ Game::run() {
|
||||
|
||||
```
|
||||
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
|
||||
├─ Parse YAML structure: assets grouped by category
|
||||
├─ Replace variables (${PREFIX}, ${SYSTEM_FOLDER})
|
||||
@@ -570,7 +586,7 @@ Game code
|
||||
|
||||
**Classes:**
|
||||
- `PascalCase` for classes: `Player`, `Room`, `Screen`, `Director`
|
||||
- Suffix `Sprite` for sprite classes: `SurfaceSprite`, `SurfaceAnimatedSprite`
|
||||
- Suffix `Sprite` for sprite classes: `Sprite`, `AnimatedSprite`, `MovingSprite`
|
||||
|
||||
**Methods:**
|
||||
- `get*()` for getters: `getWidth()`, `getRect()`
|
||||
@@ -613,8 +629,9 @@ Provides **time scaling** for slow-motion effects.
|
||||
### 5.4 Palette System
|
||||
|
||||
- 8-bit indexed color (256 colors per palette)
|
||||
- Multiple palettes can be loaded and swapped
|
||||
- `Surface::setPalette()` changes rendering colors
|
||||
- Multiple palettes can be loaded and swapped via `PaletteManager`
|
||||
- `Screen::setPaletteByName()` changes the active palette
|
||||
- Supports palette sort modes (by luminosity, similarity to Spectrum palette, etc.)
|
||||
- Supports color replacement per-render: `renderWithColorReplace()`
|
||||
- CRT shader effects can modify colors in real-time
|
||||
|
||||
@@ -664,7 +681,7 @@ Achievements trigger notifications on unlock.
|
||||
| Component | Technology | Version | Role |
|
||||
|-----------|-----------|---------|------|
|
||||
| **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 Decoding** | jail_audio (custom) | 1.x | OGG/WAV playback |
|
||||
| **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 |
|
||||
| `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 |
|
||||
| `PaletteManager` | Palette loading, switching, and sorting | Managed by Screen |
|
||||
| `Debug` | Debug overlay information | Singleton |
|
||||
| `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 |
|
||||
| `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 |
|
||||
| `Item` | Collectible items |
|
||||
| `Scoreboard` | HUD display data |
|
||||
@@ -722,17 +745,20 @@ Achievements trigger notifications on unlock.
|
||||
| Class | Purpose |
|
||||
|-------|---------|
|
||||
| `Surface` | 8-bit indexed color pixel buffer with palette |
|
||||
| `SurfaceSprite` | Renders a sprite region |
|
||||
| `SurfaceAnimatedSprite` | Frame-based animation rendering |
|
||||
| `SurfaceMovingSprite` | Sprite with velocity/position |
|
||||
| `Sprite` | Renders a sprite region |
|
||||
| `AnimatedSprite` | Frame-based animation rendering |
|
||||
| `MovingSprite` | Sprite with velocity/position |
|
||||
| `DissolveSprite` | Dissolve transition sprite |
|
||||
| `Text` | Text rendering system |
|
||||
| `OpenGLShader` | Shader compilation and effects |
|
||||
| `Sdl3gpuShader` | SDL3 GPU shader compilation and effects |
|
||||
| `PaletteManager` | Palette loading and management |
|
||||
|
||||
### Utility Classes
|
||||
|
||||
| Class | Purpose |
|
||||
| Class/Header | Purpose |
|
||||
|-------|---------|
|
||||
| `DeltaTimer` | Frame-rate independent timing |
|
||||
| `easing_functions.hpp` | Easing/interpolation functions for animations |
|
||||
|
||||
---
|
||||
|
||||
@@ -848,7 +874,7 @@ assets:
|
||||
- type: BITMAP
|
||||
path: ${PREFIX}/data/font/smb2.gif
|
||||
- type: FONT
|
||||
path: ${PREFIX}/data/font/smb2.txt
|
||||
path: ${PREFIX}/data/font/smb2.fnt
|
||||
|
||||
# PLAYER
|
||||
player:
|
||||
@@ -892,23 +918,26 @@ assets:
|
||||
- `${PREFIX}` - Replaced with `/../Resources` on macOS bundles, empty otherwise
|
||||
- `${SYSTEM_FOLDER}` - Replaced with user's system config folder
|
||||
|
||||
### Animation Files (.ani)
|
||||
List of animation names, one per line:
|
||||
```
|
||||
default
|
||||
jump
|
||||
run
|
||||
fall
|
||||
### Animation Files (.yaml)
|
||||
YAML-based animation definitions with frame data:
|
||||
```yaml
|
||||
animations:
|
||||
- name: default
|
||||
frameWidth: 16
|
||||
frameHeight: 16
|
||||
speed: 100
|
||||
loop: 0
|
||||
frames: [...]
|
||||
```
|
||||
|
||||
### Room Data Files (.room)
|
||||
Key-value pairs defining room properties:
|
||||
```
|
||||
number=01
|
||||
name=Starting Room
|
||||
bg_color=0x000000
|
||||
border_color=0xFF00FF
|
||||
...
|
||||
### Room Data Files (.yaml)
|
||||
YAML-based room definitions:
|
||||
```yaml
|
||||
room:
|
||||
name_en: Starting Room
|
||||
bgColor: 0x000000
|
||||
connections: [...]
|
||||
tilemap: [...]
|
||||
```
|
||||
|
||||
### Tilemap Files (.tmx)
|
||||
@@ -923,7 +952,8 @@ Binary 256-color palette format (256 × 4 bytes RGBA).
|
||||
|
||||
### For Graphics Issues
|
||||
- `Screen::render()` - Main rendering method
|
||||
- `Screen::setPalete()` - Palette application
|
||||
- `Screen::setPaletteByName()` - Palette switching
|
||||
- `PaletteManager` - Palette loading and sorting
|
||||
- `Surface` class - Pixel buffer operations
|
||||
|
||||
### For Input Issues
|
||||
@@ -942,10 +972,10 @@ Binary 256-color palette format (256 × 4 bytes RGBA).
|
||||
|
||||
### For Asset Management
|
||||
- `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::load()` - Asset loading
|
||||
- `Director::setFileList()` - Calls `Asset::loadFromFile()` with PREFIX and system_folder
|
||||
- `Resource::Cache` - Asset loading and caching
|
||||
- `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
|
||||
**Repository:** Gitea (internal)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
namespace Texts {
|
||||
constexpr const char* WINDOW_CAPTION = "© 2022 JailDoctor's Dilemma — 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
|
||||
|
||||
// Tamaño de bloque
|
||||
|
||||
Reference in New Issue
Block a user