/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* sprite.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: tchampio +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/08/05 12:59:44 by tchampio #+# #+# */ /* Updated: 2025/08/13 14:44:02 by tchampio ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef SPRITE_H # define SPRITE_H # include "../draw/img_data.h" typedef enum e_sprite_type { ZOMBIE, PERK, BOX, OTHER } t_sprite_type; /* * x - real position for the sprite * y - real position for the sprite * image - texture * img_width - width of texture * img_height - height of texture * sprite_pos_x - Position of the sprite relative to the player * sprite_pos_y - Position of the sprite relative to the player * inv_det - Inversion of the matrix (playerpos and spritepos) * transform_x - Result of the inversion * transform_y - Result of the inversion * sprite_screen_x - Position of the sprite on screen (horizontal) * sprite_height - height of the sprite on screen * sprite_draw_start_y - for the while loop when rendering (col) * sprite_draw_end_y - for the while loop when rendering (col) * sprite_width - width of the sprite on screen * sprite_draw_start_x - for the while loop when rendering (row) * sprite_draw_end_x - for the while loop when rendering (row) */ typedef struct s_sprite { double x; double y; t_img_data *image; int img_width; int img_height; double sprite_pos_x; double sprite_pos_y; double inv_det; double transform_x; double transform_y; int sprite_screen_x; int sprite_height; int sprite_draw_start_y; int sprite_draw_end_y; int sprite_width; int sprite_draw_start_x; int sprite_draw_end_x; t_sprite_type sprite_type; } t_sprite; #endif // SPRITE_H