Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

KeyConsole Class Reference

Inheritance diagram for KeyConsole:

Inheritance graph
[legend]
Collaboration diagram for KeyConsole:

Collaboration graph
[legend]

Detailed Description

Debug console.

Definition at line 16 of file KeyConsole.h.

Public Member Functions

 KeyConsole ()
 Console starts as deactivated.
virtual ~KeyConsole ()
virtual const char * getName () const
virtual bool allowBg () const
void setInput (const std::string &input)
std::string getInput () const
bool sendCommand ()
 Send console input to scriptAgent.
virtual void drawOn (SDL_Surface *screen)
 Draw console.

Protected Member Functions

virtual void own_initState ()
virtual void own_updateState ()
virtual void own_pauseState ()
virtual void own_resumeState ()
virtual void own_cleanState ()


Constructor & Destructor Documentation

KeyConsole::KeyConsole  ) 
 

Console starts as deactivated.

Definition at line 25 of file KeyConsole.cpp.

00026 :  m_color(0, 200, 0)
00027 {
00028     m_font = new Font(Path::dataReadPath("font/font_console.ttf"), 16);
00029     takeHandler(new ConsoleInput(this));
00030     registerDrawable(this);
00031 }

KeyConsole::~KeyConsole  )  [virtual]
 

Definition at line 33 of file KeyConsole.cpp.

00034 {
00035     delete m_font;
00036 }


Member Function Documentation

virtual bool KeyConsole::allowBg  )  const [inline, virtual]
 

Reimplemented from GameState.

Definition at line 31 of file KeyConsole.h.

00031 { return true; }

void KeyConsole::drawOn SDL_Surface *  screen  )  [virtual]
 

Draw console.

Implements Drawable.

Definition at line 63 of file KeyConsole.cpp.

00064 {
00065     SDL_Rect rect;
00066     rect.x = 10;
00067     rect.y = 10;
00068 
00069     SDL_Surface *surface = m_font->renderText("console] " + m_input, m_color);
00070     SDL_BlitSurface(surface, NULL, screen, &rect);
00071     SDL_FreeSurface(surface);
00072 }

std::string KeyConsole::getInput  )  const [inline]
 

Definition at line 34 of file KeyConsole.h.

00034 { return m_input; }

virtual const char* KeyConsole::getName  )  const [inline, virtual]
 

Implements INamed.

Definition at line 30 of file KeyConsole.h.

00030 { return "state_console"; };

virtual void KeyConsole::own_cleanState  )  [inline, protected, virtual]
 

Implements GameState.

Definition at line 26 of file KeyConsole.h.

00026 {};

virtual void KeyConsole::own_initState  )  [inline, protected, virtual]
 

Implements GameState.

Definition at line 22 of file KeyConsole.h.

00022 {};

virtual void KeyConsole::own_pauseState  )  [inline, protected, virtual]
 

Implements GameState.

Definition at line 24 of file KeyConsole.h.

00024 {};

virtual void KeyConsole::own_resumeState  )  [inline, protected, virtual]
 

Implements GameState.

Definition at line 25 of file KeyConsole.h.

00025 {};

virtual void KeyConsole::own_updateState  )  [inline, protected, virtual]
 

Implements GameState.

Definition at line 23 of file KeyConsole.h.

00023 {};

bool KeyConsole::sendCommand  ) 
 

Send console input to scriptAgent.

NOTE: debug script fail is not critical

Returns:
true for success

Definition at line 44 of file KeyConsole.cpp.

00045 {
00046     bool result = false;
00047     try {
00048         StringMsg *msg = new StringMsg(Name::SCRIPT_NAME,
00049                 "dostring", m_input);
00050         MessagerAgent::agent()->forwardNewMsg(msg);
00051         result = true;
00052     }
00053     catch (BaseException &e) {
00054         LOG_WARNING(e.info());
00055     }
00056     return result;
00057 }

void KeyConsole::setInput const std::string &  input  )  [inline]
 

Definition at line 33 of file KeyConsole.h.

00033 { m_input = input; }


The documentation for this class was generated from the following files:
Generated on Wed Jun 1 09:55:30 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2