comparison engine/core/gui/console/console.cpp @ 684:4f36c890b1dd

* Merged the 0.3.3dev branche changes to the trunk.
author helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
date Mon, 06 Dec 2010 19:25:27 +0000
parents 16c2b3ee59ce
children
comparison
equal deleted inserted replaced
683:4fe9747d5f88 684:4f36c890b1dd
45 45
46 namespace FIFE { 46 namespace FIFE {
47 const unsigned Console::m_maxOutputRows = 50; 47 const unsigned Console::m_maxOutputRows = 50;
48 static Logger _log(LM_CONSOLE); 48 static Logger _log(LM_CONSOLE);
49 49
50 Console::Console() 50 Console::Console()
51 : gcn::Container(), 51 : gcn::Container(),
52 m_consoleexec(0), 52 m_consoleexec(0),
53 m_input(new CommandLine()), 53 m_input(new CommandLine()),
54 m_output(new gcn::UTF8TextBox()), 54 m_output(new gcn::UTF8TextBox()),
55 m_outputscrollarea(new gcn::ScrollArea(m_output)), 55 m_outputscrollarea(new gcn::ScrollArea(m_output)),
88 } 88 }
89 89
90 void Console::reLayout() { 90 void Console::reLayout() {
91 Image* screen = RenderBackend::instance()->getScreenImage(); 91 Image* screen = RenderBackend::instance()->getScreenImage();
92 assert(screen); 92 assert(screen);
93 93
94 int w, h, b, input_h, bbar_h, button_w; 94 int w, h, b, input_h, bbar_h, button_w;
95 w = screen->getWidth() * 4/5; 95 w = screen->getWidth() * 4/5;
96 h = screen->getHeight() * 4/5; 96 h = screen->getHeight() * 4/5;
97 b = 0; 97 b = 0;
98 input_h = getFont()->getHeight(); 98 input_h = getFont()->getHeight();
99 bbar_h = input_h; 99 bbar_h = input_h;
100 button_w = 80; 100 button_w = 80;
101 101
102 gcn::Color black(0x00,0,0,0xff); 102 gcn::Color black(0x00,0,0,0xff);
103 gcn::Color white(0xff,0xff,0xff,0xff); 103 gcn::Color white(0xff,0xff,0xff,0xff);
104 gcn::Color dark(50,60,50,0xff); 104 gcn::Color dark(50,60,50,0xff);
105 105
106 setSize(w, h); 106 setSize(w, h);
145 m_animationDelta = h/6; 145 m_animationDelta = h/6;
146 } 146 }
147 147
148 Console::~Console() { 148 Console::~Console() {
149 doHide(); 149 doHide();
150 150
151 remove(m_input); 151 remove(m_input);
152 remove(m_outputscrollarea); 152 remove(m_outputscrollarea);
153 remove(m_status); 153 remove(m_status);
154 154
155 delete m_output; 155 delete m_output;
163 std::string caption = "FIFE Console - FPS: "; 163 std::string caption = "FIFE Console - FPS: ";
164 float fps = 1e3/double(TimeManager::instance()->getAverageFrameTime()); 164 float fps = 1e3/double(TimeManager::instance()->getAverageFrameTime());
165 caption += boost::lexical_cast<std::string>(fps); 165 caption += boost::lexical_cast<std::string>(fps);
166 m_status->setCaption( caption ); 166 m_status->setCaption( caption );
167 } 167 }
168 168
169 void Console::updateAnimation() { 169 void Console::updateAnimation() {
170 if (m_hiding){ 170 if (m_hiding){
171 setPosition(getX(), getY() - m_animationDelta); 171 setPosition(getX(), getY() - m_animationDelta);
172 if (getY() <= m_hiddenPos){ 172 if (getY() <= m_hiddenPos){
173 doHide(); 173 doHide();
244 } else { 244 } else {
245 FL_WARN(_log, LMsg("ConsoleExecuter not bind, but command received: ") << cmd.c_str()); 245 FL_WARN(_log, LMsg("ConsoleExecuter not bind, but command received: ") << cmd.c_str());
246 } 246 }
247 } 247 }
248 catch (const FIFE::Exception & e) { 248 catch (const FIFE::Exception & e) {
249 FL_WARN(_log, LMsg("Console caught exception: ") << e.getMessage()); 249 FL_WARN(_log, LMsg("Console caught exception: ") << e.what());
250 println(e.getMessage()); 250 println(e.what());
251 } 251 }
252 } 252 }
253 253
254 void Console::println(const std::string & s) { 254 void Console::println(const std::string & s) {
255 assert(m_output); 255 assert(m_output);