Orxonox: orxonox::InGameConsole Class Reference

# orxonox::InGameConsole Class Reference

`#include <src/orxonox/overlays/console/InGameConsole.h>`

Inheritance diagram for orxonox::InGameConsole:

List of all members.

## Public Member Functions

void | destroy ()
| InGameConsole ()
| Constructor: Creates and initializes the InGameConsole.
void | initialise (int windowWidth, int windowHeight)
| Initializes the InGameConsole.
void | setConfigValues ()
| Sets the config values, describing the size of the console.
void | update (const Clock &time)
| Used to control the actual scrolling and the cursor.
| ~InGameConsole ()
| Destructor: Destroys the TextAreas.

## Static Public Member Functions

static void | closeConsole ()
| Deactivates the console.
static InGameConsole & | getInstance ()
static InGameConsole * | getInstancePtr ()
static void | openConsole ()
| Activates the console.

## Private Member Functions

void | activate ()
| Shows the InGameConsole.
void | bHidesAllInputChanged ()
| Called whenever bHidesAllInput_ changes.
void | colourLine (int colourcode, int index)
void | cursorChanged ()
| Called if the position of the cursor in the input-line has changed.
void | deactivate ()
| Hides the InGameConsole.
void | exit ()
| Called if the console gets closed.
| InGameConsole (const InGameConsole &other)
void | inputChanged ()
| Called if the text in the input-line has changed.
void | lineAdded ()
| Called if a new output-line was added.
void | linesChanged ()
| Called if all output-lines have to be redrawn.
void | onlyLastLineChanged ()
| Called if only the last output-line has changed.
void | print (const std::string &text, int index, bool alwaysShift=false)
| Prints string to bottom line.
void | setCursorPosition (unsigned int pos)
void | shiftLines ()
| Shifts all output lines one line up.
void | windowResized (unsigned int newWidth, unsigned int newHeight)
| Resizes the console elements. Call if window size changes.

## Private Attributes

bool | bActive_
bool | bHidesAllInput_
float | blinkTime
bool | bShowCursor_
Ogre::Overlay * | consoleOverlay_
Ogre::BorderPanelOverlayElement * | consoleOverlayBorder_
Ogre::OverlayContainer * | consoleOverlayContainer_
Ogre::TextAreaOverlayElement * | consoleOverlayCursor_
Ogre::PanelOverlayElement * | consoleOverlayNoise_
Ogre::TextAreaOverlayElement ** | consoleOverlayTextAreas_
float | cursor_
char | cursorSymbol_
int | desiredTextWidth_
std::string | displayedText_
SimpleInputState * | inputState_
unsigned int | inputWindowStart_
unsigned int | maxCharsPerLine_
float | noiseSize_
unsigned int | numLinesShifted_
float | relativeHeight
float | relativeWidth
int | scroll_
float | scrollSpeed_
int | windowH_
int | windowW_

## Static Private Attributes

static InGameConsole * | singletonRef_s = 0

## Constructor & Destructor Documentation

orxonox::InGameConsole::InGameConsole | ( |  | ) |

Constructor: Creates and initializes the InGameConsole.

References bActive_, cursor_, cursorSymbol_, inputWindowStart_, orxonox::LINES, numLinesShifted_, RegisterObject, scroll_, setConfigValues(), and singletonRef_s.

orxonox::InGameConsole::~InGameConsole | ( |  | ) |

Destructor: Destroys the TextAreas.

References consoleOverlay_, consoleOverlayBorder_, consoleOverlayContainer_, consoleOverlayCursor_, consoleOverlayNoise_, consoleOverlayTextAreas_, deactivate(), orxonox::InputManager::getInstance(), orxonox::LINES, orxonox::InputManager::requestDestroyState(), and singletonRef_s.

orxonox::InGameConsole::InGameConsole | ( | const InGameConsole & | other | ) | `[private]`

## Member Function Documentation

void orxonox::InGameConsole::activate | ( |  | ) | `[private]`

Shows the InGameConsole.

References bActive_, consoleOverlay_, cursorChanged(), orxonox::Shell::getInstance(), orxonox::InputManager::getInstance(), linesChanged(), orxonox::Shell::registerListener(), orxonox::InputManager::requestEnterState(), scroll_, windowH_, windowResized(), and windowW_.

Referenced by openConsole().

void orxonox::InGameConsole::bHidesAllInputChanged | ( |  | ) | `[private]`

Called whenever bHidesAllInput_ changes.

References bHidesAllInput_, orxonox::InputManager::EMPTY_HANDLER, inputState_, orxonox::SimpleInputState::setJoyStickHandler(), and orxonox::SimpleInputState::setMouseHandler().

Referenced by initialise(), and setConfigValues().

void orxonox::InGameConsole::closeConsole | ( |  | ) | `[static]`

Deactivates the console.

References deactivate(), and getInstance().

void orxonox::InGameConsole::colourLine | ( | int | colourcode,
|  | int | index |
| ) |  |  | `[private]`

