mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-21 09:27:59 +02:00
added console left and top properties
This commit is contained in:
parent
cefc8dff59
commit
b2d1d98f1a
2 changed files with 36 additions and 13 deletions
|
@ -1,5 +0,0 @@
|
||||||
FileVersion = 1
|
|
||||||
Projects = {corlib = {Path = "."}}
|
|
||||||
|
|
||||||
[Workspace]
|
|
||||||
StartupProject = "corlib"
|
|
|
@ -128,15 +128,43 @@ namespace System
|
||||||
SetConsoleOutputCP(/*CP_UTF8*/65001);
|
SetConsoleOutputCP(/*CP_UTF8*/65001);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static uint16[2] GetConsoleCursorPosition()
|
public static int32 CursorTop
|
||||||
{
|
{
|
||||||
let handle = GetStdHandle(STD_OUTPUT_HANDLE);
|
public get
|
||||||
CONSOLE_SCREEN_BUFFER_INFO consoleInfo = .();
|
|
||||||
if (GetConsoleScreenBufferInfo(handle, out consoleInfo) != 0)
|
|
||||||
{
|
{
|
||||||
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
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue