#include <Console.h>
Inheritance diagram for random_racer::Console:

Public Member Functions | |
| VRS::SO< VRS::SceneThing > | sceneThing () |
| Returns the SceneThing which you can get put into a scene graph and which represents the internal state of the console. | |
| VRS::SO< VRS::Canvas > | canvas () |
| Returns the SO to the canvas we are currently attached to. | |
| void | setCanvas (VRS::SO< VRS::Canvas > canvas) |
| Sets the current canvas to this new canvas. | |
| void | attach (VRS::SO< VRS::Canvas > canvas) |
| Appends the Console to the given VRS::Canvas and sets the pointer to this object via setCanvas() method. | |
| void | detach () |
| Removes the console from the current Canvas and unregisters all callbacks. | |
| VRS::SO< VRS::Font > | font () |
| Returns the Font Object which is used by the Console for painting Text. | |
| bool | isVisible () |
| Returns if the Console is currently visible or not. | |
| bool | isHidden () |
| For the very lazy ones. | |
| void | addLine (const std::string &p_newLine) |
| Adds a line of text to the visible buffer of the console. | |
| bool | registerCommand (const std::string &p_name, VRS::SO< VRS::Callback > p_callBack) |
| Registers a callback for a given command name for execution when this command is entered into the Console. | |
| bool | registerCommand (const std::string &p_name, VRS::SO< VRS::Callback1< const std::string & > > p_callBack) |
| Registers a callback with 1 argument, when called this argument will be the text entered after the commands name (with leading spaces stripped). | |
| bool | registerCommand (const std::string &p_name, VRS::SO< VRS::Callback2< const std::string &, const std::string & > > p_callBack) |
| Registers a callback with 2 arguments, when called the first argument will be the name of the command entered by the user (with trailing and leading spaces stripped) and the second one will be the argument line. | |
| bool | unregisterCommand (const std::string &p_name) |
| Unregisters the command with the given name. | |
| bool | toggleVisibility () |
| Toggles visibility and returns if the Console is now visible or not. | |
| void | hide () |
| Hides the console. | |
| void | show () |
| Shows the console. | |
| void | handleKey (unsigned int key) |
| Send a key to the Console and let it decide how to handle it. | |
| void | historyUp (bool reallyUp=true) |
| Scrolls the history up (or down) by one line. | |
| void | historyDown () |
| Provided for convienience. | |
| void | tabCompleteForward (bool forward=true) |
| Triggers forward or backward tab completition. | |
| void | tabCompleteBackward () |
| A shortcut method for the lazy ones. | |
| void | autoexec () |
| Executes the autoexec.txt file in your local Random Racer folder. | |
Static Public Member Functions | |
| static VRS::SO< Console > | get () |
| Returns the singleton Console Object, when used the first time this creates the initial Console. | |
Private Types | |
| enum | Keys { BackSpaceKey = 8, DeleteKey = 127, DeleteLineKey = 21, EnterKey = 3, ReturnKey = 13, UpKey = 65297, DownKey = 65296, LeftKey = 65298, RightKey = 65299, TabKey = '\t', ShiftTabKey = 25 } |
Private Member Functions | |
| void | startAnimation () |
| This starts a new animation, used in show() and hide(). | |
| Console () | |
| The Ctor is private, use get() to obtain the object. | |
| bool | dispatchCommand (const std::string &, bool batchMode=false) |
| This parses the passed line as a command line and executes it. | |
| void | handleEvents () |
| Recieves the events from the canvas and dispatches them to a specialized method like resizeEvent(). | |
| void | resizeEvent (VRS::SO< VRS::ResizeEvent > event) |
| Handles the resize events and adjusts the camera acording to it. | |
| void | keyEvent (VRS::SO< VRS::KeyEvent > event) |
| Sends the keys typed on a keyboard to the console. | |
| virtual void | timerTick () |
| This is the virtual method we have to implement for TimeableObject so we recieve timer ticks. | |
Private Attributes | |
| VRS::SO< VRS::SceneThing > | m_sceneThing |
| Our root scene thing in which all visibly parts of the console resident in. | |
| VRS::SO< VRS::Font > | m_font |
| The font used for drawing the text of the console. | |
| VRS::SO< VRS::Text > | m_currentLine |
| Holds the VRS::Text object representing the line we are currently typing into. | |
| VRS::SO< TextBuffer > | m_textBuffer |
| The buffer of already executed commands and their results. | |
| VRS::SO< VRS::Canvas > | m_canvas |
| A pointer to the canvas we are currently connected to. | |
| VRS::SO< VRS::BehaviorCallback > | m_eventCallback |
| The callback object we use for getting key-events from the canvas. | |
| VRS::SO< VRS::Camera > | m_cam |
| Our orthogonal camera, gets replaced when the window is resized. | |
| std::list< std::string > | m_history |
| This linked list holds the history. | |
| std::list< std::string >::iterator | m_histIter |
| Points to the current entry in the history. | |
| std::string | m_currentTabWord |
| Holds the current word we use for tab completition. | |
| std::list< std::string > | m_tabList |
| This contains all the possible words with m_currentTabWord as starting word. | |
| std::list< std::string >::iterator | m_tabIter |
| This iterator points to anywhere in m_tabList and is used for pressing multiple times tab. | |
| bool | m_startNewTabCompletition |
| If true then tabCompleteForward() will start a new completition next time it is called. | |
| bool | m_lastTabWasForward |
| For remembering in which direction we did the last tab to compensate inconsistencies. | |
| VRS::NonPersistentDictionary< std::string, VRS::SO< VRS::CallbackBase > > | m_registry |
| Holds the callback objects and the matching command strings. | |
| double | m_animationDistance |
| Used to remember the distance the animation has to take in a hide so that we know when it is finished. | |
| double | m_distancePerTick |
| This is the distance we want to do every 1ms, gets calculated when you start a animation. | |
| unsigned int | m_lastTick |
| This is to remember when the last tick was so we know how much time elapsed. | |
| bool | m_animationInProgress |
| True if a animation is in progress, so you cannot start 2x show, etc. | |
| VRS::SO< VRS::Translation > | m_translation |
| The translation we modify when moving the console up or down. | |
Static Private Attributes | |
| static const float | c_marginY |
| static const float | c_marginX |
| static const float | c_pixelsPerChar |
| static const unsigned int | c_animationDuration |
| Change this if you want that the show and hide animations are longer or shorter. | |
| static VRS::SO< Console > | s_instance |
| Stores our singleton. | |
Classes | |
| class | TextBuffer |
| A internal class used for collecting all the Text lines. More... | |
Definition at line 35 of file Console.h.
enum random_racer::Console::Keys [private] |
| random_racer::Console::Console | ( | ) | [private] |
The Ctor is private, use get() to obtain the object.
Definition at line 79 of file Console.cpp.
References c_marginX, c_marginY, random_racer::ResourceManager::get(), handleEvents(), m_animationInProgress, m_cam, m_canvas, m_currentLine, m_eventCallback, m_font, m_histIter, m_history, m_sceneThing, m_startNewTabCompletition, m_textBuffer, and m_translation.
Referenced by get().
Here is the call graph for this function:

