Add MLX42 V3

This commit is contained in:
Etienne Rey-bethbeder
2023-04-26 14:03:40 +02:00
parent bc5fc2fc59
commit baab9b52cd
22 changed files with 125 additions and 298 deletions

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* MLX42_Keys.h :+: :+: */
/* MLX42.h :+: :+: */
/* +:+ */
/* By: W2Wizard <main@w2wizard.dev> +#+ */
/* +#+ */
/* Created: 2021/12/28 02:29:06 by W2Wizard #+# #+# */
/* Updated: 2023/03/30 16:23:19 by ntamayo- ######## odam.nl */
/* Created: 2021/12/28 00:33:01 by W2Wizard #+# #+# */
/* Updated: 2023/02/01 11:33:26 by W2Wizard ######## odam.nl */
/* */
/* ************************************************************************** */
@ -469,13 +469,6 @@ mlx_win_cursor_t* mlx_create_std_cursor(cursor_t type);
*/
mlx_win_cursor_t* mlx_create_cursor(mlx_texture_t* texture);
/**
* Destroys the given cursor object.
*
* @param[in] cursor The cursor object to destroy.
*/
void mlx_destroy_cursor(mlx_win_cursor_t* cursor);
/**
* Sets the current cursor to the given custom cursor.
*
@ -601,6 +594,31 @@ void mlx_delete_xpm42(xpm_t* xpm);
*/
mlx_image_t* mlx_texture_to_image(mlx_t* mlx, mlx_texture_t* texture);
/**
* Given an X & Y coordinate and a Width and Height from a section of a
* texture a new image is created, useful for texture atlases.
*
* Basically a cropping tool.
*
* @param[in] mlx The MLX instance handle.
* @param[in] texture The texture to use to create the image from.
* @param[in] xy The X & Y location.
* @param[in] wh The Width & Height.
* @return mlx_image_t* The image created from the texture area.
*/
mlx_image_t* mlx_texture_area_to_image(mlx_t* mlx, mlx_texture_t* texture, uint32_t xy[2], uint32_t wh[2]);
/**
* Draws the texture on an already existing image.
*
* @param[in] image The image to draw on.
* @param[in] texture The texture to use to draw on the image.
* @param[in] x X position relative to the image.
* @param[in] y Y position relative to the image.
* @return In case of any issues false, else true.
*/
bool mlx_draw_texture(mlx_image_t* image, mlx_texture_t* texture, uint32_t x, uint32_t y);
//= Image Functions =//
/**
@ -659,8 +677,8 @@ int32_t mlx_image_to_window(mlx_t* mlx, mlx_image_t* img, int32_t x, int32_t y);
void mlx_delete_image(mlx_t* mlx, mlx_image_t* image);
/**
* Allows you to resize an image, a new pixel buffer is allocated
* to fit & the previous data is scaled to fit the new size.
* Allows you to resize an image, the pixel buffer is re-allocated
* to fit & the previous data is copied over. New pixels are zeroed.
*
* @param[in] img The image to resize.
* @param[in] nwidth The new width.

View File

@ -1,19 +1,19 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* MLX42_Int.h :+: :+: */
/* MLX42_Int.h :+: :+: :+: */
/* +:+ */
/* By: W2Wizard <w2.wizzard@gmail.com> +#+ */
/* +#+ */
/* Created: 2021/12/27 23:55:34 by W2Wizard #+# #+# */
/* Updated: 2022/07/21 10:46:43 by sbos ######## odam.nl */
/* Updated: 2023/03/03 11:13:25 by ulayus ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef MLX42_INT_H
# define MLX42_INT_H
# define LODEPNG_NO_COMPILE_ALLOCATORS
# include "MLX42/MLX42.h"
# include "MLX42.h"
# include "lodepng/lodepng.h"
# include "glad/glad.h"
# include "KHR/khrplatform.h"