diff --git a/orig/build/wasm/CMakeLists.txt b/ag/build/wasm/CMakeLists.txt index 98723af..1b3312e 100644 --- a/orig/build/wasm/CMakeLists.txt +++ b/ag/build/wasm/CMakeLists.txt @@ -13,63 +13,17 @@ set(HTML_OUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/out/") set(ENABLE_MEM_SANITIZER 0) +if(NOT DEFINED ENABLE_RUST_GAMES) set(ENABLE_RUST_GAMES "ON") +endif() set(RUST_TARGET "wasm32-unknown-emscripten" CACHE STRING "Rust build target for wasm") #set(WASM_USE_C_DICT_API OFF) # uncomment this line to try the JS dictionary instead of the C dictionary option(WASM_USE_C_DICT_API "Use the C implementation of the dictionary API. The alternative is something in javascript that seems to use a lot of memory" ON) -get_filename_component(ZLIB_DIR "${PROJECT_ROOT}/third_party/zlib/" ABSOLUTE) -set(ALEXGAMES_ZLIB_SRC "${PROJECT_ROOT}/third_party/zlib") -set(ALEXGAMES_ZLIB_LIB_DIR "${ALEXGAMES_ZLIB_SRC}/build/wasm") -set(ALEXGAMES_ZLIB_LIB_PATH "${ALEXGAMES_ZLIB_LIB_DIR}/libz.a") -if(EXISTS ${ALEXGAMES_ZLIB_LIB_PATH}) -message("Found libz.a for wasm build at ${ALEXGAMES_ZLIB_LIB_PATH}") -else() -message("Building zlib (libz.a) for wasm...") - -IF (EXISTS ${ZLIB_DIR}) - message("Found zlib in ${ZLIB_DIR}") -else() - message("Downloading zlib into ${ZLIB_DIR}") - execute_process(COMMAND git clone https://github.com/madler/zlib.git ${ZLIB_DIR}) -endif() -execute_process(COMMAND mkdir -p ${ALEXGAMES_ZLIB_LIB_DIR}) - -#execute_process( -# COMMAND "${ALEXGAMES_ZLIB_SRC}/configure" -# WORKING_DIRECTORY ${ALEXGAMES_ZLIB_LIB_DIR} -#) -# - -message("Running emcmake cmake -DZLIB_BUILD_SHARED=OFF ${ALEXGAMES_ZLIB_SRC}") -execute_process( - COMMAND emcmake cmake - -DZLIB_BUILD_SHARED=OFF - ${ALEXGAMES_ZLIB_SRC} - WORKING_DIRECTORY ${ALEXGAMES_ZLIB_LIB_DIR} -) - -message("Running cmake --build .") -execute_process( - COMMAND cmake --build . - WORKING_DIRECTORY ${ALEXGAMES_ZLIB_LIB_DIR} -) -execute_process( - COMMAND cp ${ALEXGAMES_ZLIB_SRC}/zconf.h ${ALEXGAMES_ZLIB_LIB_DIR} -) -execute_process( - COMMAND cp ${ALEXGAMES_ZLIB_SRC}/zlib.h ${ALEXGAMES_ZLIB_LIB_DIR} -) - -execute_process(COMMAND ls ${ALEXGAMES_ZLIB_LIB_PATH}) -if (EXISTS ${ALEXGAMES_ZLIB_LIB_PATH}) -message("Succssfully built ${ALEXGAMES_ZLIB_LIB_PATH}") -else() -message(FATAL_ERROR "Unable to build zlib for wasm (could not find output libz.a at ${ALEXGAMES_ZLIB_LIB_PATH}") -endif() -endif() +# fredygames: upload of zipped Lua games is disabled, so libzip/zlib are not built. +set(ENABLE_ZIP_UPLOAD OFF CACHE BOOL "" FORCE) # TODO would like to make cmake rebuild if lua_scripts change, not sure how to do that @@ -133,13 +87,11 @@ list(APPEND EMCC_LINK_OPTS "--preload-file ${LUA_SCRIPT_PRELOAD_OUT}") list(APPEND EMCC_LINK_OPTS "-s MODULARIZE=1") list(APPEND EMCC_LINK_OPTS "-s 'EXPORT_NAME=\"createMyModule\"'") list(APPEND EMCC_LINK_OPTS "-s LLD_REPORT_UNDEFINED") -list(APPEND EMCC_LINK_OPTS "-s USE_ZLIB=1") # Without WASM_BIGINT, calling Module.setValue(ptr, val, 'i64') will # fail if val is too big, and it seems to be too big on some browsers # (at least the WKWebView on the iOS app running on the simulator) # when handling touch events, it seems the touch.identifier is # large in that case -list(APPEND EMCC_LINK_OPTS "-s WASM_BIGINT") list(APPEND EMCC_LINK_OPTS "-sSUPPORT_LONGJMP=emscripten") list(APPEND EMCC_LINK_OPTS "-Wno-unused-main") @@ -273,28 +225,3 @@ list(APPEND LINK_DEPS "${LUA_SCRIPT_SRC}/games/endless_runner") list(APPEND LINK_DEPS "${LUA_SCRIPT_SRC}/games/minesweeper_life") set_target_properties(alexgames_wasm PROPERTIES LINK_DEPENDS "${LINK_DEPS}") -# NOTE: if `zip` isn't available on your system, then -# you can just remove this whole part below. It's simply -# to provide an example zip game bundle that can be -# downloaded and re-uploaded for users to try making -# their own games. - - -# -j argument removes the path from the contents of the zip, so the zip contains only the files, not -# all the subfolders like src/lua_scripts/games/api_demo etc -# -execute_process(COMMAND zip "example_game_apidemo.zip" - "-j" # removes the paths of the files below, so in the zip they're - # just "game.lua" instead of "src/lua_scripts/games/api_demo/game.lua". - "--must-match" # to give an error if a file is not found - "${LUA_SCRIPT_SRC}/games/api_demo/game_core.lua" - "${LUA_SCRIPT_SRC}/games/api_demo/game_draw.lua" - "${LUA_SCRIPT_SRC}/games/api_demo/game.lua" - RESULT_VARIABLE API_DEMO_ZIP_CMD_RC) -IF ("${API_DEMO_ZIP_CMD_RC}" EQUAL "0") - message("successfully zipped example_game_apidemo.zip, rc=${API_DEMO_ZIP_CMD_RC}") -ELSE() - # If this is failing then you can just comment it out, - # If you are just trying out this project then you don't need this. - message(FATAL_ERROR "error, zip for example_game_apidemo.zip returned rc=${API_DEMO_ZIP_CMD_RC}") -ENDIF() diff --git a/orig/src/CMakeLists.txt b/ag/src/CMakeLists.txt index 3913351..1c1ff22 100644 --- a/orig/src/CMakeLists.txt +++ b/ag/src/CMakeLists.txt @@ -1,7 +1,7 @@ set(SRC_DIR ../src) set(BUILD_TYPE_LABEL "" CACHE STRING "Specifies the type of build") -string(TIMESTAMP BUILD_DATETIME "%Y-%m-%d %H:%M:%S%z") +string(TIMESTAMP BUILD_DATETIME "%Y-%m-%d %H:%M:%S%z" UTC) execute_process(COMMAND git rev-parse --short HEAD WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GIT_HEAD_HASH @@ -96,18 +96,6 @@ endif() endif() -if (ENABLE_WORD_DICT) -IF (EXISTS ${SQLITE_DIR}/sqlite-amalgamation-3420000/sqlite3.c) - message("Found SQLite in ${SQLITE_DIR}") -else() - message("Downloading SQLite into ${SQLITE_DIR}") - execute_process(COMMAND mkdir -p ${SQLITE_DIR}/) - execute_process(COMMAND wget https://sqlite.org/2023/sqlite-amalgamation-3420000.zip -O ${SQLITE_DIR}/sqlite.zip) - execute_process(COMMAND unzip ${SQLITE_DIR}/sqlite.zip -d ${SQLITE_DIR}) - # execute_process(COMMAND git clone https://github.com/nih-at/libzip.git ${SQLITE_DIR}) -endif() -endif() - if (ENABLE_SQLITE3_SAVED_STATE) message("Using SQLite3 for saved state") # TODO git clone and etc @@ -169,6 +157,7 @@ list(FILTER LUA_CORE_SRC_LIST EXCLUDE REGEX "\/onelua.c$") # This is the standalone interpreter, which defines a main function that # I do not want to include. list(FILTER LUA_CORE_SRC_LIST EXCLUDE REGEX "\/lua.c$") +list(FILTER LUA_CORE_SRC_LIST EXCLUDE REGEX "\/luac.c$") # not currently using lua_user_cfg.h, loading my library manually in C instead #include_directories(${SRC_DIR}/main) diff --git a/orig/src/game_api/game_api.c b/ag/src/game_api/game_api.c index af5b4d4..5d29801 100644 --- a/orig/src/game_api/game_api.c +++ b/ag/src/game_api/game_api.c @@ -336,7 +336,7 @@ void *alex_init_game(const struct game_api_callbacks *api_callbacks, printf("[init] game_api.c: alex_init_game called\n"); { char init_msg[256]; - int init_msg_len = snprintf(init_msg, sizeof(init_msg), "Starting game \"%s\"", game_str); + int init_msg_len = snprintf(init_msg, sizeof(init_msg), "Starting game"); api_callbacks->set_status_msg(init_msg, init_msg_len); } diff --git a/orig/src/html/index.html b/ag/src/html/index.html index 0163059..4fe76fe 100644 --- a/orig/src/html/index.html +++ b/ag/src/html/index.html @@ -1,25 +1,14 @@ - + - - - - - - - - - - - - - - AlexGames + + + __AG_TITLE__ @@ -32,7 +21,11 @@ - + @@ -78,6 +71,8 @@ #game_canvas { max-width:100%; + max-height: calc(100vh - 170px); + width: auto; height: auto; object-fit: contain; flex: 0 0 1; align-self:center; @@ -203,11 +198,10 @@
- - @@ -660,116 +392,10 @@ for (let game_choice_row_info of game_choice_row_infos) {
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -