mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-25 11:08:02 +02:00
Merge pull request #1785 from Booklordofthedings/master
added GetCursorPosition
This commit is contained in:
commit
1291089f47
2 changed files with 39 additions and 5 deletions
|
@ -1,5 +0,0 @@
|
||||||
FileVersion = 1
|
|
||||||
Projects = {corlib = {Path = "."}}
|
|
||||||
|
|
||||||
[Workspace]
|
|
||||||
StartupProject = "corlib"
|
|
|
@ -127,6 +127,45 @@ namespace System
|
||||||
}
|
}
|
||||||
SetConsoleOutputCP(/*CP_UTF8*/65001);
|
SetConsoleOutputCP(/*CP_UTF8*/65001);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int32 CursorTop
|
||||||
|
{
|
||||||
|
public get
|
||||||
|
{
|
||||||
|
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]));
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static StreamWriter OpenStreamWriter(Platform.BfpFileStdKind stdKind, ref StreamWriter outStreamWriter)
|
static StreamWriter OpenStreamWriter(Platform.BfpFileStdKind stdKind, ref StreamWriter outStreamWriter)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue