71 lines
2.1 KiB
C
71 lines
2.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* algo.h :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: mcolonna <mcolonna@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2024/09/30 15:45:59 by grobledo #+# #+# */
|
|
/* Updated: 2024/10/15 16:57:48 by mcolonna ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#ifndef ALGO_H
|
|
# define ALGO_H
|
|
|
|
# include <unistd.h>
|
|
# include <math.h>
|
|
# include <linux/types.h>
|
|
# include <stdbool.h>
|
|
# include "Minilibx/mlx.h"
|
|
# include "Minilibx/mlx_int.h"
|
|
# include "Libft/libft.h"
|
|
|
|
# include "stream.h"
|
|
# include "read_all_text.h"
|
|
# include "map.h"
|
|
# include "map_mapping.h"
|
|
|
|
# define MAP_WIDTH 24 // cases (TODO test)
|
|
# define MAP_HEIGHT 24 // cases (TODO test)
|
|
# define TEX_WIDTH 64
|
|
# define TEX_HEIGHT 64
|
|
# define MOVE_SPEED 0.1 // cases
|
|
# define PI 3.1415926535
|
|
# define ROT_SPEED_DIVIDE_PI 16 // pi/n rad
|
|
# define COLOR_WALL 0xFF0000 // 0xRRGGBB
|
|
# define COLOR_CEILING 0x29f8ff // 0xRRGGBB
|
|
# define COLOR_FLOOR 0xFF985C // 0xRRGGBB
|
|
# define SCREEN_WIDTH 640 // px
|
|
# define SCREEN_HEIGHT 480 // px
|
|
# define FOV 0.66 // ? TODO unit
|
|
|
|
extern void *g_mlx;
|
|
extern void *g_win;
|
|
extern t_player g_player;
|
|
extern t_map g_map;
|
|
|
|
typedef struct s_tex
|
|
{
|
|
void *tex_north;
|
|
void *tex_south;
|
|
void *tex_east;
|
|
void *tex_west;
|
|
void *current_tex;
|
|
|
|
} t_tex;
|
|
|
|
/// @brief Write an error message on stderr.
|
|
///
|
|
/// @param str... All the strings to write. The last parameter MUST BE NULL.
|
|
void write_err(const char *str, ...);
|
|
|
|
void vector_from_rotation(t_point_double *vec, double angle, double norm);
|
|
|
|
int keypress(int keycode);
|
|
|
|
int render(u_int32_t *img_data);
|
|
|
|
void draw_screen(void);
|
|
|
|
#endif
|