39# define PI 3.141592653589793238462643383279502884197169399375105820974944592307
44# define MINIMAP_DEFAULT_VALUE true
48# define FIELD_OF_VIEW_DEFAULT_VALUE true
52# define COLLISION_DEFAULT_VALUE true
57# define ENABLE_FILTERS true
66# define MOUSE_SENSITIVITY_FACTOR 0.001f
72# define MOVEMENT_SPEED_TURNING 0.015f
79# define MOVEMENT_SPEED_FWD_BWD 0.025f
86# define MOVEMENT_SPEED_LEFT_RIGHT 0.015f
89# define MINIMAP_PLAYER_COLOR 0xffffff00
90# define MINIMAP_PLAYER_LINE_SIGHT_COLOR 0xffffff00
91# define MINIMAP_PLAYER_CONE_SIGHT_COLOR 0xffffaaaa
92# define MINIMAP_FLOOR_COLOR 0xff000000
93# define MINIMAP_WALL_COLOR 0xffffffff
94# define MINIMAP_KEY_COLOR 0xffffff00
95# define MINIMAP_DOOR_COLOR 0xff0000ff
99# define MINIMAP_NUM_TILES_X 15
103# define MINIMAP_NUM_TILES_Y 15
104# define MINIMAP_TILE_SIZE 16
105# define MINIMAP_TILES_X 15
106# define MINIMAP_TILES_Y 15
108# define MINIMAP_PLAYER_SIZE 4
109# define MINIMAP_LINE_OF_SIGHT_FACTOR 2
115# define DEBUG_PRINT_KEYCODE 0
119# define DEBUG_PRINT_FPS 0
125# define DEBUG_FPS_REFRESH 0
130# define DEBUG_PRINT_TEXTURE_SWAP 0
135# define DEBUG_PRINT_TEXTURE_ALTERED 0
141# define CROSS_APPLY_SETTINGS 0
145# define ESCAPE_APPLY_SETTINGS 0
161int cub3d(
int argc,
char **argv);
Header file for all the types and structures of the project.
struct s_data t_data
Definition data_structure.h:32
e_screen_size
Enum used to store the screen size. It is used to set the screen size in the settings....
Definition data_structure.h:52
struct s_map_raoul t_map_raoul
Definition data_structure.h:31
struct s_args t_args
Definition data_structure.h:39
struct s_mlx t_mlx
Definition data_structure.h:29
struct s_map t_map
Definition data_structure.h:30
struct s_textures t_textures
Definition data_structure.h:27
struct s_coordinates t_coordinates
Definition data_structure.h:35
int cub_mouse_click_hook(int button, int x, int y, void *param)
Hook when the mouse is moved while clicking.
Definition ft_hooks.c:74
int cub_keydown_hook(int keycode, void *param)
Hook when a key is pressed.
Definition ft_hooks.c:21
int hook_settings_close_window(void *param)
Hook used to close window or set the window size if MACRO Enabled.
Definition ft_settings_hooks.c:19
int hook_settings_handle_mouse_motion(int x, int y, void *param)
Hook when the mouse is moved for the settings.
Definition ft_settings_hooks.c:57
int cub_keyup_hook(int keycode, void *param)
Hook when a key is released.
Definition ft_hooks.c:42
int hook_settings_handle_keypress(int keycode, void *param)
Handle mouse click in the settings window.
Definition ft_settings_hooks.c:31
int cub_mouse_hook(int x, int y, void *param)
Hook when the mouse is moved.
Definition ft_hooks.c:65
int hook_settings_handle_mouse_click(int button, int x, int y, void *param)
Hook when the mouse is moved while clicking for the settings.
Definition ft_settings_hooks.c:45
void ft_mlx_end(t_mlx *mlx)
Close and free the mlx structure.
Definition ft_free_mlx.c:18
void ft_exit(t_mlx mlx, t_map *map)
Exit the program.
char ** fill_map_region(t_map *map)
Fill the map region of the file.
Definition ft_search_map.c:40
char ** fill_config_region(t_map *map)
Fill the config region of the file.
Definition ft_search_config.c:37
char ** read_file_lines(t_map *map, char *map_name)
Read the map file line by line and return an array of strings.
Definition ft_file_fill.c:40
int cub3d(int argc, char **argv)
Main function of the cub3d project.
Definition cub3d.c:82
int ft_mlx_init(t_data *data)
Initialize the mlx structure, create settings window, and load game.
Definition ft_init_mlx.c:22
int cub_read_args(int argc, char **argv, t_args *args)
Reads and verifies the arguments passed to the program.
Definition read.c:50
size_t count_file_lines(char *file_name)
Simple function to count the number of lines in a file.
Definition ft_file_fill.c:17
t_coordinates find_position(t_map *map, const char *charset)
Find the position of the player with charset in the map.
Definition ft_map_boundaries.c:33
int is_in_bounds(char **map, size_t y, size_t x)
Check if a position is in bounds of map or not.
Definition ft_map_boundaries.c:24
size_t is_config_line(char *line)
Return a positive number if a config line is detected.
Definition ft_search_config.c:21
int validate_map(t_map *map)
Validate if the map has unclosed holes or an unfinished outer layer.
Definition ft_validate_map.c:60
t_map ft_map_check_dimensions(t_map *map, char *map_name)
Check the map structure and try to open the map file. sets error to -1 if an error occurred.
Definition ft_map_check.c:22
bool is_only_whitespace(const char *str)
Check if the string contains only whitespace characters.
Definition ft_map_utils.c:35
int is_walkable(char c)
Check if a character is walkable or not.
Definition ft_map_boundaries.c:19
void suppress_newlines(char **lines)
Suppress newlines in the given lines.
Definition ft_map_utils.c:16
t_map check_map_chars_borders(t_map *map)
Check if the map has only acceptable characters and if there is borders everywhere,...
Definition ft_map_check.c:51
t_map ft_check_config(t_map *map)
Check if the config is properly formatted or not.
Definition ft_search_config.c:66
t_map ft_check_floor_ceiling(t_map *map)
Check the floor and ceiling colors.
Definition ft_check_colors.c:96
void ft_free_settings(t_mlx *mlx)
Free all the settings variables.
Definition ft_free_mlx.c:40
enum e_screen_size circle_state(int x, int y)
Return an enum according to selected circle using coordinates.
Definition ft_settings_state.c:36
void settings_hooks(t_data *data)
Set the settings hooks on the settings window.
Definition ft_settings.c:51
int ft_set_screen_size(t_mlx *mlx, enum e_screen_size size)
Set screen size according to an enum.
Definition ft_settings.c:98
void * ft_settings(t_mlx *mlx)
Generate the window settings for the program.
Definition ft_settings.c:24
void state_machine(int keycode, t_mlx *mlx)
State machine for the settings window.
Definition ft_settings_state.c:17
uint64_t timeval_to_us(const struct timeval *tv)
Convert a timeval in microseconds.
Definition ft_time.c:29
void ft_free_textures_path(t_map *map)
Free the path (name) of the textures in memory.
Definition ft_free.c:79
void ft_free_file(t_map *map)
Free the strings of the file.
Definition ft_free.c:39
void ft_free_map(t_map_raoul *map)
Free the map structure.
Definition ft_free.c:30
void ft_free_all(t_data *data)
Free all the memory allocated for the data structure.
Definition ft_free.c:19
uint64_t get_time_ms(void)
Get time in milliseconds.
Definition ft_time.c:19
int safe_close(int *fd)
Close safely the file descriptor Modify the file descriptor to -1 after closing it.
Definition ft_safe.c:40
uint16_t count_fps(bool print)
Count the FPS and print it to the console. It will print the FPS every second if DEBUG_PRINT_FPS is s...
Definition ft_time.c:46
int try_to_open_close_file(char *file_name)
Try to open the file specified by file_name.
Definition ft_utils.c:19
void ft_free_textures(t_mlx *mlx, t_textures *textures)
Free all the textures stored in mlx structure and map struct.
Definition ft_free.c:61
size_t count_array_length(char **array)
Count the number of strings that an array have Should absolutely be NULL-Terminated.
Definition ft_utils.c:41
int safe_open(char *file_name)
Try to open the map file specified by map_name.
Definition ft_safe.c:22