cub3d/cub3d.h
2023-11-04 04:40:26 +01:00

118 lines
3.1 KiB
C

/* ************************************************************************** */
/* */
/* :::::::: */
/* cub3d.h :+: :+: */
/* +:+ */
/* By: houtworm <codam@houtworm.net> +#+ */
/* +#+ */
/* Created: 2023/10/26 10:46:35 by houtworm #+# #+# */
/* Updated: 2023/11/04 04:36:12 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 *fps;
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 fpsrefresh;
int w;
int h;
char **map;
double frametime;
double posx;
double posy;
double dirx;
double diry;
double planex;
double planey;
double camerax;
double cameray;
int hoffset;
double raydirx;
double raydiry;
double movespeed;
double rotspeed;
int mapx;
int mapy;
double sidedistx;
double sidedisty;
double deltadistx;
double deltadisty;
double perpwalldist;
int lineheight;
int stepx;
int stepy;
int hit;
int side;
double run;
double oldmouseposx;
double oldmouseposy;
int32_t fcolor;
int32_t ccolor;
int resize;
int *zbuffer;
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_movementkeys(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_raycast(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