MiniLibX :
A simple X-Window programming API in C
API :
A way for different software programs to talk to each other and work together :
- A software program wants to use the services provided by another program.
- The API acts as an intermediary, allowing the client to request specific actions or data from the other program.
- The server is the program that provides the functionality or data that the client want to access.
X Window System :
Its like a framework that helps your computer screen display graphics and handle input, such as mouse clicks and keyboard typing.
Functions :
-
void *mlx_init( ) :
- it sets up a connection to the X server allowing your program to communicate with it and perform graphical operations.
- it allocates memory for a type t_xvar * variable which is a structure that represents internal variables and settings related to the X window system ; This structure typically holds information about the connection to the X server, as well as other configuration parameters needed for graphics operations.

- it sets up default configurations for the graphics system, such as default window size, colors, and event handling behavior.
- if initialization fails for any reason it provides appropriate error messages.
-
int mlx_destroy_display(t_xvar *xvar) :
- closes the connection to the X server for the display specified in the display structure and destroy all windows.
-
void *mlx_new_window(t_xvar *xvar, int size_x, int size_y, char *title) :
- it allocates a pointer of type t_win_list that will be returned earlier.
- create a new window on the screen with a width and a height and title specified on the params.
- returns that pointer that will represent that window.
-
int mlx_loop(t_xvar *xvar) :
- after initializing MinilibX and creating a new window, ‘mlx_loop’ is called to start the main event loop. Once ‘mlx_loop’ is called, the program will continuously process events and respond to user input until the program is terminated.