Skip to content

Commit

Permalink
print version info on init
Browse files Browse the repository at this point in the history
and update version

Admittedly I'm just doing this to test my github pages
action.
  • Loading branch information
alexbarry committed Mar 31, 2024
1 parent 2a562cd commit 0ac768b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build/wasm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.4.1)
project(alexgames_wasm VERSION "0.1.0")
project(alexgames_wasm VERSION "0.1.1")


get_filename_component(PROJECT_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../.." ABSOLUTE)
Expand Down
11 changes: 9 additions & 2 deletions src/emscripten/emscripten_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,9 @@ const struct game_api_callbacks api_callbacks = {
.destroy_all = js_destroy_all,
};

static void print_ver_info() {
printf("AlexGames version %s, git hash = %s\n", PROJECT_VERSION, GIT_HEAD_HASH);
}

// Entry point from javascript
EMSCRIPTEN_KEEPALIVE
Expand All @@ -639,12 +642,16 @@ void *init_game_api(const char *game_str, int game_str_len) {
set_game_dict_api(get_emscripten_game_dict_api());

g_db_state_handler = saved_state_db_init(NULL, &api_callbacks);
return alex_init_game(&api_callbacks, game_str, game_str_len);

void *handle = alex_init_game(&api_callbacks, game_str, game_str_len);

print_ver_info();
return handle;
}

// If you don't provide a main function, then it looks like the Lua main takes over
// and starts prompting for text via stdin, which causes a big popup in a browser.
// Though I don't actually know CMake allows for multiple main definitions like this.
int main(void) {
printf("AlexGames version %s, git hash = %s\n", PROJECT_VERSION, GIT_HEAD_HASH);
print_ver_info();
}

0 comments on commit 0ac768b

Please sign in to comment.