cub3d/cub3d.h
2023-11-05 04:53:41 +01:00

108 lines
3.0 KiB
C

/* ************************************************************************** */
/* */
/* :::::::: */
/* cub3d.h :+: :+: */
/* +:+ */
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/10/26 10:46:35 by houtworm #+# #+# */
/* Updated: 2023/11/05 04:50:43 by houtworm ######## odam.nl */
/* */
/* ************************************************************************** */
#ifndef CUB3D_H
# define CUB3D_H
# include <unistd.h>
# include <math.h>
# include <fcntl.h>
# include "libft/libft.h"
# include "getnextline/get_next_line.h"
# include "mlx/include/MLX42/MLX42.h"
# include <stdio.h>
typedef struct s_sprite
{
double distance;
double x;
double y;
int type;
} t_sprite;
typedef struct s_varlist
{
mlx_t *mlx;
mlx_image_t *img;
mlx_image_t *fstat;
mlx_image_t *tstat;
mlx_image_t *kstat;
mlx_texture_t *curtext;
mlx_texture_t *northtext;
mlx_texture_t *easttext;
mlx_texture_t *southtext;
mlx_texture_t *westtext;
mlx_texture_t *barreltext;
mlx_texture_t *hlamptext;
mlx_texture_t *slamptext;
mlx_texture_t *treasuretext;
mlx_texture_t *endtext;
mlx_texture_t *nazitext;
t_sprite *sprite;
int spritecount;
int w;
int h;
char **map;
double frametime;
double posx;
double posy;
double dirx;
double diry;
double planex;
double planey;
int vaim;
int jump;
double run;
double raydirx;
double raydiry;
double sidedistx;
double sidedisty;
double deltadistx;
double deltadisty;
double perpwalldist;
int lineheight;
int side;
double oldmouseposx;
double oldmouseposy;
int32_t fcolor;
int32_t ccolor;
int *distance;
int treasure;
int tottreasure;
int enemies;
int kills;
int mgun;
int ggun;
} t_varlist;
void ft_frametime(t_varlist *vl);
// init.c
t_varlist initvarlist(void);
// parse.c
t_varlist ft_parseconfigfile(t_varlist vl, char *filename);
// map.c
char **ft_getmap(t_varlist *vl, int fd);
// keys.c
void ft_processinput(t_varlist *vl);
void keyhook(mlx_key_data_t kd, void *param);
void scrollhook(double xdelta, double ydelta, void *param);
void resizehook(int x, int y, void *param);
void cursorhook(double x, double y, void *param);
// raycast.c
void ft_drawwalls(t_varlist *vl);
// draw.c
void ft_drawline(int x, t_varlist *vl, int drawstart, int drawend);
void ft_drawsprites(t_varlist *vl);
// error.c
int ft_errorexit(char *reason, char *function, int code);
#endif