aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-11 12:48:34 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-11 12:48:34 +0100
commit878b565e98728dcd0fba8dfeeba8b1ff46dbd5cd (patch)
tree7d653540bc4cb91d53cf7261deca736743843276
parentPretty cool animation (diff)
download42-cub3d-878b565e98728dcd0fba8dfeeba8b1ff46dbd5cd.tar.gz
42-cub3d-878b565e98728dcd0fba8dfeeba8b1ff46dbd5cd.tar.bz2
42-cub3d-878b565e98728dcd0fba8dfeeba8b1ff46dbd5cd.tar.xz
42-cub3d-878b565e98728dcd0fba8dfeeba8b1ff46dbd5cd.tar.zst
42-cub3d-878b565e98728dcd0fba8dfeeba8b1ff46dbd5cd.zip
Tweaked suff animation
-rw-r--r--src/ft_key_loop.c1
-rw-r--r--src/ft_suffer_animation.c38
2 files changed, 22 insertions, 17 deletions
diff --git a/src/ft_key_loop.c b/src/ft_key_loop.c
index 29718df..e0c2c28 100644
--- a/src/ft_key_loop.c
+++ b/src/ft_key_loop.c
@@ -43,7 +43,6 @@ static uint64_t
return ((uint64_t)pl->pos_y);
}
-#include <stdio.h>
static void
ft_collision(float old_y, float old_x, int32_t key, t_cub *cl)
{
diff --git a/src/ft_suffer_animation.c b/src/ft_suffer_animation.c
index bb69b4b..4e77ca7 100644
--- a/src/ft_suffer_animation.c
+++ b/src/ft_suffer_animation.c
@@ -20,25 +20,31 @@ void
{
uint16_t x;
uint16_t y;
+ uint8_t i;
- cl->img.img = mlx_new_image(cl->wlist.wlx,
- cl->wlist.x_size, cl->wlist.y_size);
- cl->img.ptr = mlx_get_data_addr(cl->img.img, &cl->img.bpp,
- &cl->img.sizeline, &cl->img.endian);
- x = 0;
- y = 0;
- while (y < cl->wlist.y_size)
+ i = 0;
+ while (i < 8)
{
- while (x < cl->wlist.x_size)
+ cl->img.img = mlx_new_image(cl->wlist.wlx,
+ cl->wlist.x_size, cl->wlist.y_size);
+ cl->img.ptr = mlx_get_data_addr(cl->img.img, &cl->img.bpp,
+ &cl->img.sizeline, &cl->img.endian);
+ x = 0;
+ y = 0;
+ while (y < cl->wlist.y_size)
{
- *(int*)(cl->img.ptr +
- (x * 4 + (y * cl->img.sizeline))) = 0x00ce1212;
- x++;
+ while (x < cl->wlist.x_size)
+ {
+ *(int*)(cl->img.ptr +
+ (x * 4 + (y * cl->img.sizeline))) = 0x00ce1212;
+ x++;
+ }
+ x = 0;
+ y++;
}
- x = 0;
- y++;
+ mlx_put_image_to_window(cl->wlist.wlx,
+ cl->wlist.winptr, cl->img.img, 0, 0);
+ mlx_destroy_image(cl->wlist.wlx, cl->img.img);
+ i++;
}
- mlx_put_image_to_window(cl->wlist.wlx,
- cl->wlist.winptr, cl->img.img, 0, 0);
- mlx_destroy_image(cl->wlist.wlx, cl->img.img);
}