.TH MiniLibX 3 "September 19, 2002" .SH NAME MiniLibX - Simple Window Interface Library for students .SH SYNOPSYS #include .nf .I void * .fi .B mlx_init (); .nf .I int .fi .B mlx_release (void *mlx_ptr); .SH DESCRIPTION MiniLibX is an easy way to create graphical software, without any X-Window/Wayland/Vulkan programming knowledge under Unix/Linux, nor any AppKit programming knowledge under MacOS. It provides simple window creation, a drawing tool, image and basic events management. .SH Unix/Linux: HISTORICAL X-WINDOW CONCEPT X-Window is a network-oriented graphical system for Unix. It is based on two main parts: .br On one side, your software wants to draw something on the screen and/or get keyboard & mouse entries. .br On the other side, the X-Server manages the screen, keyboard and mouse (It is often referred to as a "display"). .br A network connection must be established between these two entities to send drawing orders (from the software to the X-Server), and keyboard/mouse events (from the X-Server to the software). .br Nowadays, most of the time, both run on the same computer. .SH Unix/Linux: MODERN GRAPHICAL APPROACH Modern computers come with a powerful GPU that is directly accessed by applications. Along GPU libraries like Vulkan or OpenGL, the Wayland protocol ensure communication with the compositor program that manages the various windows on screen and the user input events. For your own application: .br The Vulkan or OpenGL library allow you to directly draw any content into your window. .br The Wayland compositor handles the place of your window on screen and send you back the keyboard and mouse inputs from the user. .br Unfortunately, this gain of graphical power through GPU access removes the networking aspects that exist with X-Window. It is not possible for a program to access a remote GPU and show its window on a remote display. But current software architectures are more likely based on a local display application that gets data in JSON through a web API. .SH MacOS: WINDOW SERVER AND GPU Your software interacts directly with the Window server who handles the cohabitation on the screen with other software and the event system, and interacts with the GPU to handle all drawing commands. .SH INCLUDE FILE .B mlx.h should be included for a correct use of the MiniLibX API. It only contains function prototypes, no structure is needed. .SH LIBRARY FUNCTIONS .P First of all, you need to initialize the connection between your software and the graphic and user sub-systems. Once this completed, you'll be able to use other MiniLibX functions to send and receive the messages from the display, like "I want to draw a yellow pixel in this window" or "did the user hit a key?". .P The .B mlx_init function will create this connection. No parameters are needed, ant it will return a .I "void *" identifier, used for further calls to the library routines. The .B mlx_release function can be used at the end of the program to disconnect from the graphic system and release resources. .P All other MiniLibX functions are described in the following man pages: .TP 20 .B mlx_new_window : manage windows .TP 20 .B mlx_pixel_put : draw inside a window .TP 20 .B mlx_new_image : manipulate images .TP 20 .B mlx_loop : handle keyboard or mouse events .TP 20 .B mlx_extra : extra functions available in the MinilibX .SH LINKING MiniLibX To use MiniLibX functions, you may -or not- need to link your software with several libraries, including the MiniLibX library itself. On Unix/Linux, depending on the specific operating system, either just using .B -lmlx works, or you need to add .B -lxcb -lxcb-keysyms -lvulkan -lz -lbsd \&. On MacOS, the dynamic Metal library will find on its own the missing components: .B -lmlx \&. You may also need to specify the path to these libraries, using the .B -L flag. .SH RETURN VALUES If .B mlx_init() fails to set up the connection to the display, it will return NULL, otherwise a non-null pointer is returned as a connection identifier. .SH SEE ALSO mlx_new_window(3), mlx_pixel_put(3), mlx_new_image(3), mlx_loop(3), mlx_extra(3) .SH AUTHOR Copyright ol@ - 2002-2025 - Olivier Crouzet