Here is the caller graph for this function:

| void random_racer::Console::startAnimation | ( | ) | [private] |
This starts a new animation, used in show() and hide().
Definition at line 560 of file Console.cpp.
References m_animationInProgress, m_lastTick, and random_utils::TimeableObject::startTimer().
Referenced by hide(), and show().
Here is the call graph for this function:

Here is the caller graph for this function:

| bool random_racer::Console::dispatchCommand | ( | const std::string & | , | |
| bool | batchMode = false | |||
| ) | [private] |
This parses the passed line as a command line and executes it.
Definition at line 206 of file Console.cpp.
References addLine(), m_histIter, m_history, and m_registry.
Referenced by autoexec(), and handleKey().
Here is the call graph for this function:

Here is the caller graph for this function:

| void random_racer::Console::handleEvents | ( | ) | [private] |
Recieves the events from the canvas and dispatches them to a specialized method like resizeEvent().
Definition at line 365 of file Console.cpp.
References keyEvent(), m_canvas, m_eventCallback, and resizeEvent().
Referenced by Console().
Here is the call graph for this function:

Here is the caller graph for this function:

| void random_racer::Console::resizeEvent | ( | VRS::SO< VRS::ResizeEvent > | event | ) | [private] |
Handles the resize events and adjusts the camera acording to it.
Referenced by handleEvents().
Here is the caller graph for this function:

| void random_racer::Console::keyEvent | ( | VRS::SO< VRS::KeyEvent > | event | ) | [private] |
Sends the keys typed on a keyboard to the console.
Referenced by handleEvents().
Here is the caller graph for this function:

