Skip to content

Commit

Permalink
Added support to hide the Windows console
Browse files Browse the repository at this point in the history
  • Loading branch information
tanis2000 committed Sep 9, 2023
1 parent 92b037e commit bda5c8f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 3 additions & 1 deletion CMakeOptions.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
option(BINOCLE_LUAJIT "Enable LuaJIT on supported platforms (Windows, macOS)" OFF)
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)
6 changes: 6 additions & 0 deletions src/binocle/core/binocle_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit bda5c8f

Please sign in to comment.