References orxonox::MT_Type::ColourValue, and consoleOverlayTextAreas_.

Referenced by print().

void orxonox::InGameConsole::cursorChanged | ( |  | ) | `[private, virtual]`

Called if the position of the cursor in the input-line has changed.

Reimplemented from orxonox::ShellListener.

References consoleOverlayCursor_, cursorSymbol_, orxonox::Shell::getCursorPosition(), orxonox::Shell::getInstance(), inputWindowStart_, maxCharsPerLine_, relativeHeight, and windowH_.

Referenced by activate(), and windowResized().

void orxonox::InGameConsole::deactivate | ( |  | ) | `[private]`

Hides the InGameConsole.

References bActive_, orxonox::Shell::getInstance(), orxonox::InputManager::getInstance(), orxonox::InputManager::requestLeaveState(), scroll_, and orxonox::Shell::unregisterListener().

Referenced by closeConsole(), exit(), and ~InGameConsole().

void orxonox::InGameConsole::destroy | ( |  | ) |

void orxonox::InGameConsole::exit | ( |  | ) | `[private, virtual]`

Called if the console gets closed.

Reimplemented from orxonox::ShellListener.

References deactivate().

static InGameConsole& orxonox::InGameConsole::getInstance | ( |  | ) | `[inline, static]`

Referenced by closeConsole(), and openConsole().

static InGameConsole* orxonox::InGameConsole::getInstancePtr | ( |  | ) | `[inline, static]`

void orxonox::InGameConsole::initialise | ( | int | windowWidth,
|  | int | windowHeight |
| ) |  |  |

Initializes the InGameConsole.

References orxonox::Shell::addOutputLevel(), bHidesAllInputChanged(), orxonox::InputStatePriority::Console, consoleOverlay_, consoleOverlayBorder_, consoleOverlayContainer_, consoleOverlayCursor_, consoleOverlayNoise_, consoleOverlayTextAreas_, COUT, orxonox::InputManager::createInputState(), cursorSymbol_, orxonox::Shell::getInstance(), orxonox::InputManager::getInstance(), inputState_, orxonox::LINES, relativeHeight, relativeWidth, orxonox::SimpleInputState::setKeyHandler(), and windowResized().

Referenced by orxonox::GSGraphics::activate().

void orxonox::InGameConsole::inputChanged | ( |  | ) | `[private, virtual]`

Called if the text in the input-line has changed.

Reimplemented from orxonox::ShellListener.

References orxonox::Shell::getInstance(), inputWindowStart_, orxonox::LINES, and print().

void orxonox::InGameConsole::lineAdded | ( |  | ) | `[private, virtual]`

Called if a new output-line was added.

Reimplemented from orxonox::ShellListener.

References numLinesShifted_, onlyLastLineChanged(), and shiftLines().

void orxonox::InGameConsole::linesChanged | ( |  | ) | `[private, virtual]`

Called if all output-lines have to be redrawn.

Reimplemented from orxonox::ShellListener.

References orxonox::Shell::getInstance(), orxonox::Shell::getNewestLineIterator(), orxonox::LINES, and print().

Referenced by activate(), and windowResized().

void orxonox::InGameConsole::onlyLastLineChanged | ( |  | ) | `[private, virtual]`

Called if only the last output-line has changed.

Reimplemented from orxonox::ShellListener.

References orxonox::Shell::getInstance(), orxonox::LINES, and print().

Referenced by lineAdded().

void orxonox::InGameConsole::openConsole | ( |  | ) | `[static]`

Activates the console.

References activate(), and getInstance().

void orxonox::InGameConsole::print | ( | const std::string & | text,
|  | int | index,
|  | bool | alwaysShift = `false` |
| ) |  |  | `[private]`

Prints string to bottom line.

Parameters:

  | s | String to be printed

References colourLine(), consoleOverlayTextAreas_, displayedText_, orxonox::InputBuffer::getCursorPosition(), orxonox::Shell::getInputBuffer(), orxonox::Shell::getInstance(), inputWindowStart_, orxonox::LINES, maxCharsPerLine_, numLinesShifted_, and shiftLines().

Referenced by inputChanged(), linesChanged(), and onlyLastLineChanged().

void orxonox::InGameConsole::setConfigValues | ( |  | ) |

Sets the config values, describing the size of the console.

Reimplemented from orxonox::OrxonoxClass.

References bHidesAllInput_, bHidesAllInputChanged(), blinkTime, cursorSymbol_, noiseSize_, relativeHeight, relativeWidth, scrollSpeed_, and SetConfigValue.

Referenced by InGameConsole().

void orxonox::InGameConsole::setCursorPosition | ( | unsigned int | pos | ) | `[private]`

void orxonox::InGameConsole::shiftLines | ( |  | ) | `[private]`

Shifts all output lines one line up.

References consoleOverlayTextAreas_, and orxonox::LINES.

