-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathexample.h
58 lines (52 loc) · 2.13 KB
/
example.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* exanple.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lmarques <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/25 01:19:41 by lmarques #+# #+# */
/* Updated: 2017/04/18 23:29:23 by lmarques ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef EXAMPLE_H
# define EXAMPLE_H
# include <math.h>
# include "./minilibx/mlx.h"
/*
Defines for the width and height of your window. I suggest you to do the same so
you can change easily the size of your window later if needed.
*/
# define WIN_WIDTH 800
# define WIN_HEIGHT 600
/*
Here I built a struct of the MLX image :
It contains everything you need.
- img_ptr to store the return value of mlx_new_image
- data to store the return value of mlx_get_data_addr
- the 3 other variables are pretty much useless, but you'll need
them in the prototype of mlx_get_data_addr (see the man page for that)
*/
typedef struct s_img
{
void *img_ptr;
int *data; //Here you got an int * even though mlx_get_data_addr returns
//a char *, i'll talk more about this in the .c file.
//Here are the 3 "useless" variables. You can find more informations about these in the man page.
int size_l;
int bpp;
int endian;
} t_img;
/*
Here is my main struct containing every variables needed by the MLX.
- mlx_ptr stores the return value of mlx_init
- win stores the return value of mlx_new_window
- img will store everything we need for the image part, the struct is described above.
*/
typedef struct s_mlx
{
void *mlx_ptr;
void *win;
t_img img;
} t_mlx;
#endif