42_cub3d/algo.h
mcolonna fc2b243daa s
2024-10-15 12:56:03 +02:00

58 lines
1.8 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* algo.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mcolonna <mcolonna@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/30 15:45:59 by grobledo #+# #+# */
/* Updated: 2024/10/15 12:54:12 by mcolonna ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef ALGO_H
#define ALGO_H
#include <unistd.h>
#include <math.h>
#include <stdbool.h>
#include "Minilibx/mlx.h"
#include "Minilibx/mlx_int.h"
# include "Libft/libft.h"
#define mapWidth 24 // cases
#define mapHeight 24 // cases
#define MOVE_SPEED 0.1 // cases
#define PI 3.1415926535
#define ROT_SPEED (PI / 16) // 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
typedef struct s_ray
{
// pos player on map (cases)
double posX;
// pos player on map (cases)
double posY;
// player rotation (rad)
double rot;
} t_ray;
extern void *g_mlx;
extern void *g_win;
extern t_ray g_ray;
extern int worldMap[mapWidth][mapHeight];
void vector_from_rotation(
double *vecX, double *vecY, double angle, double norm);
int keypress(int keycode);
int render(u_int32_t *img_data);
void draw_screen(void);
#endif