Referenced by lineAdded(), and print().

void orxonox::InGameConsole::update | ( | const Clock & | time | ) |

Used to control the actual scrolling and the cursor.

References bActive_, blinkTime, bShowCursor_, consoleOverlay_, consoleOverlayContainer_, consoleOverlayCursor_, consoleOverlayNoise_, cursor_, orxonox::Clock::getDeltaTime(), relativeHeight, scroll_, and scrollSpeed_.

Referenced by orxonox::GSGraphics::update().

void orxonox::InGameConsole::windowResized | ( | unsigned int | newWidth,
|  | unsigned int | newHeight |
| ) |  |  | `[private, virtual]`

Resizes the console elements. Call if window size changes.

Reimplemented from orxonox::WindowEventListener.

References orxonox::CHAR_WIDTH, consoleOverlayBorder_, consoleOverlayNoise_, consoleOverlayTextAreas_, cursorChanged(), desiredTextWidth_, orxonox::LINES, linesChanged(), maxCharsPerLine_, noiseSize_, relativeHeight, relativeWidth, orxonox::KeyCode::U, windowH_, and windowW_.

Referenced by activate(), and initialise().

## Member Data Documentation

bool orxonox::InGameConsole::bActive_`[private]`

Referenced by activate(), deactivate(), InGameConsole(), and update().

bool orxonox::InGameConsole::bHidesAllInput_`[private]`

Referenced by bHidesAllInputChanged(), and setConfigValues().

float orxonox::InGameConsole::blinkTime`[private]`

Referenced by setConfigValues(), and update().

bool orxonox::InGameConsole::bShowCursor_`[private]`

Referenced by update().

Ogre::Overlay* orxonox::InGameConsole::consoleOverlay_`[private]`

Referenced by activate(), initialise(), update(), and ~InGameConsole().

Ogre::BorderPanelOverlayElement* orxonox::InGameConsole::consoleOverlayBorder_`[private]`

Referenced by initialise(), windowResized(), and ~InGameConsole().

Ogre::OverlayContainer* orxonox::InGameConsole::consoleOverlayContainer_`[private]`

Referenced by initialise(), update(), and ~InGameConsole().

Ogre::TextAreaOverlayElement* orxonox::InGameConsole::consoleOverlayCursor_`[private]`

Referenced by cursorChanged(), initialise(), update(), and ~InGameConsole().

Ogre::PanelOverlayElement* orxonox::InGameConsole::consoleOverlayNoise_`[private]`

Referenced by initialise(), update(), windowResized(), and ~InGameConsole().

Ogre::TextAreaOverlayElement** orxonox::InGameConsole::consoleOverlayTextAreas_`[private]`

Referenced by colourLine(), initialise(), print(), shiftLines(), windowResized(), and ~InGameConsole().

float orxonox::InGameConsole::cursor_`[private]`

Referenced by InGameConsole(), and update().

char orxonox::InGameConsole::cursorSymbol_`[private]`

Referenced by cursorChanged(), InGameConsole(), initialise(), and setConfigValues().

int orxonox::InGameConsole::desiredTextWidth_`[private]`

Referenced by windowResized().

std::string orxonox::InGameConsole::displayedText_`[private]`

Referenced by print().

SimpleInputState* orxonox::InGameConsole::inputState_`[private]`

Referenced by bHidesAllInputChanged(), and initialise().

unsigned int orxonox::InGameConsole::inputWindowStart_`[private]`

Referenced by cursorChanged(), InGameConsole(), inputChanged(), and print().

unsigned int orxonox::InGameConsole::maxCharsPerLine_`[private]`

Referenced by cursorChanged(), print(), and windowResized().

float orxonox::InGameConsole::noiseSize_`[private]`

Referenced by setConfigValues(), and windowResized().

unsigned int orxonox::InGameConsole::numLinesShifted_`[private]`

Referenced by InGameConsole(), lineAdded(), and print().

float orxonox::InGameConsole::relativeHeight`[private]`

Referenced by cursorChanged(), initialise(), setConfigValues(), update(), and windowResized().

float orxonox::InGameConsole::relativeWidth`[private]`

Referenced by initialise(), setConfigValues(), and windowResized().

int orxonox::InGameConsole::scroll_`[private]`

Referenced by activate(), deactivate(), InGameConsole(), and update().

float orxonox::InGameConsole::scrollSpeed_`[private]`

Referenced by setConfigValues(), and update().

InGameConsole * orxonox::InGameConsole::singletonRef_s = 0`[static, private]`

Referenced by InGameConsole(), and ~InGameConsole().

int orxonox::InGameConsole::windowH_`[private]`

Referenced by activate(), cursorChanged(), and windowResized().

int orxonox::InGameConsole::windowW_`[private]`

Referenced by activate(), and windowResized().

The documentation for this class was generated from the following files:

- src/orxonox/overlays/console/InGameConsole.h
- src/orxonox/overlays/console/InGameConsole.cc