> ## Documentation Index
> Fetch the complete documentation index at: https://epitech-f1becc07.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Assets Documentation

> Organization and management of assets in the R-Type project.

This page documents how **assets** are organized and managed in the **R-Type project**. Assets include graphical sprites, sound effects, animations, and fonts, which are essential for building an engaging game experience.

***

<AccordionGroup>
  ## Asset Organization

  <Accordion title="Folder Structure">
    All assets are stored in the root `assets/` folder, and they are divided into subdirectories to separate different types of assets:

    ### Folder Structure:

    ```plaintext theme={null}
    assets/
    ├── sprites/        # Sprite images (PNG)
    ├── sounds/         # Sound effects (WAV)
    ├── fonts/          # Font files (TTF)
    ├── shaders/        # Shader files (VERT)
    ├── animations/     # Animation configuration files
    └── others/         # Miscellaneous assets
    ```

    ### Explanation:

    * **`sprites/`**: Contains all images used as game sprites.
    * **`sounds/`**: Includes sound effects such as explosions, background music, and UI sounds.
    * **`fonts/`**: Stores font files required for rendering text.
    * **`shaders/`**: Contains vertex and fragment shader files for advanced rendering effects.
    * **`animations/`**: Configuration files that define animation frames, sprite sheets, and timings.
    * **`others/`**: Any other assets not covered by the above categories.
  </Accordion>
</AccordionGroup>

***

<AccordionGroup>
  ## Asset Loading and Management

  <Accordion title="How Assets Are Loaded">
    Assets are loaded at runtime by the graphical module through the `IDisplayModule` interface:

    1. **Sprites (PNG):**
       * Loaded using the `storeAssetsPNG` function, which reads the sprite file and prepares it for rendering.
       ```cpp theme={null}
       displayModule->storeAssetsPNG("assets/sprites/player.png");
       ```

    2. **Sound Effects (WAV):**
       * Managed with the `storeAssetsWAV` function to load and play sounds.
       ```cpp theme={null}
       displayModule->storeAssetsWAV("assets/sounds/explosion.wav");
       ```

    3. **Fonts (TTF):**
       * Loaded using the `storeAssetsTTF` function for text rendering.
       ```cpp theme={null}
       displayModule->storeAssetsTTF("assets/fonts/arial.ttf");
       ```

    4. **Animations:**
       * Configured with `configAssetsAnimations` to map sprite sheets and frame data.
       ```cpp theme={null}
       displayModule->configAssetsAnimations("assets/animations/player_animation.cfg");
       ```
  </Accordion>
</AccordionGroup>

***

## Best Practices for Asset Management

1. **Organize Assets**: Keep assets logically structured within subfolders to improve maintainability.
2. **Optimize File Sizes**: Use compressed images (PNG) and sound files (WAV) to reduce loading times.
3. **Avoid Redundancy**: Remove unused assets to minimize project size.
4. **Consistent Naming**: Use a clear and consistent naming convention for assets, such as:
   ```plaintext theme={null}
   player_idle.png
   player_run.png
   explosion.wav
   arial.ttf
   ```
5. **Centralize Configuration**: Store animation configurations in dedicated files to simplify updates.

***

## Conclusion

The **`assets/`** folder is the centralized location for managing all game-related assets. With clear organization and runtime loading through the `IDisplayModule` interface, the R-Type project ensures an efficient and scalable approach to asset management.

***
