mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Fix console window shrinking with 1 unit
This commit fixes an issue where the console window would shrink with 1 unit when calling 'SetConsoleBackgroundColor'. The bottom should be incremented by 1 each time its getting called, as it appears to be decremented again in WINAPI 'SetConsoleScreenBufferInfoEx'.
This commit is contained in:
parent
615889948b
commit
6ae47b744e
@ -25,12 +25,16 @@ static std::string s_ConsoleInput;
|
||||
//-----------------------------------------------------------------------------
|
||||
void SetConsoleBackgroundColor(COLORREF color)
|
||||
{
|
||||
CONSOLE_SCREEN_BUFFER_INFOEX sbInfoEx{};
|
||||
CONSOLE_SCREEN_BUFFER_INFOEX sbInfoEx{0};
|
||||
sbInfoEx.cbSize = sizeof(CONSOLE_SCREEN_BUFFER_INFOEX);
|
||||
|
||||
HANDLE consoleOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
GetConsoleScreenBufferInfoEx(consoleOut, &sbInfoEx);
|
||||
|
||||
// The '+= 1' is required, else the window will shrink
|
||||
// by '1' each time this function is getting called on
|
||||
// the same console window.
|
||||
sbInfoEx.srWindow.Bottom += 1;
|
||||
sbInfoEx.ColorTable[0] = color;
|
||||
SetConsoleScreenBufferInfoEx(consoleOut, &sbInfoEx);
|
||||
}
|
||||
@ -43,7 +47,7 @@ void SetConsoleBackgroundColor(COLORREF color)
|
||||
//-----------------------------------------------------------------------------
|
||||
void FlashConsoleBackground(int nFlashCount, int nFlashInterval, COLORREF color)
|
||||
{
|
||||
CONSOLE_SCREEN_BUFFER_INFOEX sbInfoEx{};
|
||||
CONSOLE_SCREEN_BUFFER_INFOEX sbInfoEx{0};
|
||||
sbInfoEx.cbSize = sizeof(CONSOLE_SCREEN_BUFFER_INFOEX);
|
||||
|
||||
HANDLE consoleOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user