Compare commits
No commits in common. "e7d536d087077626abe06e341930724220676fbf" and "2254b2f74d195884c2d27d7a965fa3c13e6730b6" have entirely different histories.
e7d536d087
...
2254b2f74d
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,4 +5,3 @@ cub3D
|
|||||||
build/
|
build/
|
||||||
.cache/
|
.cache/
|
||||||
test.log
|
test.log
|
||||||
dist/
|
|
||||||
35
Makefile
35
Makefile
@ -1,12 +1,12 @@
|
|||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
# #
|
# #
|
||||||
# :::::::: #
|
# ::: :::::::: #
|
||||||
# Makefile :+: :+: #
|
# Makefile :+: :+: :+: #
|
||||||
# +:+ #
|
# +:+ +:+ +:+ #
|
||||||
# By: qmennen <qmennen@student.codam.nl> +#+ #
|
# By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ #
|
||||||
# +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2024/10/15 11:48:46 by whaffman #+# #+# #
|
# Created: 2024/10/15 11:48:46 by whaffman #+# #+# #
|
||||||
# Updated: 2025/07/03 18:16:26 by whaffman ######## odam.nl #
|
# 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
|
GLAD_INC_PATH = $(MLX42_PATH)/include/glad
|
||||||
MLX42 = $(MLX42_PATH)/build/libmlx42.a
|
MLX42 = $(MLX42_PATH)/build/libmlx42.a
|
||||||
|
|
||||||
WEB = web/demo.html
|
|
||||||
MLX_WEB_LIB = $(MLX42_PATH)/build_web/libmlx42_web.a
|
|
||||||
|
|
||||||
CC = cc
|
CC = cc
|
||||||
RM = rm -rf
|
RM = rm -rf
|
||||||
|
|
||||||
@ -239,25 +236,7 @@ submodules:
|
|||||||
git submodule update --init; \
|
git submodule update --init; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
.PHONY: all clean fclean re srcs run help dist
|
||||||
#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
|
|
||||||
|
|
||||||
red:=$(shell tput setaf 1)
|
red:=$(shell tput setaf 1)
|
||||||
green:=$(shell tput setaf 2)
|
green:=$(shell tput setaf 2)
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 33 KiB |
17
inc/cub3d.h
17
inc/cub3d.h
@ -1,12 +1,12 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* ::: :::::::: */
|
||||||
/* cub3d.h :+: :+: */
|
/* cub3d.h :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: qmennen <qmennen@student.codam.nl> +#+ */
|
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
|
||||||
/* +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/04/15 12:22:29 by qmennen #+# #+# */
|
/* Created: 2025/04/15 12:22:29 by qmennen #+# #+# */
|
||||||
/* Updated: 2025/07/03 18:11:02 by whaffman ######## odam.nl */
|
/* Updated: 2025/06/11 20:32:00 by qmennen ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -40,11 +40,6 @@
|
|||||||
# define M_PI 3.14159265358979323846
|
# define M_PI 3.14159265358979323846
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef WEB
|
|
||||||
# include <emscripten.h>
|
|
||||||
# include <emscripten/html5.h>
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# define RESET "\033[0m"
|
# define RESET "\033[0m"
|
||||||
# define BLACK "\033[0;30m"
|
# define BLACK "\033[0;30m"
|
||||||
# define RED "\033[0;31m"
|
# define RED "\033[0;31m"
|
||||||
|
|||||||
26
src/main.c
26
src/main.c
@ -1,26 +1,17 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* :::::::: */
|
/* ::: :::::::: */
|
||||||
/* main.c :+: :+: */
|
/* main.c :+: :+: :+: */
|
||||||
/* +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: qmennen <qmennen@student.codam.nl> +#+ */
|
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
|
||||||
/* +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/04/15 16:01:29 by qmennen #+# #+# */
|
/* Created: 2025/04/15 16:01:29 by qmennen #+# #+# */
|
||||||
/* Updated: 2025/07/03 18:15:07 by whaffman ######## odam.nl */
|
/* Updated: 2025/06/11 18:42:53 by qmennen ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "cub3d.h"
|
#include "cub3d.h"
|
||||||
|
|
||||||
mlx_t *g_mlx;
|
|
||||||
|
|
||||||
#ifdef WEB
|
|
||||||
static void emscripten_main_loop(void)
|
|
||||||
{
|
|
||||||
mlx_loop(g_mlx);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
t_game_manager *manager;
|
t_game_manager *manager;
|
||||||
@ -44,12 +35,7 @@ int main(int argc, char **argv)
|
|||||||
mlx_key_hook(game->screen->mlx, keyhandle, manager);
|
mlx_key_hook(game->screen->mlx, keyhandle, manager);
|
||||||
mlx_loop_hook(game->screen->mlx, game_manager_update, manager);
|
mlx_loop_hook(game->screen->mlx, game_manager_update, manager);
|
||||||
mlx_close_hook(game->screen->mlx, game_manager_destroy, 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);
|
mlx_loop(game->screen->mlx);
|
||||||
#endif
|
|
||||||
game_manager_destroy(manager);
|
game_manager_destroy(manager);
|
||||||
return (EXIT_SUCCESS);
|
return (EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user