mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 01:48:08 +01:00
feat: Made sprites dynamic in memory and allocated in heap
This commit is contained in:
parent
2e0fd93831
commit
10576f5751
5 changed files with 35 additions and 76 deletions
14
src/main.c
14
src/main.c
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/07/17 14:14:30 by kcolin #+# #+# */
|
||||
/* Updated: 2025/08/06 13:36:07 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/08/07 12:27:47 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -61,9 +61,15 @@ int main(int argc, char **argv)
|
|||
return (ft_printf("Error: Missing cub3d file\n"), 1);
|
||||
init_cub3d_data(&data, argv);
|
||||
// placing a sprite next to player to ease debugging
|
||||
data.static_sprite[0].x = data.map->startx + 1;
|
||||
data.static_sprite[0].y = data.map->starty;
|
||||
data.static_sprite[0].image = load_single_texture(&data, "ressources/box_no_transparent.xpm");
|
||||
data.sprite_list = ft_calloc(sizeof(t_sprite *), 3);
|
||||
data.sprite_list[0] = ft_calloc(sizeof(t_sprite), 1);
|
||||
data.sprite_list[1] = ft_calloc(sizeof(t_sprite), 1);
|
||||
data.sprite_list[0]->x = data.map->startx + 1;
|
||||
data.sprite_list[0]->y = data.map->starty;
|
||||
data.sprite_list[0]->image = load_single_texture(&data, "ressources/box.xpm");
|
||||
data.sprite_list[1]->x = data.map->startx;
|
||||
data.sprite_list[1]->y = data.map->starty - 2;
|
||||
data.sprite_list[1]->image = load_single_texture(&data, "ressources/test.xpm");
|
||||
mlx_hook(data.mlx_win, KeyPress, KeyPressMask, keypress_handler, &data);
|
||||
mlx_hook(data.mlx_win, KeyRelease, KeyReleaseMask,
|
||||
keyrelease_handler, &data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue