/ fdf / fdf / mlx / man / man3 / mlx.3
mlx.3
  1  .TH MiniLibX 3 "September 19, 2002"
  2  .SH NAME
  3  MiniLibX - Simple Window Interface Library for students
  4  .SH SYNOPSYS
  5  #include <mlx.h>
  6  
  7  .nf
  8  .I void *
  9  .fi
 10  .B mlx_init
 11  ();
 12  
 13  .SH DESCRIPTION
 14  MiniLibX is an easy way to create graphical software,
 15  without any X-Window/X11 programming knowledge under Unix/Linux, nor
 16  any AppKit programming knowledge under MacOS. It provides
 17  simple window creation, a drawing tool, image and basic events
 18  management.
 19  
 20  .SH Unix/Linux: X-WINDOW CONCEPT
 21  
 22  X-Window is a network-oriented graphical system for Unix.
 23  It is based on two main parts:
 24  .br
 25  On one side, your software wants to draw something on the screen and/or
 26  get keyboard & mouse entries.
 27  .br
 28  On the other side, the X-Server manages the screen, keyboard and mouse
 29  (It is often refered to as a "display").
 30  .br
 31  A network connection must be established between these two entities to send
 32  drawing orders (from the software to the X-Server), and keyboard/mouse
 33  events (from the X-Server to the software).
 34  .br
 35  Nowadays, most of the time, both run on the same computer.
 36  
 37  .SH MacOS: WINDOW SERVER AND GPU
 38  
 39  Your software interacts directly with the Window server who handles the
 40  cohabitation on the screen with other software and the event system,
 41  and interacts with the GPU to handle all drawing stuff.
 42  
 43  .SH INCLUDE FILE
 44  .B mlx.h
 45  should be included for a correct use of the MiniLibX API.
 46  It only contains function prototypes, no structure is needed.
 47  
 48  .SH LIBRARY FUNCTIONS
 49  .P
 50  First of all, you need to initialize the connection
 51  between your software and the display.
 52  Once this connection is established, you'll be able to
 53  use other MiniLibX functions to send and receive the messages from
 54  the display, like "I want to draw a yellow pixel in this window" or
 55  "did the user hit a key?".
 56  .P
 57  The
 58  .B mlx_init
 59  function will create this connection. No parameters are needed, ant it will
 60  return a
 61  .I "void *"
 62  identifier, used for further calls to the library routines.
 63  .P
 64  All other MiniLibX functions are described in the following man pages:
 65  
 66  .TP 20
 67  .B mlx_new_window
 68  : manage windows
 69  .TP 20
 70  .B mlx_pixel_put
 71  : draw inside window
 72  .TP 20
 73  .B mlx_new_image
 74  : manipulate images
 75  .TP 20
 76  .B mlx_loop
 77  : handle keyboard or mouse events
 78  
 79  .SH LINKING MiniLibX
 80  To use MiniLibX functions, you may need to link
 81  your software with several libraries, including the MiniLibX library itself.
 82  On Unix/Linux, simply add the following arguments at linking time:
 83  
 84  .B -lmlx -lXext -lX11
 85  
 86  On MacOS, the dynamic Metal library will find on its own the missing components:
 87  
 88  .B -lmlx
 89  
 90  and still on MacOS, the static OpenGL version will need:
 91  
 92  .B -lmlx -framework OpenGL -framework AppKit -lz
 93  
 94  You may also need to specify the path to these libraries, using
 95  the
 96  .B -L
 97  flag.
 98  
 99  
100  .SH RETURN VALUES
101  If
102  .B mlx_init()
103  fails to set up the connection to the display, it will return NULL, otherwise
104  a non-null pointer is returned as a connection identifier.
105  
106  .SH SEE ALSO
107  mlx_new_window(3), mlx_pixel_put(3), mlx_new_image(3), mlx_loop(3)
108  
109  .SH AUTHOR
110  Copyright ol@ - 2002-2019 - Olivier Crouzet