Skip to content

Render textures on walls #13

Closed
Closed

Description

@Melow-code
No description provided.

Activity

  1. added this to the Mandatory milestone on Nov 4, 2026
  2. added
    render
    on Nov 4, 2026
  3. self-assigned this
    on Nov 7, 2026
  4. SailMasterG commented on Nov 7, 2026

    @SailMasterG
    Collaborator

    Español

    Descripción

    Mostrar una textura de pared correctamente dentro de la imagen del juego, usando las texturas cargadas desde MiniLibX.

    Contexto

    El subject exige que cada pared muestre una textura distinta según la cara que mira (Norte, Sur, Este, Oeste). Las rutas de las texturas vendrán del archivo .cub (líneas NO, SO, WE, EA), que se parsea en otro issue. Este issue se centra en cargar esas texturas y pintarlas bien en la imagen, sin depender de rutas fijas en el código.

    Alcance

    • Guardar las rutas de las cuatro texturas en t_game (el contrato acordado con el parsing).
    • Cargar cada textura con mlx_xpm_file_to_image a partir de esas rutas.
    • Dibujar una textura en la imagen del juego, leyendo sus píxeles con addr, size_line y bpp.
    • Liberar todas las texturas en la limpieza, sin fugas.

    Fuera de alcance

    Criterios de aceptación

    • Una textura se ve correctamente en la ventana, sin desplazamientos ni colores invertidos.
    • Si una ruta no existe, el programa informa del error y sale limpiamente.
    • Valgrind no reporta fugas al cerrar con ESC, con la cruz o tras un fallo de carga.

    Depende de: #12 (imágenes y struct t_img).


    English

    Description

    Display a wall texture correctly inside the game image, using textures loaded through MiniLibX.

    Context

    The subject requires each wall to show a different texture depending on the side it faces (North, South, East, West). The texture paths will come from the .cub file (NO, SO, WE, EA lines), which is handled in another issue. This issue focuses on loading those textures and drawing them correctly into the image, without relying on hard-coded paths.

    Scope

    • Store the four texture paths in t_game (the contract agreed with the parsing side).
    • Load each texture with mlx_xpm_file_to_image from those paths.
    • Draw a texture into the game image by reading its pixels through addr, size_line and bpp.
    • Free all textures during cleanup, without leaks.

    Out of scope

    Acceptance criteria

    • A texture appears correctly in the window, with no offset or inverted colors.
    • If a path does not exist, the program reports the error and exits cleanly.
    • Valgrind reports no leaks when closing with ESC, with the window close button, or after a loading failure.

    Depends on: #12 (images and the t_img struct).

  5. SailMasterG commented on Nov 7, 2026

    @SailMasterG
    Collaborator

    Interface contract: texture paths (t_img.path)

    What it is: path is a string with the texture file path (for example ./textures/north.xpm). It has no identifier (NO, SO...) and no newline at the end.
    Who writes it: the parsing part, when it reads the NO, SO, WE and EA lines of the .cub file.
    Who reads it: the texture loading part, with mlx_xpm_file_to_image.
    Who owns the memory: once the string is copied into t_img.path, the cleanup function (clear_images) frees it. Nobody else frees it after that.
    Who frees on error: if something fails before the copy is stored in t_img.path, the part that made the copy frees it.
    If a path is missing: the texture loading returns an error, and the program exits cleanly with no leaks.****

  6. moved this from Backlog to In review in CUB3Don Nov 9, 2026
  7. changed the title [-]Implement a simple texture display[/-] [+]Render textures on walls[/+] on Nov 12, 2026
  8. linked a pull request that will close this issueRaycast #40on Nov 17, 2026
  9. moved this from In review to In progress in CUB3Don Nov 17, 2026
  10. moved this from In progress to Done in CUB3Don Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

render

Type

No type

Projects

  • Status
    Done

Relationships

None yet

Development

No branches or pull requests

Issue actions