FIFE  6e1afdbeda11afe9ac53e6023a4be96ef88f1dc6
FIFE::Console Class Reference

Ingame Console. More...

#include <console.h>

Inherits Container, ActionListener, and FocusListener.

+ Collaboration diagram for FIFE::Console:

Public Member Functions

 Console ()
 Constructor. More...
 
virtual ~Console ()
 Destructor. More...
 
void println (const std::string &s)
 Print one or more lines to the console output. More...
 
void show ()
 Show the console Adds the Console to the fifechan toplevel container and pushes an input Context so that keys are not send to the rest of the game. More...
 
void hide ()
 Hide the console Removes itself from the toplevel container and pops it's input context. More...
 
void clear ()
 Clear the console output. More...
 
void toggleShowHide ()
 Toggle the console Toggles whether the Console is shown or not. More...
 
void execute (std::string cmd)
 Execute a command Normally just sends the command to runString() Checks whether the cmd is just one token and print it's value rather than throw an useless error. More...
 
void updateCaption ()
 Update the FPS caption. More...
 
void updateAnimation ()
 Update the scroll in/out animation. More...
 
void action (const fcn::ActionEvent &event)
 Callback from fifechan to respond to button press. More...
 
void setConsoleExecuter (ConsoleExecuter *const consoleexec)
 Sets executer for the console. More...
 
void removeConsoleExecuter ()
 Removes executer for the console. More...
 
void reLayout ()
 Layouts the console to match e.g. More...
 
void setIOFont (GuiFont *font)
 Sets the font used for the input and output areas. More...
 
void focusLost (const fcn::Event &event)
 Hide if we loose focus. More...
 

Private Member Functions

void doShow ()
 
void doHide ()
 

Private Attributes

bool m_isAttached
 
ConsoleExecuterm_consoleexec
 
CommandLinem_input
 
fcn::TextBox * m_output
 
fcn::ScrollArea * m_outputscrollarea
 
fcn::Label * m_status
 
fcn::Button * m_toolsbutton
 
std::string m_prompt
 
int32_t m_hiddenPos
 
int32_t m_animationDelta
 
bool m_hiding
 
Timer m_fpsTimer
 
Timer m_animationTimer
 

Static Private Attributes

static const unsigned m_maxOutputRows = 50
 

Detailed Description

Ingame Console.

Definition at line 64 of file console.h.

Constructor & Destructor Documentation

FIFE::Console::~Console ( )
virtual

Destructor.

Definition at line 143 of file console.cpp.

References doHide(), m_input, m_output, m_outputscrollarea, m_status, and m_toolsbutton.

Member Function Documentation

void FIFE::Console::action ( const fcn::ActionEvent &  event)

Callback from fifechan to respond to button press.

Definition at line 279 of file console.cpp.

References FIFE::_log, FL_WARN, m_consoleexec, and FIFE::ConsoleExecuter::onToolsClick().

void FIFE::Console::clear ( )

Clear the console output.

Definition at line 180 of file console.cpp.

References m_output.

void FIFE::Console::doHide ( )
private

Definition at line 196 of file console.cpp.

References FIFE::DynamicSingleton< FifechanManager >::instance(), m_fpsTimer, m_isAttached, FIFE::FifechanManager::remove(), and FIFE::Timer::stop().

Referenced by updateAnimation(), and ~Console().

+ Here is the caller graph for this function:

void FIFE::Console::doShow ( )
private
void FIFE::Console::execute ( std::string  cmd)

Execute a command Normally just sends the command to runString() Checks whether the cmd is just one token and print it's value rather than throw an useless error.

Definition at line 226 of file console.cpp.

References FIFE::_log, FL_DBG, FL_WARN, m_consoleexec, m_prompt, FIFE::ConsoleExecuter::onConsoleCommand(), println(), and FIFE::Exception::what().

Referenced by Console().

+ Here is the caller graph for this function:

void FIFE::Console::focusLost ( const fcn::Event &  event)

Hide if we loose focus.

Definition at line 300 of file console.cpp.

References hide().

void FIFE::Console::hide ( )

Hide the console Removes itself from the toplevel container and pops it's input context.

Definition at line 212 of file console.cpp.

References m_animationTimer, m_hiding, and FIFE::Timer::start().

Referenced by focusLost().

+ Here is the caller graph for this function:

