Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@

#include <stdio.h>

#if defined(_WIN32)
# include <windows.h>
#endif

namespace {

constexpr i32 kInitialWidth = 1200;
Expand Down Expand Up @@ -233,6 +237,16 @@ void ProcessMouseEvent(App *app, const MouseEvent &event) {
int main(int argc, char **argv) {
SDL_SetMainReady();

// Detach the console when we are its only process (Explorer double-click).
// Keep it when launched from an existing terminal so stderr/stdout still work.
#if defined(_WIN32)
DWORD process_ids[2];
DWORD count = GetConsoleProcessList(process_ids, 2);
if (count == 1) {
FreeConsole();
}
#endif

Arena *arena = ArenaAlloc(GB(1));

// --screenshot <path>: draw one frame, save it, exit. Everything else on the
Expand Down
Loading