nicolas-arnaud
2 years ago
13 changed files with 49 additions and 440 deletions
@ -1,108 +0,0 @@ |
|||
/* ************************************************************************** */ |
|||
/* */ |
|||
/* ::: :::::::: */ |
|||
/* libft.h :+: :+: :+: */ |
|||
/* +:+ +:+ +:+ */ |
|||
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */ |
|||
/* +#+#+#+#+#+ +#+ */ |
|||
/* Created: 2021/10/19 14:42:45 by narnaud #+# #+# */ |
|||
/* Updated: 2022/05/18 16:25:27 by narnaud@stude ### ########.fr */ |
|||
/* */ |
|||
/* ************************************************************************** */ |
|||
|
|||
#ifndef LIBFT_H |
|||
# define LIBFT_H |
|||
|
|||
# include <stddef.h> |
|||
# include <stdlib.h> |
|||
# include <unistd.h> |
|||
|
|||
typedef struct s_slist |
|||
{ |
|||
void *content; |
|||
struct s_slist *next; |
|||
} t_slist; |
|||
|
|||
typedef struct s_i_slist |
|||
{ |
|||
int nb; |
|||
struct s_i_slist *next; |
|||
} t_i_slist; |
|||
|
|||
typedef struct s_dlist |
|||
{ |
|||
void *content; |
|||
struct s_dlist *next; |
|||
struct s_dlist *previous; |
|||
} t_dlist; |
|||
|
|||
int ft_atoi(const char *str); |
|||
void ft_bzero(void *s, size_t n); |
|||
void *ft_calloc( size_t num, size_t size ); |
|||
int ft_isalpha(int ch); |
|||
int ft_isascii(int ch); |
|||
int ft_isdigit(int ch); |
|||
int ft_isprint(int ch); |
|||
int ft_isalnum(int ch); |
|||
int ft_isspace(int ch); |
|||
int ft_isnumber(char *str); |
|||
void *ft_memchr(const void *b, int c, size_t n); |
|||
int ft_memcmp(const void *s1, const void *s2, size_t n); |
|||
void *ft_memcpy(void *dst, const void *src, size_t n); |
|||
void *ft_memmove(void *dst, const void *src, size_t n); |
|||
void ft_free_split(char **split); |
|||
|
|||
size_t ft_ilen(int nbr); |
|||
size_t ft_ulen(unsigned int nbr); |
|||
size_t ft_longbaselen(long nbr, size_t base); |
|||
int ft_croissant(int a, int b); |
|||
int ft_decroissant(int a, int b); |
|||
int ft_max(int a, int b); |
|||
int ft_min(int a, int b); |
|||
|
|||
void *ft_memset(void *b, int c, size_t len); |
|||
char *ft_strchr(const char *s, int c); |
|||
char *ft_strdup(const char *src); |
|||
size_t ft_strlcat(char *dst, const char *src, size_t dstsize); |
|||
size_t ft_strlcpy(char *dst, const char *src, size_t dstsize); |
|||
size_t ft_strlen(const char *s); |
|||
size_t ft_strlen_to(const char *str, char ch); |
|||
int ft_strncmp(const char *s1, const char *s2, size_t n); |
|||
char *ft_strnstr(const char *haystack, const char *needle, size_t len); |
|||
char *ft_strrchr(const char *s, int c); |
|||
void ft_strrev(char **str, unsigned int neg); |
|||
int ft_tolower(int c); |
|||
int ft_toupper(int c); |
|||
char *ft_substr(char const *s, unsigned int start, size_t len); |
|||
char *ft_strjoin(const char *s1, const char *s2); |
|||
char *ft_strjoin_with(char *s1, char *s2, char *inter); |
|||
char *ft_strtrim(char const *s1, char const *set); |
|||
char **ft_split(char const *str, char ch); |
|||
char *ft_itoa(int n); |
|||
char *ft_itox(unsigned long n, const char *base); |
|||
char *ft_utoa(unsigned int n); |
|||
char *ft_strmapi(char const *s, char (*f)(unsigned int, char)); |
|||
void ft_striteri(char *s, void (*f)(unsigned int, char*)); |
|||
void ft_putchar_fd(char c, int fd); |
|||
void ft_putstr_fd(char *s, int fd); |
|||
void ft_putendl_fd(char *s, int fd); |
|||
void ft_putnbr_fd(int n, int fd); |
|||
|
|||
t_slist *ft_slst_new(void *content); |
|||
void ft_slst_add_front(t_slist **alst, t_slist *new); |
|||
int ft_slst_size(t_slist *lst); |
|||
t_slist *ft_slst_last(t_slist *lst); |
|||
void ft_slst_add_back(t_slist **alst, t_slist *new); |
|||
void ft_slst_delone(t_slist *lst, void (*del)(void *)); |
|||
void ft_slst_clear(t_slist **lst, void (*del)(void *)); |
|||
void ft_slst_iter(t_slist *lst, void (*f)(void *)); |
|||
t_slist *ft_slst_map(t_slist *lst, void *(*f)(void *), void (*del)(void *)); |
|||
|
|||
size_t ft_ilst_first(t_i_slist *lst, int (*fct)(int a, int b)); |
|||
void ft_ilst_free(t_i_slist *list); |
|||
int ft_ilst_is_in(int value, t_i_slist lst); |
|||
|
|||
t_dlist *ft_dlst_add(t_dlist *prev, void *content); |
|||
t_dlist *ft_dlst_n(t_dlist *lst, size_t n); |
|||
char **ft_dlst_to_arr(t_dlist *ptr); |
|||
#endif |
@ -1,139 +0,0 @@ |
|||
/*
|
|||
** 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 *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); |
|||
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); |
|||
int mlx_loop_end (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_set_font(void *mlx_ptr, void *win_ptr, char *name); |
|||
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 *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); |
|||
|
|||
int mlx_destroy_display(void *mlx_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); |
|||
|
|||
int mlx_mouse_get_pos(void *mlx_ptr, void *win_ptr, int *x, int *y); |
|||
int mlx_mouse_move(void *mlx_ptr, void *win_ptr, int x, int y); |
|||
int mlx_mouse_hide(void *mlx_ptr, void *win_ptr); |
|||
int mlx_mouse_show(void *mlx_ptr, void *win_ptr); |
|||
|
|||
int mlx_get_screen_size(void *mlx_ptr, int *sizex, int *sizey); |
|||
|
|||
#endif /* MLX_H */ |
@ -1,149 +0,0 @@ |
|||
/*
|
|||
** mlx.h for MinilibX in |
|||
** |
|||
** Made by Charlie Root |
|||
** Login <ol@staff.42.fr> |
|||
** |
|||
** Started on Mon Jul 31 16:37:50 2000 Charlie Root |
|||
** Last update Tue Oct 01 16:23:28 2014 Olivier Crouzet |
|||
*/ |
|||
|
|||
/*
|
|||
** MinilibX - Please report bugs |
|||
*/ |
|||
|
|||
|
|||
/*
|
|||
** FR msg - FR msg - FR msg |
|||
** |
|||
** MacOSX |
|||
** La MinilibX utilise 2 frameworks Mac : OpenGL et AppKit |
|||
** qu'il faut ajouter a la compilation : |
|||
** -framework OpenGL -framework AppKit |
|||
** |
|||
** UNIX / Linux |
|||
** 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. |
|||
** |
|||
** Il y a des differences entre X11 et MacOS. |
|||
** les numeros des touches ne sont pas les memes, |
|||
** les numeros des boutons souris ne sont pas les memes. |
|||
** Egalement l'expose est gere differemment, et sous MacOS |
|||
** il est preferable d'entrer le plus tot possible dans mlx_loop, |
|||
** il est normal que les fenetres n'apparaissent pas avant mlx_loop |
|||
** (ou bien forcez avec mlx_do_sync mais c'est pas genial). |
|||
** Sous MacOS, l'octet Alpha est pris en compte dans toutes les |
|||
** images, et represente la transparence et non l'opacite comme |
|||
** c'est normalement le cas. |
|||
*/ |
|||
|
|||
|
|||
#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 *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 |
|||
*/ |
|||
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 |
|||
** endian : useless on macos, client and graphical framework have the same endian |
|||
*/ |
|||
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 *filename, |
|||
int *width, int *height); |
|||
void *mlx_png_file_to_image(void *mlx_ptr, char *file, 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_mouse_hide(); |
|||
int mlx_mouse_show(); |
|||
int mlx_mouse_move(void *win_ptr, int x, int y); |
|||
int mlx_mouse_get_pos(void *win_ptr, int *x, int *y); |
|||
|
|||
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 */ |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue