The goal of this version is to provide a light, fast, and modern graphical tool while keeping the same API.
Built on top of Vulkan, the MacroLibX takes advantage of its very low-level nature to achieve high performance with great control over available resources.
Designed to be totally cross-platform, it can run on any SDL2-supported platform that supports Vulkan (even the Nintendo Switch ! theoretically... ).
One of the guidelines of this lib was to get as close as possible to the old minilibx API, and therefore to the educational choices of the old minilibx.
Everything in this repo is entirely free and open source, all available under the MIT license (even the third-party libraries used).
Experimental for now, a suppressions file for valgrind is given to remove potential leaks comming from Xorg, Nvidia drivers, SDL2, or any other tool which the user has no control. It is far from perfect at the moment and may allow some leaks but it will block the majority.
Strong error handling informing the user of problems with their code and even capable of informing them of graphics memory leaks that tools like Valgrind cannot detect.
You first need to install the proper dependencies for your operating-system.
Here are a few common cases for different Linux distributions:
For Ubuntu/Debian-based distros:
sudo apt update
sudo apt install libsdl2-2.0-0 libsdl2-dev build-essential
For ArchLinux-based distros:
sudo pacman -S sdl2
Note that you need to have up do date video drivers with
libvulkan.so
installed.
MacroLibX on macOS requires SDL2 and MoltenVK. You can install both using the Homebrew package manager:
brew install molten-vk
brew install SDL2
To build on Windows you may need to use the xmake build. Here's how you can use it.
Finally, you can clone the Git repository. When inside it, run the GNU make
command to compile MacroLibX.
git clone https://github.com/seekrs/MacroLibX.git
cd MacroLibX
make
To compile your project with MacroLibX, you just provide the shared library path in your compilation/linking command:
clang myApp.c /path/to/MacroLibX/libmlx.so -lSDL2
And you can enjoy your project
By default the mlx is built in release mode but you can switch to debug by using make DEBUG=true
.
If you want to use GCC
to build the mlx you can use make TOOLCHAIN=gcc
If you run into glitches when writing or reading pixels from images you can turn off images optimisations by using make IMAGES_OPTIMIZED=false
.
You can force the mlx to use your integrated GPU by using make FORCE_INTEGRATED_GPU=true
. Note that there are a lot of chances that your application crashes by using that.
The mlx can dump it's graphics memory use to json files every two seconds by enabling this option make GRAPHICS_MEMORY_DUMP=true
.
This project and all its files, even the third_party
directory or unless otherwise mentionned, are licenced under the MIT license.