mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 09:58:09 +01:00
added keyrelease event
This commit is contained in:
parent
a58783350d
commit
3b495f213f
1 changed files with 16 additions and 1 deletions
17
src/main.c
17
src/main.c
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: tchampio <tchampio@student.42lehavre. +#+ +:+ +#+ */
|
/* By: tchampio <tchampio@student.42lehavre. +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/05/06 13:16:11 by tchampio #+# #+# */
|
/* Created: 2025/05/06 13:16:11 by tchampio #+# #+# */
|
||||||
/* Updated: 2025/07/09 17:07:29 by tchampio ### ########.fr */
|
/* Updated: 2025/07/09 17:09:01 by tchampio ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -79,6 +79,21 @@ int keypress_handler(int keycode, t_cub3d_data *data)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int keyrelease_handler(int keycode, t_cub3d_data *data)
|
||||||
|
{
|
||||||
|
if (keycode == XK_Escape)
|
||||||
|
destroy(data);
|
||||||
|
else if (keycode == XK_a)
|
||||||
|
data->player.movement.x = 0;
|
||||||
|
else if (keycode == XK_d)
|
||||||
|
data->player.movement.x = 0;
|
||||||
|
else if (keycode == XK_w)
|
||||||
|
data->player.movement.y = 0;
|
||||||
|
else if (keycode == XK_s)
|
||||||
|
data->player.movement.y = 0;
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
void draw_map(t_mapdata *map, t_mlx_data *data)
|
void draw_map(t_mapdata *map, t_mlx_data *data)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue