All the functions used to help the program.
More...
|
| int | safe_open (char *file_name) |
| | Try to open the map file specified by map_name.
|
| |
| int | safe_close (int *fd) |
| | Close safely the file descriptor Modify the file descriptor to -1 after closing it.
|
| |
| int | try_to_open_close_file (char *file_name) |
| | Try to open the file specified by file_name.
|
| |
| size_t | count_array_length (char **array) |
| | Count the number of strings that an array have Should absolutely be NULL-Terminated.
|
| |
| void | ft_free_all (t_data *data) |
| | Free all the memory allocated for the data structure.
|
| |
| void | ft_free_file (t_map *map) |
| | Free the strings of the file.
|
| |
| void | ft_free_textures (t_mlx *mlx, t_textures *textures) |
| | Free all the textures stored in mlx structure and map struct.
|
| |
| void | ft_free_textures_path (t_map *map) |
| | Free the path (name) of the textures in memory.
|
| |
| void | ft_free_map (t_map_raoul *map) |
| | Free the map structure.
|
| |
| uint64_t | get_time_ms (void) |
| | Get time in milliseconds.
|
| |
| uint64_t | timeval_to_us (const struct timeval *tv) |
| | Convert a timeval in microseconds.
|
| |
| 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 set to 1.
|
| |
| float | absf (float n) |
| | Returns the absolute value of a float.
|
| |
| int | abs (int n) |
| | Returns the absolute value of an int.
|
| |
| int | max (int a, int b) |
| | Returns the highest value between a and b.
|
| |
| double | mind (double a, double b) |
| | Returns the lowest value between doubles a and b.
|
| |
| t_vec2 | vec2rotate (t_vec2 vec, float angle) |
| | Returns a new vector rotated according to the angle.
|
| |
All the functions used to help the program.
◆ abs()
Returns the absolute value of an int.
- Parameters
-
- Returns
- float absolute vale of n
◆ absf()
Returns the absolute value of a float.
- Parameters
-
- Returns
- float absolute value of n
◆ count_array_length()
| size_t count_array_length |
( |
char ** | array | ) |
|
Count the number of strings that an array have Should absolutely be NULL-Terminated.
- Parameters
-
- Returns
- size_t number of strings
◆ count_fps()
| 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 set to 1.
- Parameters
-
| print | 1 to print the FPS, 0 otherwise |
- Returns
- uint16_t the current FPS
◆ ft_free_all()
| void ft_free_all |
( |
t_data * | data | ) |
|
Free all the memory allocated for the data structure.
- Parameters
-
◆ ft_free_file()
| void ft_free_file |
( |
t_map * | map | ) |
|
Free the strings of the file.
- Parameters
-
◆ ft_free_map()
Free the map structure.
- Parameters
-
◆ ft_free_textures()
Free all the textures stored in mlx structure and map struct.
- Parameters
-
| mlx | mlx structure |
| textures | textures structure |
◆ ft_free_textures_path()
| void ft_free_textures_path |
( |
t_map * | map | ) |
|
Free the path (name) of the textures in memory.
- Parameters
-
◆ get_time_ms()
| uint64_t get_time_ms |
( |
void | | ) |
|
Get time in milliseconds.
- Returns
- uint64_t milliseconds
◆ max()
Returns the highest value between a and b.
- Parameters
-
| [in] | a | first value |
| [in] | b | second value |
- Returns
- int highest between a and b
◆ mind()
| double mind |
( |
double | a, |
|
|
double | b ) |
Returns the lowest value between doubles a and b.
- Parameters
-
| [in] | a | first value |
| [in] | b | second value |
- Returns
- int lowest between a and b
◆ safe_close()
| int safe_close |
( |
int * | fd | ) |
|
Close safely the file descriptor Modify the file descriptor to -1 after closing it.
- Parameters
-
| fd | pointer to the file descriptor to close |
- Returns
- int 0 OK, -1 if an error occurred
◆ safe_open()
| int safe_open |
( |
char * | file_name | ) |
|
Try to open the map file specified by map_name.
- Parameters
-
| file_name | file name to open |
- Returns
- int fd=OK, -1 if an error occurred
◆ timeval_to_us()
| uint64_t timeval_to_us |
( |
const struct timeval * | tv | ) |
|
Convert a timeval in microseconds.
- Returns
- uint64_t microseconds
◆ try_to_open_close_file()
| int try_to_open_close_file |
( |
char * | file_name | ) |
|
Try to open the file specified by file_name.
- Parameters
-
| file_name | map file name to open |
- Returns
- int 1 OK, 0 if an error occurred
◆ vec2rotate()
Returns a new vector rotated according to the angle.
- Parameters
-
| [in] | vec | vector |
| [in] | angle | angle |
- Returns
- t_vec2 vector rotated