aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_suffer_animation.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-11 12:38:21 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-11 12:38:21 +0100
commitb236416db21d03f7749e1c80d5b7abee70ea07d5 (patch)
tree69d7ddceef69415ec70bf383f1365552b8b8c7e1 /src/ft_suffer_animation.c
parentPerfect collision on them traps (diff)
download42-cub3d-b236416db21d03f7749e1c80d5b7abee70ea07d5.tar.gz
42-cub3d-b236416db21d03f7749e1c80d5b7abee70ea07d5.tar.bz2
42-cub3d-b236416db21d03f7749e1c80d5b7abee70ea07d5.tar.xz
42-cub3d-b236416db21d03f7749e1c80d5b7abee70ea07d5.tar.zst
42-cub3d-b236416db21d03f7749e1c80d5b7abee70ea07d5.zip
Pretty cool animation
Diffstat (limited to '')
-rw-r--r--src/ft_suffer_animation.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/ft_suffer_animation.c b/src/ft_suffer_animation.c
new file mode 100644
index 0000000..bb69b4b
--- /dev/null
+++ b/src/ft_suffer_animation.c
@@ -0,0 +1,44 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_key_loop.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/02/17 20:06:26 by rbousset #+# #+# */
+/* Updated: 2020/02/17 20:06:29 by rbousset ### ########lyon.fr */
+/* */
+/* ************************************************************************** */
+
+#include <libft.h>
+#include <cub3d.h>
+#include <mlx.h>
+#include <stdint.h>
+
+void
+ ft_suffer_animation(t_cub *cl)
+{
+ uint16_t x;
+ uint16_t y;
+
+ 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)
+ {
+ while (x < cl->wlist.x_size)
+ {
+ *(int*)(cl->img.ptr +
+ (x * 4 + (y * cl->img.sizeline))) = 0x00ce1212;
+ x++;
+ }
+ 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);
+}