Repository navigation
Releases: danieljs-dev/FDF
Release list
v2.0.0 — MLX42 migration
Summary
-
Complete migration of the graphical backend: from minilibx-linux to MLX42.
-
Refactoring pipeline, events, and lifecycle refactoring.
-
Updated Makefile for build/link with MLX42 (vendored GLFW via CMake).
-
CHANGES.md added with migration details.
Highlights
-
Rendering: persistent MLX42 image, direct writing to the RGBA buffer, lines via Bresenham as before.
-
Events: MLX42 hooks (keyboard, mouse scroll, close).
-
Cleanup: use of mlx_delete_image and mlx_terminate.
-
Build: MLX42 built via CMake; static GLFW vendored by MLX42 itself.
Breaking changes
-
Build:
-
Requires CMake installed.
-
Linking changed: static MLX42 + vendored GLFW (without -lmlx/-lglfw from the system).
-
Common X11 dependencies in Linux: -lX11 -lXrandr -lXi -lXcursor (vendorized covers GLFW).
-
Headers/Types:
-
Now includes MLX42/MLX42.h.
-
t_fdf uses mlx_t* and mlx_image_t*; minilibx fields removed (mlx_ptr, win_ptr, img_ptr, img_data, bpp, size_line, endian).
-
Events:
-
Replaced mlx_hook/minilibx with mlx_key_hook, mlx_scroll_hook, and mlx_close_hook from MLX42.
-
Lifecycle:
-
Replaced destroy_window/destroy_display with mlx_delete_image/mlx_terminate.
Main Changes
- feat!: migrate rendering backend to MLX42
- refactor(core): update draw pipeline, event hooks, and cleanup lifecycle
- build(makefile): link MLX42 static + vendored GLFW; remove minilibx-linux; add CMake step
- docs(changes): add CHANGES.md documenting the migration
Migration Guide
-
Remove minilibx-linux from the build environment.
-
Ensure CMake is installed on the system.
-
Use the current Makefile (it invokes CMake to build MLX42 when necessary).
-
Recompile with make. If X11 libraries are missing, install the corresponding headers (e.g., libx11-dev, libxrandr-dev, libxi-dev, libxcursor-dev).
#How to compile
- make
- The Makefile builds libft, builds MLX42 via CMake (if necessary), and links with the fdf binary.
How to run
-
./fdf 42.fdf
-
Controls:
-
Arrow keys: (← → ↑ ↓) move the camera or viewport view
-
Mouse scroll: zoom
-
- / −: Z scale
-
ESC: exit
Main files changed:
- fdf.h — change to MLX42 and new struct t_fdf.
- global_utils.c — persistent image; RGBA writing to the buffer.
- draw.c — removal of put/destroy per frame; direct drawing to the buffer.
- main.c — init/loop/hooks/cleanup in MLX42 standard.
- Makefile — build/link MLX42 and vendored GLFW, adjusted includes.
Notes:
-
CHANGES.md contains the detailed technical summary.
-
If necessary to maintain line 1.x, there is the v1.0.0 tag and you can create a maintenance/1.x branch for backports.
v1.0.0
v1.0.0 — Stable release (MiniLibX)
First stable release of FDF, an isometric projection wireframe renderer for .fdf maps (project 42).
Highlights
- Isometric map rendering with lines via Bresenham's algorithm
- Colors per point (parse of 0xRRGGBB in the map file)
- Initial auto-zoom and centering based on map and window size
- Pan (arrow keys), zoom via mouse scroll, and Z-scale adjustment (+/-)
- 1024x768 window with simple image pipeline and copy to window
Features
-
Reading .fdf maps (z-per-point and optional hexadecimal color)
-
Isometric projection with Z-scale adjustment
-
Mesh drawing (horizontal and vertical lines between adjacent points)
-
Zoom limits to prevent excessive zooming:
-
Minimum zoom: 1
-
Maximum zoom: 50
-
Cleanup and resource release when closing the window
Controls
-
Keyboard:
-
Arrow keys: move the map (pan)
-
- or =: increase Z-scale
-
-: decrease Z-scale
-
ESC: Exit
-
Mouse:
-
Scroll up: Zoom in
-
Scroll down: Zoom out
Compilation
-
Dependencies (Linux):
-
X11 (libX11, libXext)
-
minilibx-linux (downloaded and compiled automatically by the Makefile)
-
libft (libft/ folder included in the project)
-
Build:
-
make
-
Output:
-
binary: fdf
Execution
-
Example:
-
./fdf 42.fdf
-
./fdf basictest.fdf
-
The program validates the file extension and interrupts with an error if the format is invalid.
Structure and Components
- File Reading and Parsing:
- read_file.c, handle_file.c, handle_map.c
- Rendering:
- draw.c (scanning and calls to Bresenham's algorithm)
- bresenham.c (step calculation and line rasterization)
- global_utils.c (image creation, pixel writing, utilities)
- Configurations and Types:
- fdf.h, keys.h
- Auxiliary Library:
- libft (strings, lists, numeric values, get_next_line, printf, etc.)
- Graphical Backend:
minilibx-linux/(cloned via Makefile)
Compatibility
-
Tested on Linux with X11.
-
The example maps in test_maps were used for manual validation.
Known Limitations
-
No rotation/transformations beyond isometric projection and Z scale.
-
Fixed line width (1 px).
-
X11 dependent (Linux); does not natively support macOS/Wayland in this version.
-
Performance may degrade with very large maps (CPU rendering with lines).
Makefile Notes
-
The Makefile:
-
Compiles libft
-
Clones and compiles
minilibx-linuxif necessary -
Links with
-lmlx -lXext -lX11 -lm -lft -
Objects can be generated in obj if your environment has an updated Makefile (compatible variant).
Acknowledgements
- Project built for curriculum 42.
- Based on MiniLibX (42Paris) + custom libft.