-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhandle_fts.c
58 lines (54 loc) · 2.08 KB
/
handle_fts.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* handle_fts.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rng <rng@student.42kl.edu.my> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/12/05 15:26:09 by rng #+# #+# */
/* Updated: 2024/12/05 15:26:19 by rng ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub3d.h"
void render_screen(t_game *game)
{
int x;
x = 0;
draw_ceiling(game);
draw_floor(game);
while (x < WIN_WIDTH)
{
raycasting(game, x);
draw_line(game, x);
x++;
}
mlx_put_image_to_window(game->mlx, game->window,
game->screen.img_ptr, 0, 0);
}
void change_movement_status(t_game *game, int keycode, int status)
{
if (keycode == RIGHT && status == 1)
game->movement.rot_right = true;
else if (keycode == RIGHT && status == 0)
game->movement.rot_right = false;
else if (keycode == LEFT && status == 1)
game->movement.rot_left = true;
else if (keycode == LEFT && status == 0)
game->movement.rot_left = false;
else if (keycode == WKEY && status == 1)
game->movement.front = true;
else if (keycode == WKEY && status == 0)
game->movement.front = false;
else if (keycode == SKEY && status == 1)
game->movement.back = true;
else if (keycode == SKEY && status == 0)
game->movement.back = false;
else if (keycode == AKEY && status == 1)
game->movement.left = true;
else if (keycode == AKEY && status == 0)
game->movement.left = false;
else if (keycode == DKEY && status == 1)
game->movement.right = true;
else if (keycode == DKEY && status == 0)
game->movement.right = false;
}