# HG changeset patch # User sam # Date 1712138361 25200 # Node ID 799a630aa2bbcf8fdbc0efc84cf52894a138daf9 # Parent bfcec39dfb0bce77c567e0ef51bc79cd5759379f add: console for windows debug builds diff -r bfcec39dfb0b -r 799a630aa2bb semicongine/platform/windows/window.nim --- a/semicongine/platform/windows/window.nim Wed Apr 03 16:00:33 2024 +0700 +++ b/semicongine/platform/windows/window.nim Wed Apr 03 02:59:21 2024 -0700 @@ -64,11 +64,11 @@ proc createWindow*(title: string): NativeWindow = - # when DEBUG: - # AllocConsole() - # discard stdin.reopen("conIN$", fmRead) - # discard stdout.reopen("conOUT$", fmWrite) - # discard stderr.reopen("conOUT$", fmWrite) + when DEBUG: + AllocConsole() + discard stdin.reopen("conIN$", fmRead) + discard stdout.reopen("conOUT$", fmWrite) + discard stderr.reopen("conOUT$", fmWrite) result.hInstance = HINSTANCE(GetModuleHandle(nil)) var @@ -100,7 +100,7 @@ result.g_wpPrev.length = UINT(sizeof(WINDOWPLACEMENT)) discard result.hwnd.ShowWindow(SW_SHOW) -proc setTitle*(window: NativeWindow, title: string) +proc setTitle*(window: NativeWindow, title: string) = window.hwnd.SetWindowText(T(title)) # inspired by the one and only, Raymond Chen