MLX42
1.0
MLX42
Loading...
Searching...
No Matches
mlx_exit.c
Go to the documentation of this file.
1
/* ************************************************************************** */
2
/* */
3
/* :::::::: */
4
/* mlx_exit.c :+: :+: */
5
/* +:+ */
6
/* By: W2Wizard <main@w2wizard.dev> +#+ */
7
/* +#+ */
8
/* Created: 2021/12/28 02:43:22 by W2Wizard #+# #+# */
9
/* Updated: 2023/06/08 18:12:20 by XEDGit ######## odam.nl */
10
/* */
11
/* ************************************************************************** */
12
13
#include "
MLX42/MLX42_Int.h
"
14
15
//= Private =//
16
17
static
void
mlx_free_image
(
void
* content)
18
{
19
mlx_image_t
*
img
= content;
20
21
mlx_freen
(4,
img
->context,
img
->pixels,
img
->instances,
img
);
22
}
23
24
//= Public =//
25
26
void
mlx_close_window
(
mlx_t
*
mlx
)
27
{
28
MLX_NONNULL
(
mlx
);
29
glfwSetWindowShouldClose
(
mlx
->
window
,
true
);
30
}
31
32
/**
33
* All of glfw & glads resources are cleaned up by the terminate function.
34
* Now it's time to clean up our own mess.
35
*/
36
void
mlx_terminate
(
mlx_t
*
mlx
)
37
{
38
MLX_NONNULL
(
mlx
);
39
40
mlx_ctx_t
*
const
mlxctx
=
mlx
->
context
;
41
42
glUseProgram
(0);
43
glLinkProgram
(
mlxctx
->shaderprogram);
44
glDeleteProgram
(
mlxctx
->shaderprogram);
45
glfwTerminate
();
46
mlx_lstclear
((
mlx_list_t
**)(&
mlxctx
->hooks), &
free
);
47
mlx_lstclear
((
mlx_list_t
**)(&
mlxctx
->render_queue), &
free
);
48
mlx_lstclear
((
mlx_list_t
**)(&
mlxctx
->images), &
mlx_free_image
);
49
mlx_freen
(2,
mlxctx
,
mlx
);
50
}
MLX42_Int.h
MLX_NONNULL
#define MLX_NONNULL(var)
Definition
MLX42_Int.h:46
mlx_lstclear
void mlx_lstclear(mlx_list_t **lst, void(*del)(void *))
Definition
mlx_list.c:33
mlx_freen
bool mlx_freen(int32_t count,...)
Definition
mlx_utils.c:89
glDeleteProgram
#define glDeleteProgram
Definition
glad.h:3359
length
GLuint GLsizei GLsizei * length
Definition
glad.h:3372
glLinkProgram
#define glLinkProgram
Definition
glad.h:3428
glUseProgram
#define glUseProgram
Definition
glad.h:3434
img
GLint void * img
Definition
glad.h:3003
mlx_close_window
void mlx_close_window(mlx_t *mlx)
Definition
mlx_exit.c:26
mlx_free_image
static void mlx_free_image(void *content)
Definition
mlx_exit.c:17
mlx_terminate
void mlx_terminate(mlx_t *mlx)
Definition
mlx_exit.c:36
mlx_ctx
Definition
MLX42_Int.h:173
mlx_image
Definition
MLX42.h:341
mlx_list
Definition
MLX42_Int.h:86
mlx
Definition
MLX42.h:361
mlx::context
void * context
Definition
MLX42.h:363
mlx::window
void * window
Definition
MLX42.h:362
lib
MLX42
src
mlx_exit.c
Generated by
1.9.8