-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfractol_utils.c
More file actions
59 lines (49 loc) · 1.58 KB
/
fractol_utils.c
File metadata and controls
59 lines (49 loc) · 1.58 KB
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
59
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fractol_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kdrissi- <kdrissi-@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/23 20:12:05 by kdrissi- #+# #+# */
/* Updated: 2022/06/26 02:58:58 by kdrissi- ### ########.fr */
/* */
/* ************************************************************************** */
#include "fractol.h"
int ft_strlen(char *str)
{
int i;
i = 0;
while (str[i])
i++;
return (i);
}
void my_mlx_pixel_put(t_data *data, int x, int y, int color)
{
char *dst;
dst = data->addr + (y * data->line_length + x * (data->bpp / 8));
*(unsigned int*)dst = color;
}
int key_pressed(int key, t_mlx *mlx)
{
if (key == 53)
exit_success(mlx);
return (0);
}
int ft_strcmp(char *s1, char *s2)
{
int i;
i = 0;
while (i < ft_strlen(s1) && i < ft_strlen(s2) && s1[i] == s2[i])
i++;
return (s1[i] - s2[i]);
}
int exit_success(t_mlx *mlx)
{
mlx_destroy_window(mlx->ptr, mlx->win);
exit(0);
}
int create_trgb(int t, int r, int g, int b)
{
return (t << 24 | r << 16 | g << 8 | b);
}