FIFE
be64c707dea6b3250bd4355bf5c825d25920087d
|
#include <console.h>
Inherits Container, ActionListener, and FocusListener.
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 |
ConsoleExecuter * | m_consoleexec |
CommandLine * | m_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 |
FIFE::Console::Console | ( | ) |
Constructor.
Definition at line 46 of file console.cpp.
References FIFE::FifechanManager::createFont(), execute(), FIFE::DynamicSingleton< FifechanManager >::instance(), m_animationTimer, m_fpsTimer, m_hiding, m_input, m_isAttached, m_outputscrollarea, m_prompt, m_status, m_toolsbutton, reLayout(), FIFE::CommandLine::setCallback(), FIFE::Timer::setCallback(), FIFE::GuiFont::setColor(), FIFE::Timer::setInterval(), setIOFont(), updateAnimation(), and updateCaption().
|
virtual |
Destructor.
Definition at line 141 of file console.cpp.
References doHide(), m_input, m_output, m_outputscrollarea, m_status, and m_toolsbutton.
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().
void FIFE::Console::clear | ( | ) |
|
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().
|
private |
Definition at line 182 of file console.cpp.
References FIFE::FifechanManager::add(), FIFE::FifechanManager::getTopContainer(), FIFE::DynamicSingleton< FifechanManager >::instance(), m_fpsTimer, m_input, m_isAttached, and FIFE::Timer::start().
Referenced by show(), and toggleShowHide().
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().
void FIFE::Console::focusLost | ( | const fcn::Event & | event | ) |
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().
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().
void FIFE::Console::reLayout | ( | ) |
Layouts the console to match e.g.
font changes
Definition at line 86 of file console.cpp.
References FIFE::RenderBackend::getScreenHeight(), FIFE::RenderBackend::getScreenWidth(), FIFE::DynamicSingleton< RenderBackend >::instance(), m_animationDelta, m_hiddenPos, m_input, m_output, m_outputscrollarea, m_status, and m_toolsbutton.
Referenced by Console(), FIFE::FifechanManager::resizeTopContainer(), and FIFE::FifechanManager::setDefaultFont().
void FIFE::Console::removeConsoleExecuter | ( | ) |
Removes executer for the console.
Definition at line 289 of file console.cpp.
References m_consoleexec.
void FIFE::Console::setConsoleExecuter | ( | ConsoleExecuter *const | consoleexec | ) |
Sets executer for the console.
Definition at line 285 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 293 of file console.cpp.
References m_input, and m_output.
Referenced by Console().
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().
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().
void FIFE::Console::updateAnimation | ( | ) |
Update the scroll in/out animation.
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().
void FIFE::Console::updateCaption | ( | ) |
Update the FPS caption.
Definition at line 155 of file console.cpp.
References FIFE::TimeManager::getAverageFrameTime(), FIFE::DynamicSingleton< TimeManager >::instance(), and m_status.
Referenced by Console().
|
private |
Definition at line 159 of file console.h.
Referenced by reLayout(), and updateAnimation().
|
private |
Definition at line 164 of file console.h.
Referenced by Console(), hide(), show(), toggleShowHide(), and updateAnimation().
|
private |
Definition at line 147 of file console.h.
Referenced by action(), execute(), removeConsoleExecuter(), and setConsoleExecuter().
|
private |
|
private |
Definition at line 158 of file console.h.
Referenced by reLayout(), and updateAnimation().
|
private |
Definition at line 161 of file console.h.
Referenced by Console(), hide(), show(), toggleShowHide(), and updateAnimation().
|
private |
Definition at line 149 of file console.h.
Referenced by Console(), doShow(), reLayout(), setIOFont(), and ~Console().
|
private |
|
staticprivate |
|
private |
Definition at line 150 of file console.h.
Referenced by clear(), println(), reLayout(), setIOFont(), and ~Console().
|
private |
Definition at line 151 of file console.h.
Referenced by Console(), println(), reLayout(), and ~Console().
|
private |
|
private |
Definition at line 152 of file console.h.
Referenced by Console(), reLayout(), updateCaption(), and ~Console().
|
private |
Definition at line 153 of file console.h.
Referenced by Console(), reLayout(), and ~Console().