void FIFE::Console::println ( const std::string &  s)

Print one or more lines to the console output.

Definition at line 249 of file console.cpp.

References m_maxOutputRows, m_output, and m_outputscrollarea.

Referenced by execute().

+ Here is the caller graph for this function:

void FIFE::Console::reLayout ( )
void FIFE::Console::removeConsoleExecuter ( )

Removes executer for the console.

Definition at line 291 of file console.cpp.

References m_consoleexec.

void FIFE::Console::setConsoleExecuter ( ConsoleExecuter *const  consoleexec)

Sets executer for the console.

Definition at line 287 of file console.cpp.

References m_consoleexec.

void FIFE::Console::setIOFont ( GuiFont font)

Sets the font used for the input and output areas.

Definition at line 295 of file console.cpp.

References m_input, and m_output.

Referenced by Console().

+ Here is the caller graph for this function:

void FIFE::Console::show ( )

Show the console Adds the Console to the fifechan toplevel container and pushes an input Context so that keys are not send to the rest of the game.

Definition at line 204 of file console.cpp.

References doShow(), m_animationTimer, m_hiding, and FIFE::Timer::start().

void FIFE::Console::toggleShowHide ( )

Toggle the console Toggles whether the Console is shown or not.

Calls show() or hide() respectively.

Definition at line 219 of file console.cpp.

References doShow(), m_animationTimer, m_hiding, and FIFE::Timer::start().

void FIFE::Console::updateAnimation ( )

Update the scroll in/out animation.

Note
Is a timer callback.

Definition at line 164 of file console.cpp.

References doHide(), m_animationDelta, m_animationTimer, m_hiddenPos, m_hiding, and FIFE::Timer::stop().

Referenced by Console().

+ Here is the caller graph for this function:

void FIFE::Console::updateCaption ( )

Update the FPS caption.

Note
Is a timer callback.

Definition at line 157 of file console.cpp.

References FIFE::TimeManager::getAverageFrameTime(), FIFE::DynamicSingleton< TimeManager >::instance(), and m_status.

Referenced by Console().

+ Here is the caller graph for this function:

Member Data Documentation

int32_t FIFE::Console::m_animationDelta
private

Definition at line 159 of file console.h.

Referenced by reLayout(), and updateAnimation().

Timer FIFE::Console::m_animationTimer
private

Definition at line 164 of file console.h.

Referenced by Console(), hide(), show(), toggleShowHide(), and updateAnimation().

ConsoleExecuter* FIFE::Console::m_consoleexec
private

Definition at line 147 of file console.h.

Referenced by action(), execute(), removeConsoleExecuter(), and setConsoleExecuter().

Timer FIFE::Console::m_fpsTimer
private

Definition at line 163 of file console.h.

Referenced by Console(), doHide(), and doShow().

int32_t FIFE::Console::m_hiddenPos
private

Definition at line 158 of file console.h.

Referenced by reLayout(), and updateAnimation().

bool FIFE::Console::m_hiding
private

Definition at line 161 of file console.h.

Referenced by Console(), hide(), show(), toggleShowHide(), and updateAnimation().

CommandLine* FIFE::Console::m_input
private

Definition at line 149 of file console.h.

Referenced by Console(), doShow(), reLayout(), setIOFont(), and ~Console().

bool FIFE::Console::m_isAttached
private

Definition at line 146 of file console.h.

Referenced by Console(), doHide(), and doShow().

const unsigned FIFE::Console::m_maxOutputRows = 50
staticprivate

Definition at line 154 of file console.h.

Referenced by println().

fcn::TextBox* FIFE::Console::m_output
private

Definition at line 150 of file console.h.

Referenced by clear(), println(), reLayout(), setIOFont(), and ~Console().

fcn::ScrollArea* FIFE::Console::m_outputscrollarea
private

Definition at line 151 of file console.h.

Referenced by Console(), println(), reLayout(), and ~Console().

std::string FIFE::Console::m_prompt
private

Definition at line 156 of file console.h.

Referenced by Console(), and execute().

fcn::Label* FIFE::Console::m_status
private

Definition at line 152 of file console.h.

Referenced by Console(), reLayout(), updateCaption(), and ~Console().

fcn::Button* FIFE::Console::m_toolsbutton
private

Definition at line 153 of file console.h.

Referenced by Console(), reLayout(), and ~Console().


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