Refactor header files for consistency and clarity; update function signatures in parser.h and player.h

This commit is contained in:
whaffman 2025-06-10 19:33:05 +02:00
parent 555f2dc00c
commit c87ff10b57
7 changed files with 64 additions and 65 deletions

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* cub3d.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/15 12:22:29 by qmennen #+# #+# */
/* Updated: 2025/06/10 15:48:20 by qmennen ### ########.fr */
/* :::::::: */
/* cub3d.h :+: :+: */
/* +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/04/15 12:22:29 by qmennen #+# #+# */
/* Updated: 2025/06/10 19:29:49 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
@ -20,13 +20,13 @@
# define HEIGHT 1080
# define TITLE "Cub3D"
#ifndef FULLSCREEN
# define FULLSCREEN 1
#endif
# ifndef FULLSCREEN
# define FULLSCREEN 1
# endif
#ifndef START_STATE
# define START_STATE GAME_STATE_MENU
#endif
# ifndef START_STATE
# define START_STATE GAME_STATE_MENU
# endif
# ifndef M_PI
# define M_PI 3.14159265358979323846
@ -71,7 +71,7 @@
# include "monster.h"
int initialize_cub3d(t_game **game, const char *mapfile);
int shader_init(void);
int shader_init(void);
void set_uniforms(t_game *game);
int load_uniforms(t_game **game);
void count_scores(t_game *game);

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* game_menu.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/27 15:07:48 by qmennen #+# #+# */
/* Updated: 2025/06/10 15:20:30 by qmennen ### ########.fr */
/* :::::::: */
/* game_menu.h :+: :+: */
/* +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/05/27 15:07:48 by qmennen #+# #+# */
/* Updated: 2025/06/10 19:30:12 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
@ -22,16 +22,15 @@ mlx_image_t *menu_load_background(mlx_t *mlx, char *background_path);
void menu_set_background(t_menu *menu, mlx_t *mlx, char *b_path);
t_menu *create_main_menu(t_game_manager *manager);
t_menu *menu_create(t_game_manager *manager, char *b_path,
const t_menu_item *options[]);
const t_menu_item *options[]);
t_menu_item *menu_item_create(t_screen *screen, const char *text,
void (*act)(struct s_menu_item *item, t_game_manager *manager));
void (*act)(struct s_menu_item *item, t_game_manager *manager));
void menu_free(t_menu *menu, t_screen *screen);
void menu_toggle(t_menu *menu);
char *get_score_prefix(int index);
char *get_score_suffix(int index);
void draw_score_line(
mlx_t *mlx, mlx_image_t **img, char *text, t_vec2_int pos
);
mlx_t *mlx, mlx_image_t **img, char *text, t_vec2_int pos);
char *get_score_text(char *prefix, char *suffix, int score);
#endif

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* parser.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/19 14:41:55 by whaffman #+# #+# */
/* Updated: 2025/06/10 15:49:46 by qmennen ### ########.fr */
/* :::::::: */
/* parser.h :+: :+: */
/* +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/04/19 14:41:55 by whaffman #+# #+# */
/* Updated: 2025/06/10 18:41:08 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
@ -22,7 +22,7 @@ int is_map_line(const char *line);
unsigned int parse_color(const char *color_str);
int parse_config_line(char *line, t_map *map);
int map_width(char **lines);
int parse_tile(char c);
int parse_tile(t_game *game, char c);
int parse_map(char **lines, t_game *game);
int parse_file(char *buffer, t_game *game);
void print_config(t_map *map);
@ -30,7 +30,7 @@ int parse_map_line(char **lines, t_game *game, int i);
t_tile **copy_map(t_tile **grid, int width, int height);
char **pointer_lines(char *buffer, char c);
int valid_arguments(int argc, char **argv);
int map_entries_present(t_game *game);
int map_entries_present(t_game *game);
int handle_wall(char *token, t_map *map);
int handle_fc_color(char *token, t_map *map);
int handle_fc_texture(char *token, t_map *map);

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* player.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/15 18:53:27 by qmennen #+# #+# */
/* Updated: 2025/06/04 18:42:25 by qmennen ### ########.fr */
/* :::::::: */
/* player.h :+: :+: */
/* +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/04/15 18:53:27 by qmennen #+# #+# */
/* Updated: 2025/06/10 19:29:24 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
@ -18,7 +18,7 @@
int player_create(t_game **game);
void player_update(t_game *game, double delta_time);
void visit_area(t_game *game);
void rotate(t_player *player, double rot_speed, double delta);
void rotate(t_player *player, double rot_speed, double delta);
void interact_door(t_game *game);
#endif

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* render.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/15 16:28:16 by qmennen #+# #+# */
/* Updated: 2025/06/10 14:30:30 by qmennen ### ########.fr */
/* :::::::: */
/* render.h :+: :+: */
/* +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/04/15 16:28:16 by qmennen #+# #+# */
/* Updated: 2025/06/10 19:30:21 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
@ -15,6 +15,7 @@
# include "cub3d.h"
# define MIN_SPRITE_DIST 0.1
void render_map(t_game *game);
t_render cast_ray(t_game *game, int x);
void cast_rays(t_game *game);

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* types.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/15 15:52:44 by qmennen #+# #+# */
/* Updated: 2025/06/10 15:06:16 by qmennen ### ########.fr */
/* :::::::: */
/* types.h :+: :+: */
/* +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/04/15 15:52:44 by qmennen #+# #+# */
/* Updated: 2025/06/10 19:30:40 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
@ -202,7 +202,7 @@ typedef struct s_menu_item
void (*act)(struct s_menu_item *item, t_game_manager *manager);
} t_menu_item;
typedef struct s_menu
typedef struct s_menu
{
int selected_option;
int num_options;

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* game_manager.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/27 13:48:18 by qmennen #+# #+# */
/* Updated: 2025/06/10 15:19:59 by qmennen ### ########.fr */
/* :::::::: */
/* game_manager.c :+: :+: */
/* +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/05/27 13:48:18 by qmennen #+# #+# */
/* Updated: 2025/06/10 19:16:24 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
@ -59,7 +59,6 @@ void game_manager_destroy(t_game_manager *manager)
menu_free(manager->menu, manager->game->screen);
if (manager->end_screen)
menu_free(manager->end_screen, manager->game->screen);
print_scores(manager->game);
if (manager->game)
game_free(manager->game);
mlx_close_window(manager->game->screen->mlx);