#include <Console.h>
Inheritance diagram for pge::gui::Console:
Public Member Functions | |
Console (int x, int y, int width, int height) | |
Constructor. | |
virtual | ~Console (void) |
Destructor. | |
bool | init (void) |
void | render (void) |
Called when the object should render itself. | |
void | timer (unsigned int delay) |
Called when the timer event comes. | |
void | show (void) |
void | hide (void) |
void | keyTypeCall (int keyCode) |
Private Attributes | |
Vector4f | m_backgroundColor |
int | m_xOff |
int | m_yOff |
int | m_width |
int | m_height |
int | m_aniHeight |
bool | m_animate |
TextBox * | m_output |
TextEdit * | m_input |
|
Constructor.
Definition at line 22 of file Console.cpp. References pge::gui::TextBox::addLine(), m_aniHeight, m_animate, m_backgroundColor, m_height, m_input, m_output, m_width, m_xOff, m_yOff, pge::gui::Component::setBackgroundColor(), pge::gui::TextEdit::setBackgroundEnabled(), and pge::gui::TextBox::setBackgroundEnabled().
00022 { 00023 m_backgroundColor = Vector4f(0.1f, 0.1f, 0.1f, 0.6f); 00024 m_xOff = x; 00025 m_yOff = y; 00026 m_width = width; 00027 m_height = height; 00028 00029 // Console animation 00030 m_aniHeight = 0; 00031 m_animate = false; 00032 00033 // Output textbox 00034 m_output = new TextBox(m_xOff + 10, m_yOff + 10, m_width - 20, m_height - 50); 00035 m_output->setBackgroundColor(Vector4f(0.4f, 0.4f, 0.4f, 0.5f)); 00036 m_output->setBackgroundEnabled(true); 00037 00038 m_output->addLine("Phobosengine version 0.1alpha"); 00039 m_output->addLine("Console system, type help for commands."); 00040 00041 // Input textedit 00042 m_input = new TextEdit(m_xOff + 10, m_yOff + m_height - 30, m_width - 20, 20); 00043 m_input->setBackgroundColor(Vector4f(0.6f, 0.4f, 0.4f, 0.5f)); 00044 m_input->setBackgroundEnabled(true); 00045 00046 } |
Here is the call graph for this function:
|
Destructor.
Definition at line 54 of file Console.cpp.
00054 { 00055 } |
|
Definition at line 129 of file Console.cpp. References m_aniHeight, and m_animate.
00129 { 00130 m_animate = false; 00131 m_aniHeight = 0; 00132 } |
|
Implements pge::IRenderableObject. Definition at line 63 of file Console.cpp.
00063 { 00064 return true; 00065 } |
|
Definition at line 140 of file Console.cpp. References pge::gui::TextBox::addLine(), pge::gui::TextEdit::getText(), m_input, m_output, and pge::gui::TextEdit::setText().
00140 { 00141 // Handle backspace 00142 if(keyCode == 8) { 00143 if(m_input->getText().length() > 0) { 00144 //m_input->setText(m_input->getText().substring(0, m_input.getText().length() - 1)); 00145 } 00146 00147 // Handle return 00148 } else if (keyCode == 10) { 00149 00150 m_output->addLine(">" + m_input->getText()); 00151 // TODO: send text to console system, get result and put it in textbox! 00152 //if(m_input->getText() == "camera") { 00153 //m_output->addLine(std::string(">") + m_input->getText()); 00154 //m_output->addLine("> Camera position: " + CoreEngine::getInstance()->getCurrentWorld()->getCamera()->getPosition()); 00155 //} 00156 m_input->setText(""); 00157 00158 } else { 00159 //m_input->setText(m_input->getText() + KeyCode.getKeyCharAlphaNumeric(keyCode)); 00160 } 00161 } |
Here is the call graph for this function:
|
Called when the object should render itself.
Implements pge::IRenderableObject. Definition at line 73 of file Console.cpp. References m_aniHeight, m_animate, m_backgroundColor, m_input, m_output, m_width, m_xOff, m_yOff, pge::gui::TextEdit::render(), and pge::gui::TextBox::render().
00073 { 00074 renderer::setTextureUnitEnabled(GL_TEXTURE0, false); 00075 renderer::setBlendingEnabled(true); 00076 renderer::setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 00077 00078 renderer::color4f(m_backgroundColor); 00079 glBegin(GL_QUADS); 00080 renderer::vertex2i(m_xOff, CoreEngine::getInstance()->getResolutionHeight() - m_yOff); 00081 renderer::vertex2i(m_yOff, CoreEngine::getInstance()->getResolutionHeight() - m_yOff - m_aniHeight); 00082 renderer::vertex2i(m_width, CoreEngine::getInstance()->getResolutionHeight() - m_yOff - m_aniHeight); 00083 renderer::vertex2i(m_width, CoreEngine::getInstance()->getResolutionHeight() - m_yOff); 00084 glEnd(); 00085 00086 renderer::setBlendingEnabled(false); 00087 00088 if(!m_animate) { 00089 m_output->render(); 00090 m_input->render(); 00091 } 00092 } |
Here is the call graph for this function:
|
Definition at line 119 of file Console.cpp. References m_animate.
00119 { 00120 m_animate = true; 00121 } |
|
Called when the timer event comes.
Implements pge::IRenderableObject. Definition at line 100 of file Console.cpp. References m_aniHeight, m_animate, and m_height.
00100 { 00101 if(m_animate) { 00102 if(m_aniHeight < m_height) { 00103 m_aniHeight += 20; 00104 } else { 00105 // Set to m_height so a possible greater value after the above 00106 // statement is corrected. 00107 m_aniHeight = m_height; 00108 m_animate = false; 00109 } 00110 } 00111 } |
|
|
|
Definition at line 68 of file Console.h. Referenced by Console(), hide(), render(), show(), and timer(). |
|
|
|
|
|
Definition at line 71 of file Console.h. Referenced by Console(), keyTypeCall(), and render(). |
|
Definition at line 70 of file Console.h. Referenced by Console(), keyTypeCall(), and render(). |
|
|
|
|
|
|