Skip to content
W2.Wizard edited this page Feb 20, 2022 · 39 revisions

Welcome to the MLX42 wiki!

Why was MLX42 developed?

MLX42 is what I deem the successor to the MiniLibX library which was written by Charlie Root and later updated by Olivier Crouzet. Most students agree that the library is written in a, well, subpar state and isn't the most optimal in terms of usability and documentation.

While it is "stable" and does compile there are many pitfalls with the library including the lack of good documentation, weird function prototypes and/or slow performance, e.g: putpixel. Additionally it is pretty much no longer truly being maintained nor is it open-source with the exception of the Linux version.

Most of my 42 peers simply stated that "it is what it is" once I discovered this library. However, personally, I refused to let this cycle continue. So I made it my goal that during one of many Lockdowns to start exploring OpenGL in order to finally fix the mistakes

In my eyes, the 42 Network deserves high quality tools to teach people properly.

What does it improve? What makes it "better"

A list of improvements include:

  • It is norme
  • It is easy and straight-forward to install & compile.
  • It is cross-platform (Linux, Windows & MacOS)
  • Error handling, no more straight up segfaults.
  • Clear and understandable English written documentation.
  • No Leaks, compiles with -fsanitize=address effortlessly.
  • No abstracted data types, only things relevant to OpenGL are abstracted.
  • Open-source, find a bug? Send a PR to this repo!
  • Useful extra features such as:
    • Apply a custom application icon for your program.
    • Apply a custom cursor, finally you can have a cool fire sword cursor!
    • Universal enums for keycodes, mouse buttons, no more searching what keycode is for what OS.
    • Easy input handling, no more 3 different types of inputs (Events, masks, hooks). Just a single hook or if statement.
    • Custom XPM image format (XPM42).
    • An actual efficient mlx_putpixel function.
    • Ability to retrieve the delta time, now you can make fancy interpolations.
    • Ability to retrieve monitor width and height as well getting and setting window position.
    • Ability to focus the window.
    • Ability to resize the window.

F.A.Q

Q: "ItS NoT In ThE SuBjeCt!"

A: So what ? Subjects can change and so if something is not working correctly it should be replaced. Sure you can argue this point but you can also be the reason that it CAN be in the subject instead. Have an open mind :)

Q: "Ok, so, can I use it ?"

A: Officially, no. However, ask your head of studies first before about using it, see what they think. Some students might be evangelical enthusiasts about what is stated in the subject and are technically in every right to fail you as long as this library is not endorsed, if you were to ask me (W2) then yes why not?

Q: "Can I just drag and drop it into my old project and just not do anything?"

A: Well, um uh, no ?? That's not how libraries work. Sure they target and do sort of the same thing but the functions each library provides are too different, even a little bit in terms of behavior. And no there is no easy way to convert from the "old" to the "new" it will be somewhat tedious work.

Q: "We should be able to deal with the fact that MiniLibX is not perfect, it is by design and makes us better programmers."

A: Struggle does bring out the best in most people but it is also not ideal in this case. I think so at least, that its really expected that libraries that are publicly available should be usable, stable, easy to use and well documented. Nobody uses a library because it is annoying to work with it and afterwards think to themselves they have learned something after they are done struggling. The only thing people learn from this is how to navigate around the short comings instead.

Q: "Why not use some other library? Why this one and not any other library."

A: It is your choice what to use! I wrote this in my free time in an attempt to introduce some good change and to improve the learning experience at 42. If you don't like my library at least let me know what it is so I can improve on it.

Q: "Do you hate MiniLibX? Is this some personal vendetta, do you work for the CIA ?"

A: No, I just want to improve 42, that's it.

Clone this wiki locally