feat: Added perk logos to the left of the HUD

This commit is contained in:
Theo Champion 2025-09-03 16:38:38 +02:00
parent cd7d0ddcfc
commit 77a532a223
3 changed files with 39 additions and 2 deletions

View file

@ -6,7 +6,7 @@
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/17 14:59:37 by kcolin #+# #+# */
/* Updated: 2025/08/20 16:10:45 by tchampio ### ########.fr */
/* Updated: 2025/09/03 16:31:54 by tchampio ### ########.fr */
/* */
/* ************************************************************************** */
@ -31,6 +31,7 @@ typedef struct s_cub3d_data
t_img_data *ea_texture;
t_img_data *img_data;
t_img_data *point_figures[10];
t_img_data *perk_logos[3];
t_mapdata *map;
t_player player;
t_keypresses keypresses;

View file

@ -51,11 +51,35 @@ void draw_points(t_cub3d_data *data)
}
}
void draw_perks(t_cub3d_data *data)
{
int i;
int perk_pos;
i = 0;
perk_pos = 50;
while (i < 3)
{
if (data->player.perk_order[i] != NONE)
{
if (data->player.perk_order[i] == REVIVE)
matrix_image_put(data, data->perk_logos[1], perk_pos, HEIGHT - 200);
if (data->player.perk_order[i] == JUGGERNOG)
matrix_image_put(data, data->perk_logos[0], perk_pos, HEIGHT - 200);
if (data->player.perk_order[i] == DOUBLETAP)
matrix_image_put(data, data->perk_logos[2], perk_pos, HEIGHT - 200);
perk_pos += 50;
}
i++;
}
}
void create_hud(t_cub3d_data *data)
{
// draw points
draw_points(data);
// draw perks
draw_perks(data);
// draw weapon
// draw map
}

View file

@ -6,7 +6,7 @@
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/17 15:51:29 by kcolin #+# #+# */
/* Updated: 2025/08/13 15:31:17 by tchampio ### ########.fr */
/* Updated: 2025/09/03 16:27:17 by tchampio ### ########.fr */
/* */
/* ************************************************************************** */
@ -21,6 +21,14 @@ typedef struct s_vec2
double y;
} t_vec2;
typedef enum e_perks
{
NONE = 0,
REVIVE,
JUGGERNOG,
DOUBLETAP
} t_perks;
typedef struct s_player
{
double x;
@ -31,6 +39,10 @@ typedef struct s_player
double plane_y;
int health;
int points;
bool has_revive;
bool has_juggernog;
bool has_doubletap;
t_perks perk_order[3];
t_vec2 movement;
} t_player;