intra to gitea
This commit is contained in:
+92
-32
@@ -45,7 +45,7 @@ typedef struct s_colors
|
||||
{
|
||||
int floor;
|
||||
int ceil;
|
||||
int wall_nsew[4]; /* 0:N 1:S 2:E 3:W → couleurs simples pour l’instant */
|
||||
int wall_nsew[4];
|
||||
} t_colors;
|
||||
|
||||
/* Entrées clavier (état des touches) */
|
||||
@@ -64,7 +64,7 @@ typedef struct s_world
|
||||
{
|
||||
int w;
|
||||
int h;
|
||||
char **grid; /* '0' vide, '1' mur */
|
||||
char **grid;
|
||||
} t_world;
|
||||
|
||||
/* Caméra / joueur (Raycasting) */
|
||||
@@ -102,56 +102,116 @@ typedef struct s_game
|
||||
double move_speed;
|
||||
double rot_speed;
|
||||
|
||||
/* --- Textures --- */
|
||||
t_tex tex[4]; /* 0:N 1:S 2:E 3:W */
|
||||
int has_tex; /* 1 si chargées OK */
|
||||
|
||||
/* Pour le cleanup */
|
||||
t_data *data; /* pointeur vers data pour cleanup */
|
||||
t_tex tex[4];
|
||||
int has_tex;
|
||||
|
||||
t_data *data;
|
||||
} t_game;
|
||||
|
||||
typedef struct s_texpaths
|
||||
{
|
||||
const char *no;
|
||||
const char *so;
|
||||
const char *we;
|
||||
const char *ea;
|
||||
} t_texpaths;
|
||||
|
||||
typedef struct s_player_init
|
||||
{
|
||||
double px;
|
||||
double py;
|
||||
double dx;
|
||||
double dy;
|
||||
} t_player_init;
|
||||
|
||||
typedef struct s_texline
|
||||
{
|
||||
t_tex *tex;
|
||||
int tex_x;
|
||||
double step;
|
||||
double tex_pos;
|
||||
int y0;
|
||||
int y1;
|
||||
} t_texline;
|
||||
|
||||
typedef struct s_vline
|
||||
{
|
||||
int y0;
|
||||
int y1;
|
||||
int color;
|
||||
} t_vline;
|
||||
|
||||
typedef struct s_ray
|
||||
{
|
||||
double ray_dir_x;
|
||||
double ray_dir_y;
|
||||
int map_x;
|
||||
int map_y;
|
||||
double delta_dist_x;
|
||||
double delta_dist_y;
|
||||
double side_dist_x;
|
||||
double side_dist_y;
|
||||
int step_x;
|
||||
int step_y;
|
||||
int side;
|
||||
int tex_id;
|
||||
} t_ray;
|
||||
|
||||
typedef struct s_col
|
||||
{
|
||||
int draw_start;
|
||||
int draw_end;
|
||||
int line_h;
|
||||
double perp_dist;
|
||||
} t_col;
|
||||
|
||||
typedef struct s_texdraw
|
||||
{
|
||||
int x;
|
||||
t_ray *r;
|
||||
t_tex *t;
|
||||
t_col c;
|
||||
} t_texdraw;
|
||||
|
||||
/* init.c */
|
||||
int init_window(t_game *g, int w, int h, char *title);
|
||||
void cleanup_window(t_game *g);
|
||||
int init_window(t_game *g, int w, int h, char *title);
|
||||
void cleanup_window(t_game *g);
|
||||
|
||||
/* hooks.c */
|
||||
int on_destroy(t_game *g);
|
||||
int on_keydown(int key, t_game *g);
|
||||
int on_keyup(int key, t_game *g);
|
||||
void setup_hooks(t_game *g);
|
||||
int on_destroy(t_game *g);
|
||||
int on_keydown(int key, t_game *g);
|
||||
int on_keyup(int key, t_game *g);
|
||||
void setup_hooks(t_game *g);
|
||||
|
||||
/* image.c */
|
||||
void img_put_pixel(t_img *img, int x, int y, int color);
|
||||
void img_put_pixel(t_img *img, int x, int y, int color);
|
||||
|
||||
/* draw.c */
|
||||
void draw_background(t_game *g);
|
||||
void draw_vline(t_game *g, int x, int y0, int y1, int color);
|
||||
void draw_background(t_game *g);
|
||||
void draw_vline(t_game *g, int x, t_vline v);
|
||||
|
||||
/* world.c */
|
||||
int world_init_demo(t_world *w);
|
||||
void world_free(t_world *w);
|
||||
// int world_init_demo(t_world *w);
|
||||
void world_free(t_world *w);
|
||||
|
||||
/* player.c */
|
||||
void player_init(t_game *g, double px, double py, double dx, double dy);
|
||||
void player_update(t_game *g);
|
||||
void player_init(t_game *g, t_player_init p);
|
||||
void player_update(t_game *g);
|
||||
|
||||
/* raycast.c */
|
||||
void raycast_frame(t_game *g);
|
||||
void raycast_frame(t_game *g);
|
||||
|
||||
/* loop.c */
|
||||
int game_loop(t_game *g);
|
||||
int game_loop(t_game *g);
|
||||
|
||||
/* textures.c */
|
||||
int textures_load(t_game *g, const char *no, const char *so,
|
||||
const char *we, const char *ea);
|
||||
void textures_free(t_game *g);
|
||||
unsigned int tex_get_pixel(t_tex *t, int x, int y);
|
||||
int textures_load(t_game *g, t_texpaths *paths);
|
||||
void textures_free(t_game *g);
|
||||
unsigned int tex_get_pixel(t_tex *t, int x, int y);
|
||||
|
||||
/* draw.c */
|
||||
void draw_background(t_game *g);
|
||||
void draw_vline(t_game *g, int x, int y0, int y1, int color);
|
||||
void draw_tex_vline(t_game *g, int x, int y0, int y1,
|
||||
t_tex *tex, int tex_x, double step, double tex_pos);
|
||||
|
||||
void draw_background(t_game *g);
|
||||
void draw_tex_vline(t_game *g, int x, t_texline l);
|
||||
void draw_column(t_game *g, int x, t_ray *r);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user