-
Notifications
You must be signed in to change notification settings - Fork 0
/
gestion.c
executable file
·43 lines (38 loc) · 989 Bytes
/
gestion.c
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
/*
** gestion.c for wolf3d in /home/delaun_m/clone_army/MUL_2014_wolf3d
**
** Made by Marc DELAUNAY
** Login <[email protected]>
**
** Started on Sun Dec 21 11:13:36 2014 Marc DELAUNAY
** Last update Sun Dec 21 11:14:36 2014 Marc DELAUNAY
*/
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include "struct.h"
void put_pixel_to_image(int color, int x, int y, t_system *param)
{
int pos;
pos = y * param->image.sizeline + x * 4;
param->image.ground[pos] = color % 256;
param->image.ground[pos + 1] = (color >> 8) % 256;
param->image.ground[pos + 2] = (color >> 16) % 256;
param->image.ground[pos + 3] = 0;
}
int func_expose(t_system *param)
{
mlx_put_image_to_window(param->mlx, param->win, param->image.image, 0, 0);
return (0);
}
int func_key_pressed(int keycode, t_system *param)
{
if (keycode == 65307)
{
mlx_destroy_window(param->mlx, param->win);
exit(0);
}
movement(param, keycode);
func_expose(param);
return (0);
}