From 084cdea6862cb65fe4bb807a211a9e1c17cffec8 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sat, 24 Dec 2016 14:26:03 +0100 Subject: Irrlicht 1.9 support --- src/guiChatConsole.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/guiChatConsole.cpp') diff --git a/src/guiChatConsole.cpp b/src/guiChatConsole.cpp index 8dd5ab032..867576175 100644 --- a/src/guiChatConsole.cpp +++ b/src/guiChatConsole.cpp @@ -630,7 +630,7 @@ bool GUIChatConsole::OnEvent(const SEvent& event) } else if(event.KeyInput.Char != 0 && !event.KeyInput.Control) { - #if (defined(__linux__)) + #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); -- cgit v1.2.3 From 707e27b5c26b6c082abbd2f385a976c5bc8964fe Mon Sep 17 00:00:00 2001 From: Zeno- Date: Sun, 29 Jan 2017 19:26:00 +1000 Subject: Rename height to scale for openConsole() (#5139) For Game::openConsole() and GUIChatConsole::openConsole() the parameter name 'height' is misleading because it's actually a percentage of the screen/window height. --- src/guiChatConsole.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/guiChatConsole.cpp') diff --git a/src/guiChatConsole.cpp b/src/guiChatConsole.cpp index 867576175..bea5571f4 100644 --- a/src/guiChatConsole.cpp +++ b/src/guiChatConsole.cpp @@ -116,11 +116,13 @@ 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(); IGUIElement::setVisible(true); -- cgit v1.2.3 From b662a4577d692329b9ca83525e6039f2ddcd1ac1 Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Sun, 6 Mar 2016 14:31:16 -0500 Subject: Clean up getTime helpers This increases size of the getTime return values to 64 bits. It also removes the TimeGetter classes since the getTime functions are now very precise. --- src/guiChatConsole.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/guiChatConsole.cpp') diff --git a/src/guiChatConsole.cpp b/src/guiChatConsole.cpp index bea5571f4..b3c119555 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)); @@ -124,7 +122,7 @@ void GUIChatConsole::openConsole(f32 scale) 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); @@ -212,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; -- cgit v1.2.3 From 605599b6f150b89ba6539c4d088231b326adcb48 Mon Sep 17 00:00:00 2001 From: Craig Davison Date: Sat, 20 May 2017 11:29:31 +0100 Subject: Fix shift key producing space in console (#5777) * Fix shift key producing space in console --- src/guiChatConsole.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/guiChatConsole.cpp') diff --git a/src/guiChatConsole.cpp b/src/guiChatConsole.cpp index b3c119555..4af1caa80 100644 --- a/src/guiChatConsole.cpp +++ b/src/guiChatConsole.cpp @@ -628,7 +628,7 @@ bool GUIChatConsole::OnEvent(const SEvent& event) prompt.nickCompletion(names, backwards); return true; } - else if(event.KeyInput.Char != 0 && !event.KeyInput.Control) + else if(isprint(event.KeyInput.Char) && !event.KeyInput.Control) { #if defined(__linux__) && (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 9) wchar_t wc = L'_'; -- cgit v1.2.3 From a2bb776ea81715a7b9eae4b2ea8aca032d42fb5e Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Sat, 20 May 2017 20:13:29 +0200 Subject: Fix wchar_t type on 605599b6f150b89ba6539c4d088231b326adcb48 event.KeyInput.Char is a wchar_t, iswprint should be used --- src/guiChatConsole.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/guiChatConsole.cpp') diff --git a/src/guiChatConsole.cpp b/src/guiChatConsole.cpp index 4af1caa80..8281da861 100644 --- a/src/guiChatConsole.cpp +++ b/src/guiChatConsole.cpp @@ -627,9 +627,7 @@ bool GUIChatConsole::OnEvent(const SEvent& event) bool backwards = event.KeyInput.Shift; prompt.nickCompletion(names, backwards); return true; - } - else if(isprint(event.KeyInput.Char) && !event.KeyInput.Control) - { + } else if (iswprint(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) ); -- cgit v1.2.3 From 90808a4f34dca379e872074bdfd472faf1c48cf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Sat, 20 May 2017 22:29:15 +0200 Subject: Real control fix (#5787) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Allow enabling and disabling mods. * Re-fix 605599b6f150b89ba6539c4d088231b326adcb48 This breaks some chars like € in chat. Instead verify is char is a non control char -> iswcntrl --- src/guiChatConsole.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/guiChatConsole.cpp') diff --git a/src/guiChatConsole.cpp b/src/guiChatConsole.cpp index 8281da861..5bb80bbbe 100644 --- a/src/guiChatConsole.cpp +++ b/src/guiChatConsole.cpp @@ -627,7 +627,7 @@ bool GUIChatConsole::OnEvent(const SEvent& event) bool backwards = event.KeyInput.Shift; prompt.nickCompletion(names, backwards); return true; - } else if (iswprint(event.KeyInput.Char) && !event.KeyInput.Control) { + } 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) ); -- cgit v1.2.3