# HG changeset patch # User sam # Date 1703667665 -25200 # Node ID 73e96ca349fdf5f2f39f9cff209b8755a41c64f5 # Parent 194f0a398141bdb7f629fe811c311027124e24cc fix: logging output on windows diff -r 194f0a398141 -r 73e96ca349fd semicongine/platform/windows/audio.nim --- a/semicongine/platform/windows/audio.nim Wed Dec 27 14:29:15 2023 +0700 +++ b/semicongine/platform/windows/audio.nim Wed Dec 27 16:01:05 2023 +0700 @@ -1,3 +1,5 @@ +import std/os + import winim import winim/extra @@ -37,7 +39,7 @@ proc writeSoundData*(soundDevice: var NativeSoundDevice, buffer: int) = while (soundDevice.buffers[buffer].dwFlags and WHDR_DONE) == 0: - echo "" # ugly solution to prevent code elimination, need to find a nicer solution + sleep(1) checkWinMMResult waveOutWrite(soundDevice.handle, addr soundDevice.buffers[buffer], UINT(sizeof(WAVEHDR))) proc closeSoundDevice*(soundDevice: var NativeSoundDevice) = diff -r 194f0a398141 -r 73e96ca349fd semicongine/platform/windows/window.nim --- a/semicongine/platform/windows/window.nim Wed Dec 27 14:29:15 2023 +0700 +++ b/semicongine/platform/windows/window.nim Wed Dec 27 16:01:05 2023 +0700 @@ -2,6 +2,7 @@ import winim import ../../core/vector +import ../../core/buildconfig import ./virtualkey_map import ../../events @@ -63,6 +64,12 @@ proc createWindow*(title: string): NativeWindow = + when DEBUG: + AllocConsole() + discard stdin.reopen("conIN$", fmRead) + discard stdout.reopen("conOUT$", fmWrite) + discard stderr.reopen("conOUT$", fmWrite) + result.hInstance = HINSTANCE(GetModuleHandle(nil)) var windowClassName = T"EngineWindowClass" @@ -91,7 +98,7 @@ ) result.g_wpPrev.length = UINT(sizeof(WINDOWPLACEMENT)) - discard ShowWindow(result.hwnd, SW_SHOW) + discard result.hwnd.ShowWindow(SW_SHOW) # inspired by the one and only, Raymond Chen # https://devblogs.microsoft.com/oldnewthing/20100412-00/?p=14353