| void random_racer::Console::timerTick | ( | ) | [private, virtual] |
This is the virtual method we have to implement for TimeableObject so we recieve timer ticks.
Implements random_utils::TimeableObject.
Definition at line 600 of file Console.cpp.
References m_animationDistance, m_animationInProgress, m_distancePerTick, m_lastTick, m_sceneThing, m_translation, and random_utils::TimeableObject::stopTimer().
Here is the call graph for this function:

| SO< Console > random_racer::Console::get | ( | ) | [static] |
Returns the singleton Console Object, when used the first time this creates the initial Console.
Definition at line 145 of file Console.cpp.
References Console(), and s_instance.
Referenced by random_racer::Console::TextBuffer::addLine(), random_racer::MainApplication::autoexecCommand(), random_racer::MainApplication::camBackCommand(), random_racer::MainApplication::camCorrectCommand(), random_racer::MainApplication::camDelayCommand(), random_racer::MainApplication::camStaticCommand(), random_racer::MainApplication::camUpCommand(), random_racer::MainApplication::carPositionCommand(), random_racer::ControlPointGenerator::ControlPointGenerator(), random_racer::MainApplication::fovCommand(), random_racer::MainApplication::MainApplication(), random_racer::MeshBeautifier::MeshBeautifier(), random_racer::MainApplication::phyPerformanceAdjustCommand(), random_racer::MainApplication::phyStepSizeCommand(), random_racer::MainApplication::phyStepTimeCommand(), random_racer::MainApplication::registerCommands(), random_racer::Presenter::startPresentation(), random_racer::MainApplication::terDebugPlanesCommand(), random_racer::ControlPointGenerator::terGenrateLowRoundsCommand(), random_racer::ControlPointGenerator::terGenrateMidHeightCommand(), random_racer::ControlPointGenerator::terGenrateUpRoundsCommand(), random_racer::MeshBeautifier::terLoadTextureCommand(), and random_racer::MainApplication::versionCommand().
Here is the call graph for this function:

Here is the caller graph for this function:

| VRS::SO<VRS::SceneThing> random_racer::Console::sceneThing | ( | ) | [inline] |
Returns the SceneThing which you can get put into a scene graph and which represents the internal state of the console.
Definition at line 250 of file Console.h.
References m_sceneThing.
Referenced by detach().
Here is the caller graph for this function:

| VRS::SO<VRS::Canvas> random_racer::Console::canvas | ( | ) | [inline] |
| void random_racer::Console::setCanvas | ( | VRS::SO< VRS::Canvas > | canvas | ) |
Sets the current canvas to this new canvas.
| canvas | The new canvas. |
Referenced by detach().
Here is the caller graph for this function:

| void random_racer::Console::attach | ( | VRS::SO< VRS::Canvas > | canvas | ) |
Appends the Console to the given VRS::Canvas and sets the pointer to this object via setCanvas() method.
| canvas | The canvas to attach to. |
| void random_racer::Console::detach | ( | ) |
Removes the console from the current Canvas and unregisters all callbacks.
Definition at line 422 of file Console.cpp.
References m_canvas, sceneThing(), and setCanvas().
Here is the call graph for this function:

| VRS::SO<VRS::Font> random_racer::Console::font | ( | ) | [inline] |
Returns the Font Object which is used by the Console for painting Text.
Definition at line 285 of file Console.h.
References m_font.
Referenced by random_racer::Console::TextBuffer::addLine().
Here is the caller graph for this function:

| bool random_racer::Console::isVisible | ( | ) |
Returns if the Console is currently visible or not.
Definition at line 554 of file Console.cpp.
References m_animationInProgress, and m_sceneThing.
Referenced by isHidden(), and toggleVisibility().
Here is the caller graph for this function:

| bool random_racer::Console::isHidden | ( | ) | [inline] |
For the very lazy ones.
Definition at line 295 of file Console.h.
References isVisible().
Here is the call graph for this function:

| void random_racer::Console::addLine | ( | const std::string & | p_newLine | ) | [inline] |
Adds a line of text to the visible buffer of the console.
Definition at line 300 of file Console.h.
References m_textBuffer.
Referenced by dispatchCommand().
Here is the caller graph for this function:

