mlx 라이브러리 함수 man page 정리
1. mlx_init
void *mlx_init()
void *identifier
, used for further calls to the library routines.2. mlx_new_window
void *mlx_new_window(void *mlx_ptr, int size_x, int size_y, char *title)
mlx_init()
.3. mlx_clear_window
int mlx_clear_window(void *mlx_ptr, void *win_ptr)
4. mlx_destroy_window
int mlx_destroy_window(void *mlx_ptr, void *win_ptr)
5. mlx_pixel_put
SYN : int mlx_pixel_put(void *mlx_ptr, void *win_ptr, int x, int y, int color)
DES : Draws a defined pixel in the window win_ptr using the (x, y) coordinates, and the specified color. The origin (0, 0) is the upper left corner of the window, the x and y axis respectively pointing right and down. The connection identifier, mlx_ptr, is needed.
color integer :
| 0 | R | G | B |
+---+---+---+---+
6. mlx_string_put
int mlx_string_put(void *mlx_ptr, void *win_ptr, int x, int y, int color, char *string)
mlx_pixel_put
. Instead of a simple pixel, the specified string will be displayed at (x, y).7. mlx_new_image
void *mlx_new_image(void *mlx_ptr, int width, int height)
void *identifier
needed to manipulate this image later.8. mlx_put_image_to_window
int mlx_put_image_to_window(void *mlx_ptr, void *win_ptr, void *img_ptr, int x, int y)
9. mlx_get_data_addr
char *mlx_get_data_addr(void *img_ptr, int *bits_per_pixel, int *size_line, int *endian)
char *address
that represents the begining of the memory area where the image is stored. From this adress, the first bits_per_pixel bits represent the color of the first pixel in the first line of the image. The second group of bits_per_pixel bits represent the second pixel of the first line, and so on. Add size_line to the adress to get the begining of the second line. You can reach any pixels of the image that way.10. mlx_destroy_image
int mlx_destroy_image(void *mlx_ptr, void *img_ptr)
11. mlx_get_color_value
unsigned int mlx_get_color_value(void *mlx_ptr, int color)
unsigned int value
. The bits_per_pixel least significant bits of this value can be stored int the image.12. mlx_xpm_to_image
& mlx_xpm_file_to_image
void *mlx_xpm_to_image(void *mlx_ptr, char **xpm_data, int *width, int *height)
void *mlx_xpm_file_to_image(void *mlx_ptr, char **file_name, int *width, int *height)
13. mlx_loop
int mix_loop(void *mlx_ptr)
14. mlx_key_hook
& mlx_mouse_hook
& mlx_expose_hook
int mix_key_hook(void *win_ptr, int (*funct_ptr)(), void *param)
int mix_mouse_hook(void *win_ptr, int (*funct_ptr)(), void *param)
int mix_expose_hook(void *win_ptr, int (*funct_ptr)(), void *param)
17. mlx_loop_hook
SYM : int mix_loop_hook(void *win_ptr, int (*funct_ptr)(), void *param)
DES : THis function is identical to the previous ones, but the given function will be called when no event occurs. When it catches an event, the MiniLibX calls the corresponding function with fixed parameters :
expose_hook(void *param)
key_hook(int keycode,void *param)
mouse_hook(int button,int x,int y,void *param)
loop_hook(void *param)
These function names are arbitrary. They here are used to distinguish parameters according to the event. These functions are NOT part of the MiniLibX.
param is the address specified in the mlx_*_hook calls. This address is never used nor modified by the MiniLibX. On key and mouse events, additional information is passed: keycode tells you which key is pressed, (x, y) are the coordinates of the mouse click in the window, and button tells you which mouse button was pressed.
Hi from Brazil! =D
By chance I found this site searching more about the minilibx lib.
The descriptions of the functions were really helpul!
Thanks!