Skip to content

Commit

Permalink
Remove console pop-up on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
karjonas committed Feb 8, 2024
1 parent cb6284d commit 65e0f03
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
9 changes: 9 additions & 0 deletions projects/ConfigApp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,3 +390,12 @@ int main(int argc, const char** argv)

return 0;
}

#if _MSC_VER
#include <windows.h>
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, char*,
int nShowCmd)
{
return main(__argc, const_cast<const char**>(__argv));
}
#endif
10 changes: 9 additions & 1 deletion projects/Puzzle/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
set(PROJECT_NAME puzzlemoppet)

add_executable(${PROJECT_NAME}
# Add flag to make console not appear on windows.
# Also makes WinMain() entry point instead of main().
if(WIN32)
set(WIN32_APPLICATION_FLAG "WIN32")
else()
set(WIN32_APPLICATION_FLAG "")
endif()

add_executable(${PROJECT_NAME} ${WIN32_APPLICATION_FLAG}
CameraCollider.h
Editor.cpp
Editor.h
Expand Down
9 changes: 9 additions & 0 deletions projects/Puzzle/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,3 +441,12 @@ int main(int argc, const char **argv)

return 0;
}

#if _MSC_VER
#include <windows.h>
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, char *,
int nShowCmd)
{
return main(__argc, const_cast<const char **>(__argv));
}
#endif

0 comments on commit 65e0f03

Please sign in to comment.