aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsalaaad2 <arthurdurant263@gmail.com>2020-02-21 19:31:27 +0100
committersalaaad2 <arthurdurant263@gmail.com>2020-02-21 19:31:27 +0100
commit4a07369a67e3f88417ac4a309852eadaf40f23d4 (patch)
tree30d1d024c80a6e99f2358d444a2a82937262d112 /src
parentFreed leaks (diff)
download42-cub3d-4a07369a67e3f88417ac4a309852eadaf40f23d4.tar.gz
42-cub3d-4a07369a67e3f88417ac4a309852eadaf40f23d4.tar.bz2
42-cub3d-4a07369a67e3f88417ac4a309852eadaf40f23d4.tar.xz
42-cub3d-4a07369a67e3f88417ac4a309852eadaf40f23d4.tar.zst
42-cub3d-4a07369a67e3f88417ac4a309852eadaf40f23d4.zip
add threaded music
Diffstat (limited to 'src')
-rw-r--r--src/ft_detect.c3
-rw-r--r--src/ft_get_sprite.c7
-rw-r--r--src/main.c13
3 files changed, 22 insertions, 1 deletions
diff --git a/src/ft_detect.c b/src/ft_detect.c
index 10d7147..fc49a2d 100644
--- a/src/ft_detect.c
+++ b/src/ft_detect.c
@@ -74,7 +74,8 @@ void
cl->rlist.sqy += cl->mlist->y_step;
cl->rlist.side = 1;
}
- if (cl->mlist->map[cl->rlist.sqx][cl->rlist.sqy] == '1')
+ if (cl->mlist->map[cl->rlist.sqx][cl->rlist.sqy] == '1'
+ || cl->mlist->map[cl->rlist.sqx][cl->rlist.sqy] == '2')
cl->rlist.hit = 1;
}
}
diff --git a/src/ft_get_sprite.c b/src/ft_get_sprite.c
index ebf0566..43de290 100644
--- a/src/ft_get_sprite.c
+++ b/src/ft_get_sprite.c
@@ -14,6 +14,13 @@
#include <cub3d.h>
#include <stdint.h>
+void
+ ft_get_sprite_spawn(t_cub *clist)
+{
+
+ (void)clist;
+}
+
int8_t
ft_get_sprite(char **words, t_cub *clist)
{
diff --git a/src/main.c b/src/main.c
index 52bb211..ededacf 100644
--- a/src/main.c
+++ b/src/main.c
@@ -15,17 +15,30 @@
#include <cub3d.h>
#include <stddef.h>
#include <unistd.h>
+#include <pthread.h>
+#include <stdlib.h>
+
+void
+ *ft_zik(void *vargp)
+{
+ (void)vargp;
+ system("afplay revelations.mp3");
+ return NULL;
+}
int
main(int argc, const char *argv[])
{
t_cub *clist;
+ pthread_t thread_id;
if (argc < 2)
{
ft_dprintf(STDERR_FILENO, "Error\n\033[1;31mNo map selected\n\033[0m");
return (1);
}
+ pthread_create(&thread_id, NULL, ft_zik, NULL);
+ pthread_join(thread_id, NULL);
if (ft_init_cub3d(&clist) < 0)
return (2);
ft_parse_map(argv[1], clist);