diff --git a/BeefLibs/corlib/BeefSpace.toml b/BeefLibs/corlib/BeefSpace.toml deleted file mode 100644 index dae97147..00000000 --- a/BeefLibs/corlib/BeefSpace.toml +++ /dev/null @@ -1,5 +0,0 @@ -FileVersion = 1 -Projects = {corlib = {Path = "."}} - -[Workspace] -StartupProject = "corlib" diff --git a/BeefLibs/corlib/src/Console.bf b/BeefLibs/corlib/src/Console.bf index a5856818..6e895987 100644 --- a/BeefLibs/corlib/src/Console.bf +++ b/BeefLibs/corlib/src/Console.bf @@ -127,16 +127,44 @@ 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) + + public static int32 CursorTop + { + public get { - return consoleInfo.mCursorPosition; + let handle = GetStdHandle(STD_OUTPUT_HANDLE); + CONSOLE_SCREEN_BUFFER_INFO consoleInfo = .(); + GetConsoleScreenBufferInfo(handle,out consoleInfo); + return consoleInfo.mCursorPosition[1]; //1 = y position + } + public set + { + //This has to be done afaik to ensure x stays the same + let handle = GetStdHandle(STD_OUTPUT_HANDLE); + CONSOLE_SCREEN_BUFFER_INFO consoleInfo = .(); + GetConsoleScreenBufferInfo(handle,out consoleInfo); + + SetConsoleCursorPosition(handle, COORD((.)consoleInfo.mCursorPosition[0], (.)value)); + } + } + public static int32 CursorLeft + { + public get + { + let handle = GetStdHandle(STD_OUTPUT_HANDLE); + CONSOLE_SCREEN_BUFFER_INFO consoleInfo = .(); + GetConsoleScreenBufferInfo(handle,out consoleInfo); + return consoleInfo.mCursorPosition[0]; //1 = y position + } + public set + { + //This has to be done afaik to ensure x stays the same + let handle = GetStdHandle(STD_OUTPUT_HANDLE); + CONSOLE_SCREEN_BUFFER_INFO consoleInfo = .(); + GetConsoleScreenBufferInfo(handle,out consoleInfo); + + SetConsoleCursorPosition(handle, COORD((.)value,(.)consoleInfo.mCursorPosition[0])); } - return uint16[2](0,0); } #endif