Skip to content

Commit

Permalink
refactor[game_utils.c]: Add key and mouse event handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathalia Vitoria Buchholz committed Feb 20, 2025
1 parent ac5cea5 commit db2c01d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# By: nbuchhol <nbuchhol@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2025/01/03 12:09:52 by nbuchhol #+# #+# #
# Updated: 2025/02/17 14:43:45 by nbuchhol ### ########.fr #
# Updated: 2025/02/20 01:02:25 by nbuchhol ### ########.fr #
# #
# **************************************************************************** #

Expand All @@ -23,6 +23,7 @@ SRC = src/error_handling.c \
src/get_next_line/get_next_line.c \
src/free_map.c \
src/validate_map.c \
src/utils.c \
src/so_long.c
OBJ = ${SRC:.c=.o}
SUB_DIRS = libft minilibx
Expand Down
4 changes: 3 additions & 1 deletion includes/so_long.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: nbuchhol <nbuchhol@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/01/03 12:15:22 by nbuchhol #+# #+# */
/* Updated: 2025/02/18 14:59:58 by nbuchhol ### ########.fr */
/* Updated: 2025/02/20 01:29:51 by nbuchhol ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -72,6 +72,8 @@ char **load_map(int map_fd, t_game *game);
int error_handling(int error_code);
int valid_map(char *map, t_game *game);
void open_screen(t_game *game);
int key_handle(int keycode);
int mouse_handle(t_classMlx *mlx);

#endif // SO_LONG

4 changes: 3 additions & 1 deletion src/game_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: nbuchhol <nbuchhol@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/03 17:05:29 by nbuchhol #+# #+# */
/* Updated: 2025/02/19 23:41:39 by nbuchhol ### ########.fr */
/* Updated: 2025/02/20 01:28:35 by nbuchhol ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -82,6 +82,8 @@ void open_screen(t_game *game)
mlx_class.win = mlx_new_window(mlx_class.mlx, win_w, win_h, "Hello world!");
initialize_sprites(&mlx_class);
put_map(game, &mlx_class);
mlx_key_hook(mlx_class.win, key_handle, &mlx_class);
mlx_hook(mlx_class.win, 17, 0, mouse_handle, &mlx_class);
mlx_loop(mlx_class.mlx);
}

Expand Down

0 comments on commit db2c01d

Please sign in to comment.