From 97168aaf30c64c688e0057f28f1f2375b4c40520 Mon Sep 17 00:00:00 2001 From: Henrique Alves Date: Thu, 25 Apr 2024 14:20:17 +0300 Subject: Fix basic counting on web --- CMakeLists.txt | 12 ++++++------ scripts/main.scm | 9 ++++----- sources/main.c | 3 ++- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 58f137f..b192bf0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,10 +12,10 @@ set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build the supplied examples set(BUILD_GAMES OFF CACHE BOOL "" FORCE) # don't build the supplied example games FetchContent_Declare( - raylib - GIT_REPOSITORY "https://github.com/raysan5/raylib.git" - GIT_TAG "master" - GIT_PROGRESS TRUE + raylib + GIT_REPOSITORY "https://github.com/raysan5/raylib.git" + GIT_TAG "master" + GIT_PROGRESS TRUE ) FetchContent_MakeAvailable(raylib) @@ -44,8 +44,8 @@ if (${PLATFORM} STREQUAL "Web") endif() if (EMSCRIPTEN) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s GL_ENABLE_GET_PROC_ADDRESS=1") - set(CMAKE_EXECUTABLE_SUFFIX ".html") # This line is used to set your executable to build with the emscripten html template so that you can directly open it. + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s GL_ENABLE_GET_PROC_ADDRESS=1 --embed-file assets --embed-file scripts") + set(CMAKE_EXECUTABLE_SUFFIX ".html") # This line is used to set your executable to build with the emscripten html template so that you can directly open it. endif () # Setting ASSETS_PATH diff --git a/scripts/main.scm b/scripts/main.scm index 136c757..9066381 100644 --- a/scripts/main.scm +++ b/scripts/main.scm @@ -1,13 +1,12 @@ (define a 0) -(define b 0) +;;(define b 0) (define update (lambda () (set! a (+ a 1)) - (set! b (rl-load-texture)) - (display b) - (newline) - (gc-run) + ;;(set! b (rl-load-texture)) + ;;(display b) + )) (define draw diff --git a/sources/main.c b/sources/main.c index 4d5497c..309e8c3 100644 --- a/sources/main.c +++ b/sources/main.c @@ -21,7 +21,7 @@ EM_BOOL main_loop_web(double time, void* userData) { BeginDrawing(); ClearBackground(BLUE); - //s7_call(s7, s7_draw_fn, s7_list(s7, 0)); + s7_call(s7, s7_draw_fn, s7_list(s7, 0)); EndDrawing(); return EM_TRUE; } @@ -49,6 +49,7 @@ int main(int argc, char* argv[]) { SetTargetFPS(60); char filename[] = SCRIPTS_PATH"main.scm"; + s7_load(s7, filename); s7_update_fn = s7_name_to_value(s7, "update"); -- cgit v1.2.3