Skip to content

v2.0.0 — MLX42 migration

Latest

Choose a tag to compare

@danieljs-dev danieljs-dev released this 04 Nov 23:14
· 1 commit to main since this release
8b4e316

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.