Skip to content

Commit

Permalink
Inserting function to print background correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
pedromelocf committed Nov 4, 2024
1 parent 43def77 commit 8c05a4c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions includes/cub3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,6 @@ void draw_box(mlx_image_t *image, int height, int width, int beginx, int beginy,
void draw_player_minimap (mlx_image_t *image, t_cub3d *s_cub3d);
void handle_key_hooks(t_cub3d *s_cub3d);
void draw_line(mlx_image_t *image, int beginx, int beginy, int endx, int endy, float angle);
void draw_background(t_cub3d *s_cub3d);

#endif
5 changes: 5 additions & 0 deletions sources/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,8 @@ void line(mlx_image_t *image, int x1, int y1, int x2, int y2)
}
}

void draw_background(t_cub3d *s_cub3d)
{
draw_box(s_cub3d->image, HEIGHT / 2, WIDTH, 0, 0, RED_COLOR);
draw_box(s_cub3d->image, HEIGHT / 2, WIDTH, 0,HEIGHT / 2, 0xDC6400FF);
}
2 changes: 1 addition & 1 deletion sources/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ int main()
if (handle_mlx(&s_cub3d.mlx, &s_cub3d.image))
return (EXIT_FAILURE);

draw_box(s_cub3d.image, HEIGHT, WIDTH, 0, 0, BLACK_COLOR);
draw_player_minimap(s_cub3d.image, &s_cub3d);
mlx_loop_hook(s_cub3d.mlx, (void *)handle_key_hooks, &s_cub3d);
mlx_loop(s_cub3d.mlx);
Expand All @@ -40,6 +39,7 @@ void draw_player_minimap (mlx_image_t *image, t_cub3d *s_cub3d)
int x = 0;
int y = 0;

draw_background(s_cub3d);
while (y < 8) // change 8 to map height
{
x = 0;
Expand Down

0 comments on commit 8c05a4c

Please sign in to comment.