MiniGame-Madness
|
A class that represents the screen buffer. More...
#include <screenBuffer.h>
Public Member Functions | |
ScreenBuffer () | |
Constructor for the screenBuffer class. | |
ScreenBuffer (int width, int height) | |
Constructor for the screenBuffer class. More... | |
~ScreenBuffer () | |
Destructor for the screenBuffer class. | |
HANDLE | getScreenHandle () const |
Get the screen buffer handle. More... | |
bool | isActive () const |
Check if the screen buffer is active. More... | |
void | setActive () |
Set the screen buffer to active. | |
CONSOLE_SCREEN_BUFFER_INFO | getScreenBufferInfo () const |
Get screen buffer info. More... | |
void | clearScreen () |
Clears the screen buffer. | |
int | getScreenWidth () const |
Get the screen buffer width. More... | |
int | getScreenHeight () const |
Get the screen buffer height. More... | |
void | setScreenSize (int width, int height) |
Set the size of the screen buffer and window. More... | |
std::pair< WORD, WORD > | getScreenColours (int x, int y, int length) const |
Get the screen text and background colors. More... | |
void | setCursorVisibility (bool isVisible) |
Set cursor visibility. More... | |
void | setCursorPosition (int x, int y) |
Move the cursor to the specified location. More... | |
std::pair< int, int > | getCursorPosition () const |
Get the current location of the cursor. More... | |
std::wstring | readScreenText (int x, int y, int length) const |
Get part of text in the screen buffer. More... | |
std::wstring | readAllScreenText () const |
Get all of the text in the screen buffer. More... | |
void | writeToScreen (int x, int y, const std::wstring &text) |
Write text to the screen at a specific location. More... | |
void | writeToScreen (int x, int y, const std::wstring &text, WORD textColour, WORD backgroundColour) |
Write text to the screen at a specific location with a specific color. More... | |
std::string | getBlockingInput () |
get blocking input from the user More... | |
std::string | getNonBlockingInput () |
get non-blocking input from the user More... | |
A class that represents the screen buffer.
This class provides methods to interact with the screen buffer, such as writing text to the screen, changing the cursor position, and setting text and background colors.
ScreenBuffer::ScreenBuffer | ( | int | width, |
int | height | ||
) |
Constructor for the screenBuffer class.
width | The width of the screen buffer |
height | The height of the screen buffer |
std::string ScreenBuffer::getBlockingInput | ( | ) |
get blocking input from the user
std::pair< int, int > ScreenBuffer::getCursorPosition | ( | ) | const |
Get the current location of the cursor.
std::string ScreenBuffer::getNonBlockingInput | ( | ) |
get non-blocking input from the user
CONSOLE_SCREEN_BUFFER_INFO ScreenBuffer::getScreenBufferInfo | ( | ) | const |
Get screen buffer info.
std::pair< WORD, WORD > ScreenBuffer::getScreenColours | ( | int | x, |
int | y, | ||
int | length | ||
) | const |
Get the screen text and background colors.
x | The x coordinate |
y | The y coordinate |
length | The length of the text |
HANDLE ScreenBuffer::getScreenHandle | ( | ) | const |
Get the screen buffer handle.
int ScreenBuffer::getScreenHeight | ( | ) | const |
Get the screen buffer height.
int ScreenBuffer::getScreenWidth | ( | ) | const |
Get the screen buffer width.
bool ScreenBuffer::isActive | ( | ) | const |
Check if the screen buffer is active.
std::wstring ScreenBuffer::readAllScreenText | ( | ) | const |
Get all of the text in the screen buffer.
std::wstring ScreenBuffer::readScreenText | ( | int | x, |
int | y, | ||
int | length | ||
) | const |
Get part of text in the screen buffer.
x | The x coordinate |
y | The y coordinate |
length | The length of the text |
void ScreenBuffer::setCursorPosition | ( | int | x, |
int | y | ||
) |
Move the cursor to the specified location.
x | The x coordinate |
y | The y coordinate |
void ScreenBuffer::setCursorVisibility | ( | bool | isVisible | ) |
Set cursor visibility.
isVisible | True to show the cursor, false to hide it |
void ScreenBuffer::setScreenSize | ( | int | width, |
int | height | ||
) |
Set the size of the screen buffer and window.
width | The width of the screen |
height | The height of the screen |
void ScreenBuffer::writeToScreen | ( | int | x, |
int | y, | ||
const std::wstring & | text | ||
) |
Write text to the screen at a specific location.
x | The x coordinate |
y | The y coordinate |
text | The text to write |
void ScreenBuffer::writeToScreen | ( | int | x, |
int | y, | ||
const std::wstring & | text, | ||
WORD | textColour, | ||
WORD | backgroundColour | ||
) |
Write text to the screen at a specific location with a specific color.
x | The x coordinate |
y | The y coordinate |
text | The text to write |
textColour | The color of the text |
backgroundColour | The color of the background |