style: fixed norm on include/mlx_*

This commit is contained in:
B.Goulard 2024-11-11 21:56:14 +01:00
parent 4df6d01c94
commit 7bd843af12
2 changed files with 51 additions and 47 deletions

View file

@ -6,7 +6,7 @@
/* By: bgoulard <bgoulard@student.42.fr> +#+ +:+ +#+ */ /* By: bgoulard <bgoulard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/08 21:54:56 by bgoulard #+# #+# */ /* Created: 2024/11/08 21:54:56 by bgoulard #+# #+# */
/* Updated: 2024/11/11 21:36:06 by rparodi ### ########.fr */ /* Updated: 2024/11/11 21:54:26 by bgoulard ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -58,9 +58,8 @@ int mlx_clear_window(t_xvar *mlx_ptr, t_win_list *win_ptr);
* @param color Color of the pixel. * @param color Color of the pixel.
* @return 0 on success, non-zero on error. * @return 0 on success, non-zero on error.
*/ */
int mlx_pixel_put(\ int mlx_pixel_put(t_xvar *mlx_ptr, t_win_list *win_ptr, \
t_xvar *mlx_ptr, t_win_list *win_ptr, int x, int y, int color); int x, int y, int color);
/** /**
* @brief Creates a new image. * @brief Creates a new image.
@ -79,7 +78,8 @@ t_img *mlx_new_image(t_xvar *mlx_ptr, int width, int height);
* @param endian Endian of the image (0 for little-endian, 1 for big-endian). * @param endian Endian of the image (0 for little-endian, 1 for big-endian).
* @return Pointer to the image data. * @return Pointer to the image data.
*/ */
char *mlx_get_data_addr(t_img *img_ptr, int *bits_per_pixel, int *size_line, int *endian); char *mlx_get_data_addr(t_img *img_ptr, int *bits_per_pixel, \
int *size_line, int *endian);
/** /**
* @brief Puts an image into a window. * @brief Puts an image into a window.
@ -90,7 +90,8 @@ char *mlx_get_data_addr(t_img *img_ptr, int *bits_per_pixel, int *size_line, int
* @param y Y coordinate in the window. * @param y Y coordinate in the window.
* @return 0 on success, non-zero on error. * @return 0 on success, non-zero on error.
*/ */
int mlx_put_image_to_window(t_xvar *mlx_ptr, t_win_list *win_ptr, t_img *img_ptr, int x, int y); int mlx_put_image_to_window(t_xvar *mlx_ptr, t_win_list *win_ptr, \
t_img *img_ptr, int x, int y);
/** /**
* @brief Gets the color value for the specified color. * @brief Gets the color value for the specified color.
@ -107,7 +108,8 @@ int mlx_get_color_value(t_xvar *mlx_ptr, int color);
* @param param Parameter passed to the hook function. * @param param Parameter passed to the hook function.
* @return 0 on success, non-zero on error. * @return 0 on success, non-zero on error.
*/ */
int mlx_mouse_hook(t_win_list *win_ptr, int (*funct_ptr)(), void *param); int mlx_mouse_hook(t_win_list *win_ptr, int (*funct_ptr)(), \
void *param);
/** /**
* @brief Sets a keyboard hook on the window. * @brief Sets a keyboard hook on the window.
@ -125,7 +127,8 @@ int mlx_key_hook(t_win_list *win_ptr, int (*funct_ptr)(), void *param);
* @param param Parameter passed to the hook function. * @param param Parameter passed to the hook function.
* @return 0 on success, non-zero on error. * @return 0 on success, non-zero on error.
*/ */
int mlx_expose_hook(t_win_list *win_ptr, int (*funct_ptr)(), void *param); int mlx_expose_hook(t_win_list *win_ptr, int (*funct_ptr)(), \
void *param);
/** /**
* @brief Sets a loop hook for repeated execution. * @brief Sets a loop hook for repeated execution.
@ -160,7 +163,8 @@ int mlx_loop_end(t_xvar *mlx_ptr);
* @param string The string to display. * @param string The string to display.
* @return 0 on success, non-zero on error. * @return 0 on success, non-zero on error.
*/ */
int mlx_string_put(t_xvar *mlx_ptr, t_win_list *win_ptr, int x, int y, int color, char *string); int mlx_string_put(t_xvar *mlx_ptr, t_win_list *win_ptr, \
int x, int y, int color, char *string);
/** /**
* @brief Sets the font for the window. * @brief Sets the font for the window.
@ -178,7 +182,8 @@ void mlx_set_font(t_xvar *mlx_ptr, t_win_list *win_ptr, char *name);
* @param height Output parameter for the height of the image. * @param height Output parameter for the height of the image.
* @return Pointer to the created image. * @return Pointer to the created image.
*/ */
t_img *mlx_xpm_to_image(t_xvar *mlx_ptr, char **xpm_data, int *width, int *height); t_img *mlx_xpm_to_image(t_xvar *mlx_ptr, char **xpm_data, int *width, \
int *height);
/** /**
* @brief Converts an XPM file to an image. * @brief Converts an XPM file to an image.
@ -188,7 +193,8 @@ t_img *mlx_xpm_to_image(t_xvar *mlx_ptr, char **xpm_data, int *width, int *heigh
* @param height Output parameter for the height of the image. * @param height Output parameter for the height of the image.
* @return Pointer to the created image. * @return Pointer to the created image.
*/ */
t_img *mlx_xpm_file_to_image(t_xvar *mlx_ptr, char *filename, int *width, int *height); t_img *mlx_xpm_file_to_image(t_xvar *mlx_ptr, char *filename, \
int *width, int *height);
/** /**
* @brief Destroys a window. * @brief Destroys a window.
@ -222,7 +228,8 @@ int mlx_destroy_display(t_xvar *mlx_ptr);
* @param param Parameter passed to the hook function. * @param param Parameter passed to the hook function.
* @return 0 on success, non-zero on error. * @return 0 on success, non-zero on error.
*/ */
int mlx_hook(t_win_list *win_ptr, int x_event, int x_mask, int (*funct)(), void *param); int mlx_hook(t_win_list *win_ptr, int x_event, int x_mask, \
int (*funct)(), void *param);
/** /**
* @brief Disables key auto-repeat. * @brief Disables key auto-repeat.
@ -253,7 +260,8 @@ int mlx_do_sync(t_xvar *mlx_ptr);
* @param y Output parameter for the Y coordinate. * @param y Output parameter for the Y coordinate.
* @return 0 on success, non-zero on error. * @return 0 on success, non-zero on error.
*/ */
int mlx_mouse_get_pos(t_xvar *mlx_ptr, t_win_list *win_ptr, int *x, int *y); int mlx_mouse_get_pos(t_xvar *mlx_ptr, t_win_list *win_ptr, \
int *x, int *y);
/** /**
* @brief Moves the mouse to a specified position. * @brief Moves the mouse to a specified position.
@ -281,5 +289,4 @@ int mlx_mouse_hide(t_xvar *mlx_ptr, t_win_list *win_ptr);
*/ */
int mlx_mouse_show(t_xvar *mlx_ptr, t_win_list *win_ptr); int mlx_mouse_show(t_xvar *mlx_ptr, t_win_list *win_ptr);
#endif /* FIXED_MLX_H */ #endif /* FIXED_MLX_H */

