FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
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

◆ Console()

◆ ~Console()

FIFE::Console::~Console ( )
virtual

Destructor.

Definition at line 141 of file console.cpp.

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

Member Function Documentation

◆ action()

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

Callback from fifechan to respond to button press.

Definition at line 277 of file console.cpp.

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

◆ clear()

void FIFE::Console::clear ( )

Clear the console output.

Definition at line 178 of file console.cpp.

References m_output.

◆ doHide()

void FIFE::Console::doHide ( )
private

Definition at line 194 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:

◆ doShow()

void FIFE::Console::doShow ( )
private

◆ execute()

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 224 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:

◆ focusLost()

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

Hide if we loose focus.

Definition at line 298 of file console.cpp.

References hide().

◆ hide()

void FIFE::Console::hide ( )

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

Definition at line 210 of file console.cpp.

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

Referenced by focusLost().

+ Here is the caller graph for this function:

◆ println()

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

Print one or more lines to the console output.

Definition at line 247 of file console.cpp.

References m_maxOutputRows, m_output, and m_outputscrollarea.

Referenced by execute().

+ Here is the caller graph for this function:

◆ reLayout()

void FIFE::Console::reLayout ( )

◆ removeConsoleExecuter()

void FIFE::Console::removeConsoleExecuter ( )

Removes executer for the console.

Definition at line 289 of file console.cpp.

References m_consoleexec.

◆ setConsoleExecuter()

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

Sets executer for the console.

Definition at line 285 of file console.cpp.

References m_consoleexec.

◆ setIOFont()

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

Sets the font used for the input and output areas.

Definition at line 293 of file console.cpp.

References m_input, and m_output.

Referenced by Console().

+ Here is the caller graph for this function:

◆ show()

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 202 of file console.cpp.

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

◆ toggleShowHide()

void FIFE::Console::toggleShowHide ( )

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

Calls show() or hide() respectively.

Definition at line 217 of file console.cpp.

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

◆ updateAnimation()

void FIFE::Console::updateAnimation ( )

Update the scroll in/out animation.

Note
Is a timer callback.

Definition at line 162 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:

◆ updateCaption()

void FIFE::Console::updateCaption ( )

Update the FPS caption.

Note
Is a timer callback.

Definition at line 155 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

◆ m_animationDelta

int32_t FIFE::Console::m_animationDelta
private

Definition at line 159 of file console.h.

Referenced by reLayout(), and updateAnimation().

◆ m_animationTimer

Timer FIFE::Console::m_animationTimer
private

Definition at line 164 of file console.h.

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

◆ m_consoleexec

ConsoleExecuter* FIFE::Console::m_consoleexec
private

Definition at line 147 of file console.h.

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

◆ m_fpsTimer

Timer FIFE::Console::m_fpsTimer
private

Definition at line 163 of file console.h.

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

◆ m_hiddenPos

int32_t FIFE::Console::m_hiddenPos
private

Definition at line 158 of file console.h.

Referenced by reLayout(), and updateAnimation().

◆ m_hiding

bool FIFE::Console::m_hiding
private

Definition at line 161 of file console.h.

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

◆ m_input

CommandLine* FIFE::Console::m_input
private

Definition at line 149 of file console.h.

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

◆ m_isAttached

bool FIFE::Console::m_isAttached
private

Definition at line 146 of file console.h.

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

◆ m_maxOutputRows

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

Definition at line 154 of file console.h.

Referenced by println().

◆ m_output

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

Definition at line 150 of file console.h.

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

◆ m_outputscrollarea

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

Definition at line 151 of file console.h.

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

◆ m_prompt

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

Definition at line 156 of file console.h.

Referenced by Console(), and execute().

◆ m_status

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

Definition at line 152 of file console.h.

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

◆ m_toolsbutton

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: