diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-15 17:01:55 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-15 17:01:55 +0100 |
commit | b7433e108da26346c189888d0aa07ab0e896a709 (patch) | |
tree | 1b861b7fefc1ef791022f5694c105541563e3bf0 /minilibx_linux/mlx.h | |
parent | Tweaked shadows (diff) | |
download | 42-cub3d-b7433e108da26346c189888d0aa07ab0e896a709.tar.gz 42-cub3d-b7433e108da26346c189888d0aa07ab0e896a709.tar.bz2 42-cub3d-b7433e108da26346c189888d0aa07ab0e896a709.tar.xz 42-cub3d-b7433e108da26346c189888d0aa07ab0e896a709.tar.zst 42-cub3d-b7433e108da26346c189888d0aa07ab0e896a709.zip |
GNU libx
Diffstat (limited to 'minilibx_linux/mlx.h')
-rw-r--r-- | minilibx_linux/mlx.h | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/minilibx_linux/mlx.h b/minilibx_linux/mlx.h new file mode 100644 index 0000000..a2cc7e5 --- /dev/null +++ b/minilibx_linux/mlx.h @@ -0,0 +1,129 @@ +/* +** mlx.h for MinilibX in +** +** Made by Charlie Root +** Login <ol@epitech.net> +** +** Started on Mon Jul 31 16:37:50 2000 Charlie Root +** Last update Tue May 15 16:23:28 2007 Olivier Crouzet +*/ + +/* +** MinilibX - Please report bugs +*/ + + +/* +** FR msg - FR msg - FR msg +** +** La MinilibX utilise 2 librairies supplementaires qu'il +** est necessaire de rajouter a la compilation : +** -lmlx -lXext -lX11 +** +** La MinilibX permet le chargement des images de type Xpm. +** Notez que cette implementation est incomplete. +** Merci de communiquer tout probleme de chargement d'image +** de ce type. +*/ + + +#ifndef MLX_H + +#define MLX_H + + +void *mlx_init(); +/* +** needed before everything else. +** return (void *)0 if failed +*/ + + +/* +** Basic actions +*/ + +void *mlx_new_window(void *mlx_ptr, int size_x, int size_y, char const *title); +/* +** return void *0 if failed +*/ +int mlx_clear_window(void *mlx_ptr, void *win_ptr); +int mlx_pixel_put(void *mlx_ptr, void *win_ptr, int x, int y, int color); +/* +** origin for x & y is top left corner of the window +** y down is positive +** color is 0x00RRGGBB +*/ + + +/* +** Image stuff +*/ + +void *mlx_new_image(void *mlx_ptr,int width,int height); +/* +** return void *0 if failed +** obsolete : image2 data is stored using bit planes +** void *mlx_new_image2(void *mlx_ptr,int width,int height); +*/ +char *mlx_get_data_addr(void *img_ptr, int *bits_per_pixel, + int *size_line, int *endian); +/* +** endian : 0 = sever X is little endian, 1 = big endian +** for mlx_new_image2, 2nd arg of mlx_get_data_addr is number_of_planes +*/ +int mlx_put_image_to_window(void *mlx_ptr, void *win_ptr, void *img_ptr, + int x, int y); +unsigned int mlx_get_color_value(void *mlx_ptr, int color); + + +/* +** dealing with Events +*/ + +int mlx_mouse_hook (void *win_ptr, int (*funct_ptr)(), void *param); +int mlx_key_hook (void *win_ptr, int (*funct_ptr)(), void *param); +int mlx_expose_hook (void *win_ptr, int (*funct_ptr)(), void *param); + +int mlx_loop_hook (void *mlx_ptr, int (*funct_ptr)(), void *param); +int mlx_loop (void *mlx_ptr); + + +/* +** hook funct are called as follow : +** +** expose_hook(void *param); +** key_hook(int keycode, void *param); +** mouse_hook(int button, int x,int y, void *param); +** loop_hook(void *param); +** +*/ + + +/* +** Usually asked... +*/ + +int mlx_string_put(void *mlx_ptr, void *win_ptr, int x, int y, int color, + char *string); +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 const *filename, + int *width, int *height); +int mlx_destroy_window(void *mlx_ptr, void *win_ptr); + +int mlx_destroy_image(void *mlx_ptr, void *img_ptr); + +/* +** generic hook system for all events, and minilibX functions that +** can be hooked. Some macro and defines from X11/X.h are needed here. +*/ + +int mlx_hook(void *win_ptr, int x_event, int x_mask, + int (*funct)(), void *param); + +int mlx_do_key_autorepeatoff(void *mlx_ptr); +int mlx_do_key_autorepeaton(void *mlx_ptr); +int mlx_do_sync(void *mlx_ptr); + +#endif /* MLX_H */ |