| bool random_racer::Console::registerCommand | ( | const std::string & | p_name, | |
| VRS::SO< VRS::Callback > | p_callBack | |||
| ) | [inline] |
Registers a callback for a given command name for execution when this command is entered into the Console.
Definition at line 309 of file Console.h.
References m_registry.
| bool random_racer::Console::registerCommand | ( | const std::string & | p_name, | |
| VRS::SO< VRS::Callback1< const std::string & > > | p_callBack | |||
| ) | [inline] |
Registers a callback with 1 argument, when called this argument will be the text entered after the commands name (with leading spaces stripped).
Definition at line 321 of file Console.h.
References m_registry.
| bool random_racer::Console::registerCommand | ( | const std::string & | p_name, | |
| VRS::SO< VRS::Callback2< const std::string &, const std::string & > > | p_callBack | |||
| ) | [inline] |
Registers a callback with 2 arguments, when called the first argument will be the name of the command entered by the user (with trailing and leading spaces stripped) and the second one will be the argument line.
Definition at line 334 of file Console.h.
References m_registry.
| bool random_racer::Console::unregisterCommand | ( | const std::string & | p_name | ) | [inline] |
Unregisters the command with the given name.
Definition at line 344 of file Console.h.
References m_registry.
| bool random_racer::Console::toggleVisibility | ( | ) |
Toggles visibility and returns if the Console is now visible or not.
Definition at line 539 of file Console.cpp.
References hide(), isVisible(), and show().
Here is the call graph for this function:

| void random_racer::Console::hide | ( | ) |
Hides the console.
Definition at line 570 of file Console.cpp.
References c_animationDuration, c_pixelsPerChar, m_animationDistance, m_animationInProgress, m_canvas, m_distancePerTick, m_sceneThing, and startAnimation().
Referenced by toggleVisibility().
Here is the call graph for this function:

Here is the caller graph for this function:

| void random_racer::Console::show | ( | ) |
Shows the console.
Definition at line 583 of file Console.cpp.
References c_animationDuration, c_pixelsPerChar, m_animationDistance, m_animationInProgress, m_canvas, m_distancePerTick, m_sceneThing, m_translation, and startAnimation().
Referenced by toggleVisibility().
Here is the call graph for this function:

Here is the caller graph for this function:

| void random_racer::Console::handleKey | ( | unsigned int | key | ) |
Send a key to the Console and let it decide how to handle it.
Definition at line 154 of file Console.cpp.
References BackSpaceKey, DeleteKey, DeleteLineKey, dispatchCommand(), DownKey, EnterKey, historyDown(), historyUp(), m_currentLine, m_font, m_sceneThing, m_startNewTabCompletition, m_textBuffer, ReturnKey, ShiftTabKey, tabCompleteBackward(), tabCompleteForward(), TabKey, and UpKey.
Here is the call graph for this function:

| void random_racer::Console::historyUp | ( | bool | reallyUp = true |
) |
Scrolls the history up (or down) by one line.
| reallyUp | Setting this to false means to scroll down. |
Definition at line 323 of file Console.cpp.
References m_currentLine, m_histIter, and m_history.
Referenced by handleKey(), and historyDown().
Here is the caller graph for this function:

| void random_racer::Console::historyDown | ( | ) | [inline] |
Provided for convienience.
Definition at line 380 of file Console.h.
References historyUp().
Referenced by handleKey().
Here is the call graph for this function:

Here is the caller graph for this function:

| void random_racer::Console::tabCompleteForward | ( | bool | forward = true |
) |
Triggers forward or backward tab completition.
| forward | If true, forward, if false backward. |
Definition at line 439 of file Console.cpp.
References iterateBackCyclic, iterateForwardCyclic, m_currentLine, m_currentTabWord, m_lastTabWasForward, m_registry, m_startNewTabCompletition, m_tabIter, and m_tabList.
Referenced by handleKey(), and tabCompleteBackward().
Here is the caller graph for this function:

| void random_racer::Console::tabCompleteBackward | ( | ) | [inline] |
A shortcut method for the lazy ones.
Definition at line 395 of file Console.h.
References tabCompleteForward().
Referenced by handleKey().
Here is the call graph for this function:

Here is the caller graph for this function:

| void random_racer::Console::autoexec | ( | ) |
Executes the autoexec.txt file in your local Random Racer folder.
(see ResourceManager where this folder should be)
Definition at line 516 of file Console.cpp.
References dispatchCommand(), and random_racer::ResourceManager::get().
Here is the call graph for this function:

