MLX42 1.0
MLX42
|
#include "MLX42/MLX42_Int.h"
Go to the source code of this file.
Functions | |
void | mlx_flush_batch (mlx_ctx_t *mlx) |
static int8_t | mlx_bind_texture (mlx_ctx_t *mlx, mlx_image_t *img) |
void | mlx_draw_instance (mlx_ctx_t *mlx, mlx_image_t *img, mlx_instance_t *instance) |
mlx_instance_t * | mlx_grow_instances (mlx_image_t *img, bool *did_realloc) |
void | mlx_set_instance_depth (mlx_instance_t *instance, int32_t zdepth) |
int32_t | mlx_image_to_window (mlx_t *mlx, mlx_image_t *img, int32_t x, int32_t y) |
mlx_image_t * | mlx_new_image (mlx_t *mlx, uint32_t width, uint32_t height) |
void | mlx_delete_image (mlx_t *mlx, mlx_image_t *image) |
bool | mlx_resize_image (mlx_image_t *img, uint32_t nwidth, uint32_t nheight) |
|
static |
Definition at line 30 of file mlx_images.c.
void mlx_delete_image | ( | mlx_t * | mlx, |
mlx_image_t * | image | ||
) |
Deleting an image will remove it from the render queue as well as any and all instances it might have. Additionally, just as extra measures sets all the data to NULL.
If you simply wish to stop rendering an image without de-allocation set the 'enabled' boolean in the image struct.
[in] | mlx | The MLX instance handle. |
[in] | image | The image to delete. |
Definition at line 204 of file mlx_images.c.
void mlx_draw_instance | ( | mlx_ctx_t * | mlx, |
mlx_image_t * | img, | ||
mlx_instance_t * | instance | ||
) |
Internal function to draw a single instance of an image to the screen.
Definition at line 63 of file mlx_images.c.
Definition at line 17 of file mlx_images.c.
mlx_instance_t * mlx_grow_instances | ( | mlx_image_t * | img, |
bool * | did_realloc | ||
) |
Definition at line 87 of file mlx_images.c.
int32_t mlx_image_to_window | ( | mlx_t * | mlx, |
mlx_image_t * | img, | ||
int32_t | x, | ||
int32_t | y | ||
) |
Draws a new instance of an image, it will then share the same pixel buffer as the image.
NOTE: Keep in mind that the instance array gets reallocated, try to store the return value to the instance! NOT the pointer! It will become invalid!
WARNING: Try to display as few images on the window as possible, drawing too many images will cause a loss in performance!
[in] | mlx | The MLX instance handle. |
[in] | img | The image to draw on the screen. |
[in] | x | The X position. |
[in] | y | The Y position. |
Definition at line 121 of file mlx_images.c.
mlx_image_t * mlx_new_image | ( | mlx_t * | mlx, |
uint32_t | width, | ||
uint32_t | height | ||
) |
Creates and allocates a new image buffer.
[in] | mlx | The MLX instance handle. |
[in] | width | The desired width of the image. |
[in] | height | The desired height of the image. |
Definition at line 161 of file mlx_images.c.
bool mlx_resize_image | ( | mlx_image_t * | img, |
uint32_t | nwidth, | ||
uint32_t | nheight | ||
) |
Allows you to resize an image, a new pixel buffer is allocated to fit & the previous data is scaled to fit the new size.
[in] | img | The image to resize. |
[in] | nwidth | The new width. |
[in] | nheight | The new height. |
Definition at line 224 of file mlx_images.c.
void mlx_set_instance_depth | ( | mlx_instance_t * | instance, |
int32_t | zdepth | ||
) |
Sets the depth / Z axis value of an instance.
NOTE: Keep in mind that images that are on the same Z layer cut each other off. so if you don't see your image anymore make sure it's not conflicting by being on the same layer as another image.
[in] | instance | The instance on which to change the depth. |
[in] | zdepth | The new depth value. |
NOTE: The reason why we don't sort directly is that the user might call this function multiple times in a row and we don't want to sort for every change. Pre-loop wise that is.
Definition at line 105 of file mlx_images.c.