Implemented cursor functionality into ostd::ConsoleOutputHandler
This commit is contained in:
parent
f0bd0c5d09
commit
01a77d722d
4 changed files with 75 additions and 6 deletions
|
|
@ -1 +1 @@
|
|||
2029
|
||||
2031
|
||||
|
|
|
|||
|
|
@ -212,5 +212,18 @@ namespace ostd
|
|||
OutputHandlerBase& flush(void) override;
|
||||
OutputHandlerBase& reset(void) override;
|
||||
OutputHandlerBase& clear(void) override;
|
||||
|
||||
OutputHandlerBase& xy(IPoint position) override;
|
||||
OutputHandlerBase& xy(int32_t x, int32_t y) override;
|
||||
OutputHandlerBase& x(int32_t x) override;
|
||||
OutputHandlerBase& y(int32_t y) override;
|
||||
|
||||
IPoint getCursorPosition(void) override;
|
||||
void getCursorPosition(int32_t& outX, int32_t& outY) override;
|
||||
int32_t getCursorX(void) override;
|
||||
int32_t getCursorY(void) override;
|
||||
|
||||
void getConsoleSize(int32_t& outColumns, int32_t& outRows) override;
|
||||
IPoint getConsoleSize(void) override;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -213,4 +213,65 @@ namespace ostd
|
|||
BasicConsole::clearConsole();
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::xy(IPoint position)
|
||||
{
|
||||
BasicConsole::setConsoleCursorPosition(position.x, position.y);
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::xy(int32_t x, int32_t y)
|
||||
{
|
||||
BasicConsole::setConsoleCursorPosition(x, y);
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::x(int32_t x)
|
||||
{
|
||||
int32_t y = getCursorPosition().y;
|
||||
return xy(x, y);
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::y(int32_t y)
|
||||
{
|
||||
int32_t x = getCursorPosition().x;
|
||||
return xy(x, y);
|
||||
}
|
||||
|
||||
IPoint ConsoleOutputHandler::getCursorPosition(void)
|
||||
{
|
||||
return BasicConsole::getConsoleCursorPosition();
|
||||
}
|
||||
|
||||
void ConsoleOutputHandler::getCursorPosition(int32_t& outX, int32_t& outY)
|
||||
{
|
||||
auto pos = BasicConsole::getConsoleCursorPosition();;
|
||||
outX = pos.x;
|
||||
outY = pos.y;
|
||||
}
|
||||
|
||||
int32_t ConsoleOutputHandler::getCursorX(void)
|
||||
{
|
||||
auto pos = BasicConsole::getConsoleCursorPosition();;
|
||||
return pos.x;
|
||||
}
|
||||
|
||||
int32_t ConsoleOutputHandler::getCursorY(void)
|
||||
{
|
||||
auto pos = BasicConsole::getConsoleCursorPosition();;
|
||||
return pos.y;
|
||||
}
|
||||
|
||||
void ConsoleOutputHandler::getConsoleSize(int32_t& outColumns, int32_t& outRows)
|
||||
{
|
||||
BasicConsole::getConsoleSize(outColumns, outRows);
|
||||
}
|
||||
|
||||
IPoint ConsoleOutputHandler::getConsoleSize(void)
|
||||
{
|
||||
IPoint size;
|
||||
BasicConsole::getConsoleSize(size.x, size.y);
|
||||
return size;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,11 +139,6 @@ namespace ostd
|
|||
private:
|
||||
String m_rawString { "" };
|
||||
};
|
||||
|
||||
//TODO: Implement
|
||||
// public: class FullColor {
|
||||
|
||||
// };
|
||||
};
|
||||
|
||||
typedef TextStyleBuilder::Console ConsoleRichString;
|
||||
|
|
|
|||
Loading…
Reference in a new issue