xoreos
0.0.5
|
#include <console.h>
Public Member Functions | |
ConsoleWindow (const Common::UString &font, size_t lines, size_t history, int fontHeight=0) | |
~ConsoleWindow () | |
void | show () |
Show the object. More... | |
void | hide () |
Hide the object. More... | |
void | showPrompt () |
void | hidePrompt () |
bool | isIn (float x, float y) const |
Is that point within the object? More... | |
bool | isIn (float x, float y, float z) const |
Is that point within the object? More... | |
float | getWidth () const |
float | getHeight () const |
float | getContentWidth () const |
float | getContentHeight () const |
size_t | getLines () const |
size_t | getColumns () const |
void | setPrompt (const Common::UString &prompt) |
void | setInput (const Common::UString &input, size_t cursorPos, bool overwrite) |
void | clear () |
void | print (const Common::UString &line) |
bool | setRedirect (Common::UString redirect="") |
void | clearHighlight () |
void | startHighlight (int x, int y) |
void | stopHighlight (int x, int y) |
void | highlightWord (int x, int y) |
void | highlightLine (int x, int y) |
Common::UString | getHighlight () const |
void | scrollUp (size_t n=1) |
void | scrollDown (size_t n=1) |
void | scrollTop () |
void | scrollBottom () |
void | calculateDistance () |
Calculate the object's distance. More... | |
void | render (Graphics::RenderPass pass) |
Render the object. More... | |
Public Member Functions inherited from Graphics::GUIElement | |
GUIElement (GUIElementType type) | |
~GUIElement () | |
Public Member Functions inherited from Graphics::Renderable | |
Renderable (RenderableType type) | |
~Renderable () | |
bool | operator< (const Queueable &q) const |
virtual void | advanceTime (float dt) |
Advance time (used by renderables with animations). More... | |
virtual void | renderImmediate (const glm::mat4 &parentTransform) |
For shader based systems, don't sort anything, render this right_now. More... | |
virtual void | queueRender (const glm::mat4 &parentTransform) |
Queue the object for later rendering. More... | |
double | getDistance () const |
Get the distance of the object from the viewer. More... | |
uint32 | getID () const |
Get the object's unique ID. More... | |
bool | isClickable () const |
Is the object clickable? More... | |
void | setClickable (bool clickable) |
Set the object's clickable state. More... | |
const Common::UString & | getTag () const |
Get the object's tag. More... | |
void | setTag (const Common::UString &tag) |
Set the object's tag. More... | |
bool | isVisible () const |
Is the object visible? More... | |
virtual bool | isIn (float x1, float y1, float z1, float x2, float y2, float z2) const |
Does the line from x1.y1.z1 to x2.y2.z2 intersect with the object? More... | |
Public Member Functions inherited from Graphics::Queueable | |
Queueable () | |
virtual | ~Queueable () |
Public Member Functions inherited from Events::Notifyable | |
Notifyable () | |
virtual | ~Notifyable () |
Private Member Functions | |
void | recalcCursor () |
void | redrawLines () |
void | printLine (const Common::UString &line) |
bool | openLogFile () |
bool | openLogFile (const Common::UString &file) |
void | closeLogFile () |
void | updateHighlight () |
bool | getPosition (int cursorX, int cursorY, float &x, float &y) |
void | highlightClip (size_t &x, size_t &y) const |
void | updateScrollbarLength () |
void | updateScrollbarPosition () |
void | notifyResized (int oldWidth, int oldHeight, int newWidth, int newHeight) |
Static Private Member Functions | |
static size_t | findWordStart (const Common::UString &line, size_t pos) |
static size_t | findWordEnd (const Common::UString &line, size_t pos) |
Private Attributes | |
Graphics::Aurora::FontHandle | _font |
Common::ScopedPtr< Graphics::Aurora::Text > | _prompt |
Common::ScopedPtr< Graphics::Aurora::GUIQuad > | _cursor |
Common::ScopedPtr< Graphics::Aurora::GUIQuad > | _highlight |
size_t | _historySizeMax |
size_t | _historySizeCurrent |
std::list< Common::UString > | _history |
size_t | _historyStart |
std::vector< Graphics::Aurora::Text * > | _lines |
Common::ScopedPtr< Graphics::Aurora::Text > | _input |
Common::UString | _inputText |
size_t | _cursorPosition |
bool | _overwrite |
float | _lineHeight |
float | _x |
float | _y |
float | _width |
float | _height |
bool | _cursorBlinkState |
uint32 | _lastCursorBlink |
float | _scrollbarLength |
float | _scrollbarPosition |
size_t | _highlightX |
size_t | _highlightY |
ptrdiff_t | _highlightLength |
Common::WriteFile | _logFile |
Common::WriteFile | _redirect |
Additional Inherited Members | |
Public Types inherited from Graphics::GUIElement | |
enum | GUIElementType { kGUIElementFront = kRenderableTypeGUIFront, kGUIElementBack = kRenderableTypeGUIBack, kGUIElementConsole = kRenderableTypeConsole } |
Protected Member Functions inherited from Graphics::Renderable | |
void | resort () |
void | lockFrame () |
void | unlockFrame () |
void | lockFrameIfVisible () |
void | unlockFrameIfVisible () |
Protected Member Functions inherited from Graphics::Queueable | |
bool | isInQueue (QueueType queue) const |
void | addToQueue (QueueType queue) |
void | removeFromQueue (QueueType queue) |
void | lockQueue (QueueType queue) |
void | unlockQueue (QueueType queue) |
void | sortQueue (QueueType queue) |
Protected Attributes inherited from Graphics::Renderable | |
QueueType | _queueExists |
QueueType | _queueVisible |
uint32 | _id |
bool | _clickable |
Common::UString | _tag |
double | _distance |
The distance of the object from the viewer. More... | |
Engines::ConsoleWindow::ConsoleWindow | ( | const Common::UString & | font, |
size_t | lines, | ||
size_t | history, | ||
int | fontHeight = 0 |
||
) |
Definition at line 71 of file console.cpp.
References _cursor, _font, _height, _highlight, _input, _lineHeight, _lines, _prompt, calculateDistance(), clearHighlight(), Graphics::Aurora::FontHandle::getFont(), Graphics::Font::getHeight(), Graphics::Font::getLineSpacing(), Graphics::Font::getLineWidth(), Graphics::GUIElement::kGUIElementConsole, kPrompt, notifyResized(), openLogFile(), Common::ScopedPtrBase< T, Deallocator >::reset(), Graphics::Renderable::setClickable(), Graphics::Renderable::setTag(), updateScrollbarLength(), updateScrollbarPosition(), and WindowMan.
Engines::ConsoleWindow::~ConsoleWindow | ( | ) |
Definition at line 119 of file console.cpp.
References _lines, _redirect, Common::WriteFile::close(), and Common::WriteFile::flush().
|
virtual |
Calculate the object's distance.
Implements Graphics::Renderable.
Definition at line 557 of file console.cpp.
References Graphics::Renderable::_distance.
Referenced by ConsoleWindow().
void Engines::ConsoleWindow::clear | ( | ) |
Definition at line 254 of file console.cpp.
References _history, _historySizeCurrent, _historyStart, _lines, GfxMan, updateScrollbarLength(), and updateScrollbarPosition().
void Engines::ConsoleWindow::clearHighlight | ( | ) |
Definition at line 481 of file console.cpp.
References _highlightLength, _highlightX, _highlightY, and updateHighlight().
Referenced by ConsoleWindow(), highlightLine(), highlightWord(), and startHighlight().
|
private |
Definition at line 354 of file console.cpp.
References _logFile, and Common::WriteFile::close().
Referenced by openLogFile().
|
staticprivate |
Definition at line 647 of file console.cpp.
References Common::UString::end(), and Common::UString::getPosition().
Referenced by highlightWord().
|
staticprivate |
Definition at line 633 of file console.cpp.
References Common::UString::begin(), Common::UString::end(), and Common::UString::getPosition().
Referenced by highlightWord().
size_t Engines::ConsoleWindow::getColumns | ( | ) | const |
Definition at line 221 of file console.cpp.
References _font, getContentWidth(), Graphics::Aurora::FontHandle::getFont(), and Graphics::Font::getWidth().
float Engines::ConsoleWindow::getContentHeight | ( | ) | const |
Definition at line 213 of file console.cpp.
References _height, and _lineHeight.
float Engines::ConsoleWindow::getContentWidth | ( | ) | const |
Definition at line 209 of file console.cpp.
References _width.
Referenced by getColumns().
float Engines::ConsoleWindow::getHeight | ( | ) | const |
Definition at line 205 of file console.cpp.
References _height.
Common::UString Engines::ConsoleWindow::getHighlight | ( | ) | const |
Definition at line 489 of file console.cpp.
References _highlightLength, _highlightX, _highlightY, _input, _lines, _prompt, Common::ScopedPtrBase< T, Deallocator >::get(), Common::UString::getPosition(), kConsoleLines, Common::UString::substr(), and SWAP().
size_t Engines::ConsoleWindow::getLines | ( | ) | const |
Definition at line 217 of file console.cpp.
References _lines.
|
private |
Definition at line 377 of file console.cpp.
References _font, _height, _lineHeight, _width, _x, _y, CursorMan, Graphics::Aurora::FontHandle::getFont(), and Graphics::Font::getWidth().
Referenced by highlightLine(), highlightWord(), startHighlight(), and stopHighlight().
float Engines::ConsoleWindow::getWidth | ( | ) | const |
Definition at line 201 of file console.cpp.
References _width.
|
virtual |
Hide the object.
Reimplemented from Graphics::Renderable.
Definition at line 145 of file console.cpp.
References _cursor, _highlight, _input, _lines, _prompt, GfxMan, and Graphics::Renderable::hide().
void Engines::ConsoleWindow::hidePrompt | ( | ) |
Definition at line 175 of file console.cpp.
References _cursor, _input, _prompt, GfxMan, and Graphics::Renderable::isVisible().
|
private |
Definition at line 392 of file console.cpp.
References _input, _lines, _prompt, CLIP(), and Common::ScopedPtrBase< T, Deallocator >::get().
Referenced by highlightLine(), highlightWord(), startHighlight(), and stopHighlight().
void Engines::ConsoleWindow::highlightLine | ( | int | x, |
int | y | ||
) |
Definition at line 462 of file console.cpp.
References _highlightLength, _highlightX, _highlightY, _input, _lines, clearHighlight(), Common::ScopedPtrBase< T, Deallocator >::get(), getPosition(), highlightClip(), Common::UString::size(), and updateHighlight().
void Engines::ConsoleWindow::highlightWord | ( | int | x, |
int | y | ||
) |
Definition at line 436 of file console.cpp.
References _highlightLength, _highlightX, _highlightY, _input, _lines, _prompt, clearHighlight(), findWordEnd(), findWordStart(), Common::ScopedPtrBase< T, Deallocator >::get(), getPosition(), highlightClip(), and updateHighlight().
|
virtual |
Is that point within the object?
Reimplemented from Graphics::Renderable.
Definition at line 188 of file console.cpp.
References _height, _width, _x, and _y.
Referenced by isIn().
|
virtual |
Is that point within the object?
Reimplemented from Graphics::Renderable.
Definition at line 197 of file console.cpp.
References isIn().
|
privatevirtual |
Reimplemented from Events::Notifyable.
Definition at line 615 of file console.cpp.
References _height, _input, _lineHeight, _lines, _prompt, _width, _x, _y, and recalcCursor().
Referenced by ConsoleWindow().
|
private |
Definition at line 321 of file console.cpp.
References Common::UString::clear(), ConfigMan, Common::UString::empty(), and Common::FilePath::getUserDataDirectory().
Referenced by ConsoleWindow().
|
private |
Definition at line 339 of file console.cpp.
References _logFile, Common::FilePath::canonicalize(), closeLogFile(), Common::FilePath::createDirectories(), Common::FilePath::getDirectory(), and Common::WriteFile::open().
void Engines::ConsoleWindow::print | ( | const Common::UString & | line | ) |
Definition at line 271 of file console.cpp.
References _font, _width, Graphics::Aurora::FontHandle::getFont(), printLine(), and Graphics::Font::split().
Referenced by setRedirect().
|
private |
Definition at line 279 of file console.cpp.
References _history, _historySizeCurrent, _historySizeMax, _logFile, _redirect, Common::WriteFile::flush(), Common::WriteFile::isOpen(), redrawLines(), updateScrollbarLength(), Common::WriteStream::writeByte(), and Common::WriteStream::writeString().
Referenced by print().
|
private |
Definition at line 658 of file console.cpp.
References _cursor, _cursorPosition, _font, _inputText, _overwrite, _prompt, _x, _y, Graphics::Aurora::FontHandle::getFont(), Graphics::Font::getWidth(), and Common::UString::truncate().
Referenced by notifyResized(), setInput(), and setPrompt().
|
private |
Definition at line 669 of file console.cpp.
References _history, _historyStart, _lines, and GfxMan.
Referenced by printLine(), scrollBottom(), scrollDown(), scrollTop(), and scrollUp().
|
virtual |
Render the object.
Implements Graphics::Renderable.
Definition at line 561 of file console.cpp.
References _cursor, _cursorBlinkState, _height, _lastCursorBlink, _scrollbarLength, _scrollbarPosition, _width, _x, _y, EventMan, Graphics::kRenderPassOpaque, pass, and TextureMan.
void Engines::ConsoleWindow::scrollBottom | ( | ) |
Definition at line 547 of file console.cpp.
References _historyStart, redrawLines(), and updateScrollbarPosition().
void Engines::ConsoleWindow::scrollDown | ( | size_t | n = 1 | ) |
Definition at line 523 of file console.cpp.
References _historyStart, MIN(), redrawLines(), and updateScrollbarPosition().
void Engines::ConsoleWindow::scrollTop | ( | ) |
Definition at line 533 of file console.cpp.
References _historySizeCurrent, _historyStart, _lines, redrawLines(), and updateScrollbarPosition().
void Engines::ConsoleWindow::scrollUp | ( | size_t | n = 1 | ) |
Definition at line 513 of file console.cpp.
References _historySizeCurrent, _historyStart, _lines, redrawLines(), and updateScrollbarPosition().
void Engines::ConsoleWindow::setInput | ( | const Common::UString & | input, |
size_t | cursorPos, | ||
bool | overwrite | ||
) |
Definition at line 236 of file console.cpp.
References _cursorBlinkState, _cursorPosition, _input, _inputText, _lastCursorBlink, _overwrite, GfxMan, and recalcCursor().
void Engines::ConsoleWindow::setPrompt | ( | const Common::UString & | prompt | ) |
Definition at line 225 of file console.cpp.
References _input, _prompt, _x, _y, GfxMan, and recalcCursor().
bool Engines::ConsoleWindow::setRedirect | ( | Common::UString | redirect = "" | ) |
Definition at line 302 of file console.cpp.
References _redirect, Common::UString::c_str(), Common::WriteFile::close(), Common::UString::empty(), error(), Common::WriteFile::flush(), Common::UString::format(), Common::FilePath::getUserDataFile(), Common::WriteFile::open(), and print().
|
virtual |
Show the object.
Reimplemented from Graphics::Renderable.
Definition at line 128 of file console.cpp.
References _cursor, _highlight, _input, _lines, _prompt, GfxMan, and Graphics::Renderable::show().
void Engines::ConsoleWindow::showPrompt | ( | ) |
Definition at line 162 of file console.cpp.
References _cursor, _input, _prompt, GfxMan, and Graphics::Renderable::isVisible().
void Engines::ConsoleWindow::startHighlight | ( | int | x, |
int | y | ||
) |
Definition at line 407 of file console.cpp.
References _highlightX, _highlightY, clearHighlight(), getPosition(), highlightClip(), and updateHighlight().
void Engines::ConsoleWindow::stopHighlight | ( | int | x, |
int | y | ||
) |
Definition at line 422 of file console.cpp.
References _highlightLength, _highlightX, _highlightY, getPosition(), highlightClip(), and updateHighlight().
|
private |
Definition at line 358 of file console.cpp.
References _font, _highlight, _highlightLength, _highlightX, _highlightY, _lineHeight, _x, _y, ABS(), Graphics::Aurora::FontHandle::getFont(), Graphics::Font::getWidth(), kConsoleLines, and MIN().
Referenced by clearHighlight(), highlightLine(), highlightWord(), startHighlight(), and stopHighlight().
|
private |
Definition at line 681 of file console.cpp.
References _height, _historySizeCurrent, _lines, _scrollbarLength, and CLIP().
Referenced by clear(), ConsoleWindow(), and printLine().
|
private |
Definition at line 691 of file console.cpp.
References _height, _historySizeCurrent, _historyStart, _lines, _scrollbarLength, _scrollbarPosition, and CLIP().
Referenced by clear(), ConsoleWindow(), scrollBottom(), scrollDown(), scrollTop(), and scrollUp().
|
private |
Definition at line 129 of file console.h.
Referenced by ConsoleWindow(), hide(), hidePrompt(), recalcCursor(), render(), show(), and showPrompt().
|
private |
Definition at line 154 of file console.h.
Referenced by render(), and setInput().
|
private |
Definition at line 143 of file console.h.
Referenced by recalcCursor(), and setInput().
|
private |
Definition at line 126 of file console.h.
Referenced by ConsoleWindow(), getColumns(), getPosition(), print(), recalcCursor(), and updateHighlight().
|
private |
Definition at line 152 of file console.h.
Referenced by ConsoleWindow(), getContentHeight(), getHeight(), getPosition(), isIn(), notifyResized(), render(), updateScrollbarLength(), and updateScrollbarPosition().
|
private |
Definition at line 130 of file console.h.
Referenced by ConsoleWindow(), hide(), show(), and updateHighlight().
|
private |
Definition at line 162 of file console.h.
Referenced by clearHighlight(), getHighlight(), highlightLine(), highlightWord(), stopHighlight(), and updateHighlight().
|
private |
Definition at line 160 of file console.h.
Referenced by clearHighlight(), getHighlight(), highlightLine(), highlightWord(), startHighlight(), stopHighlight(), and updateHighlight().
|
private |
Definition at line 161 of file console.h.
Referenced by clearHighlight(), getHighlight(), highlightLine(), highlightWord(), startHighlight(), stopHighlight(), and updateHighlight().
|
private |
Definition at line 134 of file console.h.
Referenced by clear(), printLine(), and redrawLines().
|
private |
Definition at line 133 of file console.h.
Referenced by clear(), printLine(), scrollTop(), scrollUp(), updateScrollbarLength(), and updateScrollbarPosition().
|
private |
Definition at line 132 of file console.h.
Referenced by printLine().
|
private |
Definition at line 136 of file console.h.
Referenced by clear(), redrawLines(), scrollBottom(), scrollDown(), scrollTop(), scrollUp(), and updateScrollbarPosition().
|
private |
Definition at line 139 of file console.h.
Referenced by ConsoleWindow(), getHighlight(), hide(), hidePrompt(), highlightClip(), highlightLine(), highlightWord(), notifyResized(), setInput(), setPrompt(), show(), and showPrompt().
|
private |
Definition at line 142 of file console.h.
Referenced by recalcCursor(), and setInput().
|
private |
Definition at line 155 of file console.h.
Referenced by render(), and setInput().
|
private |
Definition at line 147 of file console.h.
Referenced by ConsoleWindow(), getContentHeight(), getPosition(), notifyResized(), and updateHighlight().
|
private |
Definition at line 138 of file console.h.
Referenced by clear(), ConsoleWindow(), getHighlight(), getLines(), hide(), highlightClip(), highlightLine(), highlightWord(), notifyResized(), redrawLines(), scrollTop(), scrollUp(), show(), updateScrollbarLength(), updateScrollbarPosition(), and ~ConsoleWindow().
|
private |
Definition at line 164 of file console.h.
Referenced by closeLogFile(), openLogFile(), and printLine().
|
private |
Definition at line 144 of file console.h.
Referenced by recalcCursor(), and setInput().
|
private |
Definition at line 128 of file console.h.
Referenced by ConsoleWindow(), getHighlight(), hide(), hidePrompt(), highlightClip(), highlightWord(), notifyResized(), recalcCursor(), setPrompt(), show(), and showPrompt().
|
private |
Definition at line 165 of file console.h.
Referenced by printLine(), setRedirect(), and ~ConsoleWindow().
|
private |
Definition at line 157 of file console.h.
Referenced by render(), updateScrollbarLength(), and updateScrollbarPosition().
|
private |
Definition at line 158 of file console.h.
Referenced by render(), and updateScrollbarPosition().
|
private |
Definition at line 151 of file console.h.
Referenced by getContentWidth(), getPosition(), getWidth(), isIn(), notifyResized(), print(), and render().
|
private |
Definition at line 149 of file console.h.
Referenced by getPosition(), isIn(), notifyResized(), recalcCursor(), render(), setPrompt(), and updateHighlight().
|
private |
Definition at line 150 of file console.h.
Referenced by getPosition(), isIn(), notifyResized(), recalcCursor(), render(), setPrompt(), and updateHighlight().