MLX42 is a performant, easy to use, cross-platform, minimal windowing graphics library to create graphical applications without having to work directly with the native windowing framework of the given operating system.
It provides primitive tools to draw textures onto the window as well as modifying them at runtime as they get displayed on the window.
# Features ✨
MLX42 comes with a plethora of features that make using it actually a joy instead of a chore.
## Cross-Platform 🖥️
Run it on your grandma's WindowsXP, on your uncle's debian or on a hipster's MacOS!
No matter what the platform, if MLX42 can build on it, it will run on its native windowing system.
This allows you to work on your project no matter which machine it is on.
## Documented 📚
MLX42 cares about good documentation, every function, usage and even some internal workings are documented!
No more guessing and searching how something functions or is supposed to work.
## Performance 🚀
It is built on OpenGL and uses batched rendering to speed up the rendering process compared to other libraries.
## Open source && Community driven 🌐
This project is being actively maintained by Codam as well as students from the 42 Network. This gives students the direct opportunity to learn more about the library itself as well as fix any potential bugs instead of merely accepting them.
---
## Installation 🏗️
### General compilation.
Overall the building of this project is as follows for ALL systems. As long as CMake can make sense of it.
1. [Download and build MLX42](#download-and-build---mlx42)
In case your system doesn't have [glfw](https://github.com/glfw/glfw) installed cmake will detect this and download it for you.
You can then run `sudo make install` in the `_deps` directory of glfw. If you're using a 42 Computer (MacOS, Linux), ask your favourite sysadmin to install it.
Same goes for CMake or any other dependencies you might need for your system.
However if you can't do either CMake will still be able to fetch GLFW and build it. You can then statically link it from the `_deps` folder.
> **Note**: For Codam, GLFW is already installed on the Macs.
> **Note**: During the linking stage, the flag to link GLFW can either be: -lglfw3 or -lglfw depending on your system.
2. Compile your program with the library:
- For: [MacOS](#for-macos)
- For: [Linux](#for-linux)
- For: [Windows](#for-windows)
3. Profit!
### Unit tests
MLX42 comes with some unit tests to ensure the integrity of the library, to build them run the following command:
You can pass build options to cmake ... `cmake -DDEBUG=1 -DGLFW_FETCH=0` ... to customise the install, more at [installation](./docs/index.md#available-options).
You can find an example makefile in the documentation [here](https://github.com/codam-coding-college/MLX42/blob/master/docs/Basics.md).
3. Open Windows Defender Firewall, and follow these steps:
- Go to 'Allow an app or feature through Windows Defender Firewall'
- Change Settings
- Find the installed XServer, for VcXsrv that's 'VcXsrv windows server'
- Enable communication over Private **and** Public network
Optionally you might be able to provide these settings on first launch of the XServer application,
and they might not even show up in the list until the first time you start the app.
4. Start the XLaunch application (for VcXsrv) and provide these configuration settings:
- Leave Display number on auto
- Start no client
- **UNTICK** `Native opengl` option
- **TICK** `Disable access control`
- Finish starting the server
5. Probably all the other steps for Linux apply, just clone, build and run.
----
## For Windows Native:
> **Warning**: Be aware that Visual Studio (2022) is required for this. Developing on Windows can be somewhat frustrating.
We highly recommend you simply use [WSL2](#for-windows-with-windows-subsystem-for-linux-2-wsl2) to make this as painless as possible.
However if you insist on building for windows natively then all you need in terms of dependencies is:
- [CMake](https://cmake.org/download/)
- [GLFW](https://www.glfw.org/download.html)
Once you have all the dependencies correctly installed `CMake` will generate
the visual studio project files. Simply build it and once you have a `.lib` file
move them to your actual project and install them as you would with any other library.
Just in case here's a [video](https://youtu.be/or1dAmUO8k0?t=494) showing you how this can be done. Conveniently this video also covers how you can link `glfw`.
Of course it's up to you to make sure that the code you write is portable. Things that exist on `Unix` don't necessarily exist on `Win32`.