const float random_racer::Console::c_marginY [static, private] |
const float random_racer::Console::c_marginX [static, private] |
const float random_racer::Console::c_pixelsPerChar [static, private] |
VRS::SO<VRS::SceneThing> random_racer::Console::m_sceneThing [private] |
Our root scene thing in which all visibly parts of the console resident in.
Definition at line 81 of file Console.h.
Referenced by Console(), handleKey(), hide(), isVisible(), sceneThing(), show(), and timerTick().
VRS::SO<VRS::Font> random_racer::Console::m_font [private] |
The font used for drawing the text of the console.
Definition at line 86 of file Console.h.
Referenced by Console(), font(), and handleKey().
VRS::SO<VRS::Text> random_racer::Console::m_currentLine [private] |
Holds the VRS::Text object representing the line we are currently typing into.
Definition at line 92 of file Console.h.
Referenced by Console(), handleKey(), historyUp(), and tabCompleteForward().
VRS::SO<TextBuffer> random_racer::Console::m_textBuffer [private] |
The buffer of already executed commands and their results.
Definition at line 97 of file Console.h.
Referenced by addLine(), Console(), and handleKey().
VRS::SO<VRS::Canvas> random_racer::Console::m_canvas [private] |
VRS::SO<VRS::BehaviorCallback> random_racer::Console::m_eventCallback [private] |
The callback object we use for getting key-events from the canvas.
Definition at line 107 of file Console.h.
Referenced by Console(), and handleEvents().
VRS::SO<VRS::Camera> random_racer::Console::m_cam [private] |
std::list<std::string> random_racer::Console::m_history [private] |
This linked list holds the history.
Definition at line 117 of file Console.h.
Referenced by Console(), dispatchCommand(), and historyUp().
std::list<std::string>::iterator random_racer::Console::m_histIter [private] |
Points to the current entry in the history.
Definition at line 122 of file Console.h.
Referenced by Console(), dispatchCommand(), and historyUp().
std::string random_racer::Console::m_currentTabWord [private] |
Holds the current word we use for tab completition.
Definition at line 127 of file Console.h.
Referenced by tabCompleteForward().
std::list<std::string> random_racer::Console::m_tabList [private] |
This contains all the possible words with m_currentTabWord as starting word.
Definition at line 133 of file Console.h.
Referenced by tabCompleteForward().
std::list<std::string>::iterator random_racer::Console::m_tabIter [private] |
This iterator points to anywhere in m_tabList and is used for pressing multiple times tab.
Definition at line 139 of file Console.h.
Referenced by tabCompleteForward().
bool random_racer::Console::m_startNewTabCompletition [private] |
If true then tabCompleteForward() will start a new completition next time it is called.
Definition at line 145 of file Console.h.
Referenced by Console(), handleKey(), and tabCompleteForward().
bool random_racer::Console::m_lastTabWasForward [private] |
For remembering in which direction we did the last tab to compensate inconsistencies.
Definition at line 151 of file Console.h.
Referenced by tabCompleteForward().
VRS::NonPersistentDictionary<std::string, VRS::SO<VRS::CallbackBase> > random_racer::Console::m_registry [private] |
Holds the callback objects and the matching command strings.
Definition at line 157 of file Console.h.
Referenced by dispatchCommand(), registerCommand(), tabCompleteForward(), and unregisterCommand().
const unsigned int random_racer::Console::c_animationDuration [static, private] |
double random_racer::Console::m_animationDistance [private] |
Used to remember the distance the animation has to take in a hide so that we know when it is finished.
Definition at line 170 of file Console.h.
Referenced by hide(), show(), and timerTick().
double random_racer::Console::m_distancePerTick [private] |
This is the distance we want to do every 1ms, gets calculated when you start a animation.
Definition at line 176 of file Console.h.
Referenced by hide(), show(), and timerTick().
unsigned int random_racer::Console::m_lastTick [private] |
This is to remember when the last tick was so we know how much time elapsed.
Definition at line 182 of file Console.h.
Referenced by startAnimation(), and timerTick().
bool random_racer::Console::m_animationInProgress [private] |
True if a animation is in progress, so you cannot start 2x show, etc.
Definition at line 187 of file Console.h.
Referenced by Console(), hide(), isVisible(), show(), startAnimation(), and timerTick().
VRS::SO<VRS::Translation> random_racer::Console::m_translation [private] |
The translation we modify when moving the console up or down.
Definition at line 197 of file Console.h.
Referenced by Console(), show(), and timerTick().
SO< Console > random_racer::Console::s_instance [static, private] |
1.5.1