From bda5c8f1ef5f59918362ee411c35f244fe5745af Mon Sep 17 00:00:00 2001 From: Valerio Santinelli Date: Sat, 9 Sep 2023 10:18:28 +0200 Subject: [PATCH] Added support to hide the Windows console --- CMakeLists.txt | 4 ++++ CMakeOptions.txt | 4 +++- src/binocle/core/binocle_app.c | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 136a0010..da5c8be3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,10 @@ if(BINOCLE_LUAJIT) add_definitions(-DBINOCLE_LUAJIT) endif () +if(BINOCLE_SHOW_CONSOLE) + add_definitions(-DBINOCLE_SHOW_CONSOLE) +endif() + include(BinocleUtils) SET(VERSION_MAJOR "0") diff --git a/CMakeOptions.txt b/CMakeOptions.txt index 028fc8f5..45153483 100644 --- a/CMakeOptions.txt +++ b/CMakeOptions.txt @@ -1 +1,3 @@ -option(BINOCLE_LUAJIT "Enable LuaJIT on supported platforms (Windows, macOS)" OFF) \ No newline at end of file +option(BINOCLE_LUAJIT "Enable LuaJIT on supported platforms (Windows, macOS)" OFF) +option(BINOCLE_SHOW_CONSOLE "Enable console output on Windows" OFF) +option(BINOCLE_HTTP "Enable HTTP support on supported platforms (Windows, macOS, web)" ON) diff --git a/src/binocle/core/binocle_app.c b/src/binocle/core/binocle_app.c index 3ab24019..c1773525 100644 --- a/src/binocle/core/binocle_app.c +++ b/src/binocle/core/binocle_app.c @@ -22,6 +22,12 @@ bool binocle_app_init(binocle_app *app, binocle_app_desc_t *desc) { // Initialize time stuff stm_setup(); + // Hide the console on Windows +#if defined(__WINDOWS__) && !defined(BINOCLE_SHOW_CONSOLE) + const HWND windowHandle = GetConsoleWindow(); + ShowWindow(windowHandle, SW_HIDE); +#endif + // Initialize the filesystem app->fs = binocle_fs_new(); binocle_fs_init(&app->fs);