29 HANDLE screenHandle = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, 0, NULL, CONSOLE_TEXTMODE_BUFFER, NULL);
30 const WORD NO_COLOUR = -1;
36 void throwError(BOOL result,
const std::string& message)
const;
45 BOOL writeToScreenBuffer(
int x,
int y,
const std::wstring& text);
52 BOOL writeToScreenBuffer(
const std::wstring& text);
60 std::wstring setTextColours(
const std::wstring& text, WORD textColour, WORD backgroundColour);
67 WORD convertColour(WORD colour)
const;
73 static const WORD FOREGROUND_NORMAL = -3;
74 static const WORD BACKGROUND_NORMAL = -13;
75 static const WORD BLACK = 0;
76 static const WORD RED = 1;
77 static const WORD GREEN = 2;
78 static const WORD YELLOW = 3;
79 static const WORD BLUE = 4;
80 static const WORD MAGENTA = 5;
81 static const WORD CYAN = 6;
82 static const WORD WHITE = 7;
207 void writeToScreen(
int x,
int y,
const std::wstring& text, WORD textColour, WORD backgroundColour);
222 #endif // SCREENBUFFER_H ~ScreenBuffer()
Destructor for the screenBuffer class.
Definition: screenBuffer.cpp:104
A class that represents the screen buffer.
Definition: screenBuffer.h:26
std::pair< int, int > getCursorPosition() const
Get the current location of the cursor.
Definition: screenBuffer.cpp:332
std::pair< WORD, WORD > getScreenColours(int x, int y, int length) const
Get the screen text and background colors.
Definition: screenBuffer.cpp:213
std::string getBlockingInput()
get blocking input from the user
Definition: screenBuffer.cpp:397
void setCursorVisibility(bool isVisible)
Set cursor visibility.
Definition: screenBuffer.cpp:300
void clearScreen()
Clears the screen buffer.
Definition: screenBuffer.cpp:150
void setScreenSize(int width, int height)
Set the size of the screen buffer and window.
Definition: screenBuffer.cpp:183
int getScreenWidth() const
Get the screen buffer width.
Definition: screenBuffer.cpp:164
HANDLE getScreenHandle() const
Get the screen buffer handle.
Definition: screenBuffer.cpp:112
void setCursorPosition(int x, int y)
Move the cursor to the specified location.
Definition: screenBuffer.cpp:319
std::string getNonBlockingInput()
get non-blocking input from the user
CONSOLE_SCREEN_BUFFER_INFO getScreenBufferInfo() const
Get screen buffer info.
Definition: screenBuffer.cpp:137
ScreenBuffer()
Constructor for the screenBuffer class.
Definition: screenBuffer.cpp:51
int getScreenHeight() const
Get the screen buffer height.
Definition: screenBuffer.cpp:174
std::wstring readScreenText(int x, int y, int length) const
Get part of text in the screen buffer.
Definition: screenBuffer.cpp:342
bool isActive() const
Check if the screen buffer is active.
Definition: screenBuffer.cpp:119
std::wstring readAllScreenText() const
Get all of the text in the screen buffer.
Definition: screenBuffer.cpp:370
void setActive()
Set the screen buffer to active.
Definition: screenBuffer.cpp:126
void writeToScreen(int x, int y, const std::wstring &text)
Write text to the screen at a specific location.
Definition: screenBuffer.cpp:378