fixing issue when creating multiple mlx application with leaks in the first one

This commit is contained in:
2023-12-28 01:06:03 +01:00
parent b144afd3fe
commit ac3b28c922
8 changed files with 30 additions and 16 deletions

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/04 16:56:35 by maldavid #+# #+# */
/* Updated: 2023/12/20 00:57:15 by kiroussa ### ########.fr */
/* Updated: 2023/12/27 17:19:50 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -31,6 +31,7 @@ typedef enum
MLX_WINDOW_EVENT = 5
} mlx_event_type;
/**
* @brief Initializes the MLX internal application
*
@@ -38,6 +39,7 @@ typedef enum
*/
MLX_API void* mlx_init();
/**
* @brief Creates a new window
*
@@ -50,6 +52,7 @@ MLX_API void* mlx_init();
*/
MLX_API void* mlx_new_window(void* mlx, int w, int h, const char* title);
/**
* @brief Gives a function to be executed at each loop turn
*
@@ -59,9 +62,9 @@ MLX_API void* mlx_new_window(void* mlx, int w, int h, const char* title);
*
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
*/
MLX_API int mlx_loop_hook(void* mlx, int (*f)(void*), void* param);
/**
* @brief Starts the internal main loop
*
@@ -71,6 +74,7 @@ MLX_API int mlx_loop_hook(void* mlx, int (*f)(void*), void* param);
*/
MLX_API int mlx_loop(void* mlx);
/**
* @brief Ends the internal main loop
*
@@ -80,6 +84,7 @@ MLX_API int mlx_loop(void* mlx);
*/
MLX_API int mlx_loop_end(void* mlx);
/**
* @brief Shows mouse cursor
*
@@ -87,6 +92,7 @@ MLX_API int mlx_loop_end(void* mlx);
*/
MLX_API int mlx_mouse_show();
/**
* @brief Hides mouse cursor
*
@@ -94,6 +100,7 @@ MLX_API int mlx_mouse_show();
*/
MLX_API int mlx_mouse_hide();
/**
* @brief Moves cursor to givent position
*
@@ -106,6 +113,7 @@ MLX_API int mlx_mouse_hide();
*/
MLX_API int mlx_mouse_move(void* mlx, void* win, int x, int y);
/**
* @brief Get cursor's position
*
@@ -160,6 +168,7 @@ MLX_API int mlx_pixel_put(void* mlx, void* win, int x, int y, int color);
*/
MLX_API void* mlx_new_image(void* mlx, int width, int height);
/**
* @brief Get image pixel data
*
@@ -180,6 +189,7 @@ MLX_API void* mlx_new_image(void* mlx, int width, int height);
*/
MLX_API int mlx_get_image_pixel(void* mlx, void* img, int x, int y);
/**
* @brief Set image pixel data
*
@@ -201,6 +211,7 @@ MLX_API int mlx_get_image_pixel(void* mlx, void* img, int x, int y);
*/
MLX_API void mlx_set_image_pixel(void* mlx, void* img, int x, int y, int color);
/**
* @brief Put image to the given window
*
@@ -214,6 +225,7 @@ MLX_API void mlx_set_image_pixel(void* mlx, void* img, int x, int y, int color);
*/
MLX_API int mlx_put_image_to_window(void* mlx, void* win, void* img, int x, int y);
/**
* @brief Destroys internal image
*
@@ -237,6 +249,7 @@ MLX_API int mlx_destroy_image(void* mlx, void* img);
*/
MLX_API void* mlx_png_file_to_image(void* mlx, char* filename, int* width, int* height);
/**
* @brief Create a new image from a jpg file
*
@@ -249,6 +262,7 @@ MLX_API void* mlx_png_file_to_image(void* mlx, char* filename, int* width, int*
*/
MLX_API void* mlx_jpg_file_to_image(void* mlx, char* filename, int* width, int* height);
/**
* @brief Create a new image from a bmp file
*
@@ -288,6 +302,7 @@ MLX_API int mlx_string_put(void* mlx, void* win, int x, int y, int color, char*
*/
MLX_API void mlx_set_font(void* mlx, void* win, char* filepath);
/**
* @brief Loads a font to be used by `mlx_string_put` and scales it
*