summaryrefslogtreecommitdiff
path: root/src/guiChatConsole.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/guiChatConsole.cpp')
-rw-r--r--src/guiChatConsole.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/guiChatConsole.cpp b/src/guiChatConsole.cpp
index 8dd5ab032..5bb80bbbe 100644
--- a/src/guiChatConsole.cpp
+++ b/src/guiChatConsole.cpp
@@ -55,7 +55,7 @@ GUIChatConsole::GUIChatConsole(
m_client(client),
m_menumgr(menumgr),
m_screensize(v2u32(0,0)),
- m_animate_time_old(0),
+ m_animate_time_old(porting::getTimeMs()),
m_open(false),
m_close_on_enter(false),
m_height(0),
@@ -71,8 +71,6 @@ GUIChatConsole::GUIChatConsole(
m_font(NULL),
m_fontsize(0, 0)
{
- m_animate_time_old = getTimeMs();
-
// load background settings
s32 console_alpha = g_settings->getS32("console_alpha");
m_background_color.setAlpha(clamp_u8(console_alpha));
@@ -116,13 +114,15 @@ GUIChatConsole::~GUIChatConsole()
m_font->drop();
}
-void GUIChatConsole::openConsole(f32 height)
+void GUIChatConsole::openConsole(f32 scale)
{
+ assert(scale > 0.0f && scale <= 1.0f);
+
m_open = true;
- m_desired_height_fraction = height;
- m_desired_height = height * m_screensize.Y;
+ m_desired_height_fraction = scale;
+ m_desired_height = scale * m_screensize.Y;
reformatConsole();
- m_animate_time_old = getTimeMs();
+ m_animate_time_old = porting::getTimeMs();
IGUIElement::setVisible(true);
Environment->setFocus(this);
m_menumgr->createdMenu(this);
@@ -210,7 +210,7 @@ void GUIChatConsole::draw()
}
// Animation
- u32 now = getTimeMs();
+ u64 now = porting::getTimeMs();
animate(now - m_animate_time_old);
m_animate_time_old = now;
@@ -627,10 +627,8 @@ bool GUIChatConsole::OnEvent(const SEvent& event)
bool backwards = event.KeyInput.Shift;
prompt.nickCompletion(names, backwards);
return true;
- }
- else if(event.KeyInput.Char != 0 && !event.KeyInput.Control)
- {
- #if (defined(__linux__))
+ } else if (!iswcntrl(event.KeyInput.Char) && !event.KeyInput.Control) {
+ #if defined(__linux__) && (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 9)
wchar_t wc = L'_';
mbtowc( &wc, (char *) &event.KeyInput.Char, sizeof(event.KeyInput.Char) );
prompt.input(wc);