From b8cd780b3dbb2552f1a8ce4497be3721a977677f Mon Sep 17 00:00:00 2001 From: Calc1te Date: Thu, 18 Sep 2025 15:39:28 +0800 Subject: [PATCH 1/3] try to fix windows --- src/InputMonitor.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/InputMonitor.cpp b/src/InputMonitor.cpp index af3d27b..4b78743 100644 --- a/src/InputMonitor.cpp +++ b/src/InputMonitor.cpp @@ -16,6 +16,11 @@ #ifdef _WIN64 #include #include +#define NOMINMAX +#define WIN32_LEAN_AND_MEAN +#ifdef store +#undef store +#endif #endif void InputMonitor::start(const Callback& callback) From 42541af7eef77b531883a50569566b7915eb8be1 Mon Sep 17 00:00:00 2001 From: Calc1te Date: Thu, 18 Sep 2025 15:42:30 +0800 Subject: [PATCH 2/3] try to fix windows 2 --- src/InputMonitor.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/InputMonitor.cpp b/src/InputMonitor.cpp index 4b78743..c7dee58 100644 --- a/src/InputMonitor.cpp +++ b/src/InputMonitor.cpp @@ -16,7 +16,6 @@ #ifdef _WIN64 #include #include -#define NOMINMAX #define WIN32_LEAN_AND_MEAN #ifdef store #undef store From 391ea5b35a63358f8d97f28167cc69709211f945 Mon Sep 17 00:00:00 2001 From: Calc1te Date: Thu, 18 Sep 2025 15:47:01 +0800 Subject: [PATCH 3/3] try to fix windows 3 --- src/Game.cpp | 47 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/src/Game.cpp b/src/Game.cpp index 6295b2a..38de1a7 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -39,25 +39,48 @@ Game::~Game() { bIsRunning.store(false); } void Game::initWindow() { + int LINE_WIDTH = 0; + #ifdef _WIN64 HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); CONSOLE_SCREEN_BUFFER_INFO csbi; - GetConsoleScreenBufferInfo(hConsole, &csbi); - LINE_HEIGHT = csbi.srWindow.Bottom - csbi.srWindow.Top + 1; + if (GetConsoleScreenBufferInfo(hConsole, &csbi)) { + LINE_HEIGHT = csbi.srWindow.Bottom - csbi.srWindow.Top + 1; + LINE_WIDTH = csbi.srWindow.Right - csbi.srWindow.Left + 1; + } else { + LINE_HEIGHT = 25; + LINE_WIDTH = 80; + } #else struct winsize win; - ioctl(STDOUT_FILENO, TIOCGWINSZ, &win); - LINE_HEIGHT = win.ws_row; - int LINE_WIDTH = win.ws_col; + if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &win) == 0) { + LINE_HEIGHT = win.ws_row; + LINE_WIDTH = win.ws_col; + } else { + LINE_HEIGHT = 25; + LINE_WIDTH = 80; + } #endif + while (LINE_HEIGHT < 18 || LINE_WIDTH < 40) { - std::cout<