From cefc8dff59b72f3ff55f34dead19bf0eb4e2a923 Mon Sep 17 00:00:00 2001 From: j vh Date: Wed, 25 Jan 2023 14:46:30 +0100 Subject: [PATCH] added GetCursorPosition --- BeefLibs/corlib/src/Console.bf | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/BeefLibs/corlib/src/Console.bf b/BeefLibs/corlib/src/Console.bf index 7d93868a..a5856818 100644 --- a/BeefLibs/corlib/src/Console.bf +++ b/BeefLibs/corlib/src/Console.bf @@ -127,6 +127,17 @@ namespace System } SetConsoleOutputCP(/*CP_UTF8*/65001); } + + public static uint16[2] GetConsoleCursorPosition() + { + let handle = GetStdHandle(STD_OUTPUT_HANDLE); + CONSOLE_SCREEN_BUFFER_INFO consoleInfo = .(); + if (GetConsoleScreenBufferInfo(handle, out consoleInfo) != 0) + { + return consoleInfo.mCursorPosition; + } + return uint16[2](0,0); + } #endif static StreamWriter OpenStreamWriter(Platform.BfpFileStdKind stdKind, ref StreamWriter outStreamWriter)