#include <console.h>
Inheritance diagram for KrConsole::
Public Methods | |
KrConsole (int width, int height, int lineSpacing, const KrScheme &scheme) | |
The font resource to use is passed in, as well as the size of the console box. More... | |
void | SetBackgroundColor (const KrRGBA &color) |
Set a background color Only works after the KrConsole has been added to the Tree. | |
virtual bool | KeyEvent (const SDL_Event &key) |
Set a background box: same options and flags as KrBoxResource. More... | |
void | PushText (const char *text) |
Prints out a null termintated text string. | |
void | Print (const char *format,...) |
Prints using "printf" format. Will handle newlines. | |
void | GetEntryTextChar (std::string *buffer) |
Get the current text in the command line. | |
void | AddCommand (const std::string &, IKrWidgetListener *handler) |
Adds a command to the list of recognized (and auto-completed) commands. More... | |
KrImNode * | ToExtended (const std::string &name) |
A generic cast. More... | |
virtual bool | HandleWidgetEvent (KrWidget *source, U32 event, U32 data, const SDL_Event *sdlEvent, const char *command, const char *arg) |
Handle SDL events, return true if handled, false if not ours. |
Emulates a simple command console, with one line text editing, history buffer, and command completion.
Needs SDL_EnableUNICODE( true ) to function correctly.
Events Sent
|
The font resource to use is passed in, as well as the size of the console box. The lineSpacing can be used to give additional space between lines. The normal behavior is zero. WARNING: The font is in the scheme, and must be set. |
|
Adds a command to the list of recognized (and auto-completed) commands. This will add handler as a listerner if it is not already. |
|
Set a background box: same options and flags as KrBoxResource. Only works after the KrConsole has been added to the Tree. Reimplemented from KrWidget. |
|
A generic cast. The Kyra library is not as extensible as it could be; this implements a "cheap RTTI" if you add your own sub-classes. Arbitrary casting to any type in the string. For example, MyClassType* myType = (MyClassType*) node->ToExtended( "MyClassType" ); Reimplemented from KrImNode. |