-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic_fct.c
More file actions
72 lines (63 loc) · 1.21 KB
/
basic_fct.c
File metadata and controls
72 lines (63 loc) · 1.21 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
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
** basic_fct.c for rtv1 in /home/thibaud/rendu/MUL_2013_rtv1
**
** Made by thibaud
** Login <thibaud@epitech.net>
**
** Started on Wed Feb 26 14:26:20 2014 thibaud
** Last update Sun Jun 8 20:39:21 2014 romaric
*/
#include "rt.h"
int my_strcmp(char *s1, char *s2)
{
int i;
i = 0;
if (!s1)
return (-1);
else if (!s2)
return (1);
while (s1[i])
{
if (s1[i] < s2[i])
return (-1);
if (s1[i] > s2[i])
return (1);
i++;
}
if (s1[i] < s2[i])
return (-1);
if (s1[i] > s2[i])
return (1);
return (0);
}
float rad_conv(float deg)
{
float rad;
rad = deg * M_PI * 2 / 360;
return (rad);
}
int gere_expose(t_mlx *mlx)
{
mlx_put_image_to_window(mlx->mlx_ptr, mlx->win_ptr, mlx->img_ptr, 0, 0);
return (0);
}
int gere_key(int keycode, t_mlx *mlx)
{
if (keycode == 65307)
{
mlx_destroy_window(mlx->mlx_ptr, mlx->win_ptr);
exit(EXIT_SUCCESS);
}
return (0);
}
int mlx_put_pixel(char *data, int x, int y, int color)
{
char *ptr;
char *color_ptr;
ptr = data + y * 2400 + x * 4;
color_ptr = (char *)&color;
ptr[0] = color_ptr[0];
ptr[1] = color_ptr[1];
ptr[2] = color_ptr[2];
return (0);
}