Compare commits

..

No commits in common. "e7d536d087077626abe06e341930724220676fbf" and "2254b2f74d195884c2d27d7a965fa3c13e6730b6" have entirely different histories.

5 changed files with 27 additions and 68 deletions

1
.gitignore vendored
View File

@ -5,4 +5,3 @@ cub3D
build/
.cache/
test.log
dist/

View File

@ -1,12 +1,12 @@
# **************************************************************************** #
# #
# :::::::: #
# Makefile :+: :+: #
# +:+ #
# By: qmennen <qmennen@student.codam.nl> +#+ #
# +#+ #
# Created: 2024/10/15 11:48:46 by whaffman #+# #+# #
# Updated: 2025/07/03 18:16:26 by whaffman ######## odam.nl #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/10/15 11:48:46 by whaffman #+# #+# #
# Updated: 2025/06/11 18:43:00 by qmennen ### ########.fr #
# #
# **************************************************************************** #
@ -30,9 +30,6 @@ MLX42_INC_PATH = $(MLX42_PATH)/include/MLX42
GLAD_INC_PATH = $(MLX42_PATH)/include/glad
MLX42 = $(MLX42_PATH)/build/libmlx42.a
WEB = web/demo.html
MLX_WEB_LIB = $(MLX42_PATH)/build_web/libmlx42_web.a
CC = cc
RM = rm -rf
@ -40,7 +37,7 @@ INCLUDES = -I./$(INC_PATH) -I./$(LIBFT_INC_PATH) -I./$(MLX42_INC_PATH) -I./$(GLA
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
LDLIBS := -L$(LIBFT_PATH) -lft -L$(MLX42_PATH)/build -lmlx42 -ldl -lglfw -pthread -lm
LDLIBS := -L$(LIBFT_PATH) -lft -L$(MLX42_PATH)/build -lmlx42 -ldl -lglfw -pthread -lm
endif
VPATH = $(shell find $(SRC_PATH) -type d | tr '\n' ':')
@ -239,25 +236,7 @@ submodules:
git submodule update --init; \
fi
#WEBSTUFF
$(MLX_WEB_LIB):
@cd $(MLX42_PATH) && emcmake cmake -B build_web
@cd $(MLX42_PATH) && cmake --build build_web --parallel
@-mv $(MLX42_PATH)/build_web/libmlx42.a $(MLX_WEB_LIB)
web: $(WEB)
$(WEB): $(SRCS) $(MLX_WEB_LIB)
mkdir -p web
emcc -DWEB -O3 $(INCLUDES) -pthread $(SOURCES) \
-o $(WEB) \
$(MLX_WEB_LIB) \
-s USE_GLFW=3 -s USE_WEBGL2=1 -s FULL_ES3=1 -s WASM=1 \
-s NO_EXIT_RUNTIME=1 -s EXPORTED_RUNTIME_METHODS='["ccall", "cwrap"]' \
-s ALLOW_MEMORY_GROWTH
.PHONY: all clean fclean re srcs run help dist web
.PHONY: all clean fclean re srcs run help dist
red:=$(shell tput setaf 1)
green:=$(shell tput setaf 2)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* cub3d.h :+: :+: */
/* +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/04/15 12:22:29 by qmennen #+# #+# */
/* Updated: 2025/07/03 18:11:02 by whaffman ######## odam.nl */
/* ::: :::::::: */
/* cub3d.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/15 12:22:29 by qmennen #+# #+# */
/* Updated: 2025/06/11 20:32:00 by qmennen ### ########.fr */
/* */
/* ************************************************************************** */
@ -40,11 +40,6 @@
# define M_PI 3.14159265358979323846
# endif
# ifdef WEB
# include <emscripten.h>
# include <emscripten/html5.h>
# endif
# define RESET "\033[0m"
# define BLACK "\033[0;30m"
# define RED "\033[0;31m"

View File

@ -1,30 +1,21 @@
/* ************************************************************************** */
/* */
/* :::::::: */
/* main.c :+: :+: */
/* +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/04/15 16:01:29 by qmennen #+# #+# */
/* Updated: 2025/07/03 18:15:07 by whaffman ######## odam.nl */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/15 16:01:29 by qmennen #+# #+# */
/* Updated: 2025/06/11 18:42:53 by qmennen ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub3d.h"
mlx_t *g_mlx;
#ifdef WEB
static void emscripten_main_loop(void)
int main(int argc, char **argv)
{
mlx_loop(g_mlx);
}
#endif
int main(int argc, char **argv)
{
t_game_manager *manager;
t_game *game;
t_game_manager *manager;
t_game *game;
errno = 0;
game = NULL;
@ -44,12 +35,7 @@ int main(int argc, char **argv)
mlx_key_hook(game->screen->mlx, keyhandle, manager);
mlx_loop_hook(game->screen->mlx, game_manager_update, manager);
mlx_close_hook(game->screen->mlx, game_manager_destroy, manager);
#ifdef WEB
g_mlx = game->screen->mlx;
emscripten_set_main_loop_arg(emscripten_main_loop, 0, true);
#else
mlx_loop(game->screen->mlx);
#endif
game_manager_destroy(manager);
return (EXIT_SUCCESS);
}