View file

@ -6,12 +6,12 @@
/* By: bgoulard <bgoulard@student.42.fr> +#+ +:+ +#+ */ /* By: bgoulard <bgoulard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/10 05:33:08 by bgoulard #+# #+# */ /* Created: 2024/11/10 05:33:08 by bgoulard #+# #+# */
/* Updated: 2024/11/10 05:38:28 by bgoulard ### ########.fr */ /* Updated: 2024/11/11 21:45:35 by bgoulard ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#ifndef MLX_STRUCT_H #ifndef MLX_STRUCTS_H
# define MLX_STRUCT_H # define MLX_STRUCTS_H
# include <X11/X.h> # include <X11/X.h>
# include <X11/Xlib.h> # include <X11/Xlib.h>
@ -25,8 +25,6 @@
# define ENV_DISPLAY "DISPLAY" # define ENV_DISPLAY "DISPLAY"
# define LOCALHOST "localhost" # define LOCALHOST "localhost"
# define ERR_NO_TRUECOLOR "MinilibX Error : No TrueColor Visual available.\n"
# define WARN_SHM_ATTACH "MinilibX Warning : X server can't attach shared memory.\n"
typedef struct s_xpm_col typedef struct s_xpm_col
{ {
@ -34,7 +32,6 @@ typedef struct s_xpm_col
int col; int col;
} t_xpm_col; } t_xpm_col;
struct s_col_name struct s_col_name
{ {
char *name; char *name;
@ -100,4 +97,4 @@ typedef struct s_xvar
int end_loop; int end_loop;
} t_xvar; } t_xvar;
#endif /* MLX_STRUCT_H */ #endif /* MLX_STRUCTS_H */