42_cub3d/include/input.h
2024-11-07 18:03:38 +01:00

51 lines
1.7 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* input.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mc <mc@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/17 14:43:09 by mcolonna #+# #+# */
/* Updated: 2024/11/07 17:13:28 by mc ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef INPUT_H
# define INPUT_H
# include "include.h"
/// @brief For g_input_actions
typedef struct s_input_actions
{
bool left;
bool right;
bool up;
bool down;
bool quit;
int rotate;
} t_input_actions;
/// @brief Modified by the input of the user. A value becomes true
/// when the user presses the corresponding key.
extern t_input_actions g_input_actions;
/// @brief To call when a specific key is newly pressed.
///
/// @param keycode Key pressed.
/// @return Unused.
int hook_keypress(int keycode);
/// @brief To call when a specific key is released.
///
/// @param keycode Key released.
/// @return Unused.
int hook_keyrelease(int keycode);
/// @brief To handle the input of a window.
///
/// @param mlx_ptr mlx connection identifier
/// @param win_ptr Reference to the window to use.
void input_init(void *mlx_ptr, void *win_ptr);
#endif