From d0fac726d374c9afb777673227a576b0f04eef9c Mon Sep 17 00:00:00 2001 From: Benau Date: Thu, 20 Jun 2019 10:34:47 +0800 Subject: [PATCH] Allow to use emoji ingame --- .../{ => online}/network_ingame_dialog.stkgui | 6 ++++-- .../dialogs/race_paused_dialog.cpp | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) rename data/gui/dialogs/{ => online}/network_ingame_dialog.stkgui (88%) diff --git a/data/gui/dialogs/network_ingame_dialog.stkgui b/data/gui/dialogs/online/network_ingame_dialog.stkgui similarity index 88% rename from data/gui/dialogs/network_ingame_dialog.stkgui rename to data/gui/dialogs/online/network_ingame_dialog.stkgui index 958ea2a10..d63686908 100644 --- a/data/gui/dialogs/network_ingame_dialog.stkgui +++ b/data/gui/dialogs/online/network_ingame_dialog.stkgui @@ -3,8 +3,10 @@
- -
diff --git a/src/states_screens/dialogs/race_paused_dialog.cpp b/src/states_screens/dialogs/race_paused_dialog.cpp index cc7579b60..ad2d2e9ee 100644 --- a/src/states_screens/dialogs/race_paused_dialog.cpp +++ b/src/states_screens/dialogs/race_paused_dialog.cpp @@ -22,8 +22,10 @@ #include "audio/music_manager.hpp" #include "audio/sfx_manager.hpp" #include "config/user_config.hpp" +#include "guiengine/emoji_keyboard.hpp" #include "guiengine/engine.hpp" #include "guiengine/scalable_font.hpp" +#include "guiengine/widgets/CGUIEditBox.hpp" #include "guiengine/widgets/icon_button_widget.hpp" #include "guiengine/widgets/ribbon_widget.hpp" #include "io/file_manager.hpp" @@ -64,7 +66,7 @@ RacePausedDialog::RacePausedDialog(const float percentWidth, } else { - loadFromFile("network_ingame_dialog.stkgui"); + loadFromFile("online/network_ingame_dialog.stkgui"); } GUIEngine::RibbonWidget* back_btn = getWidget("backbtnribbon"); @@ -76,16 +78,22 @@ RacePausedDialog::RacePausedDialog(const float percentWidth, SFXManager::get()->pauseAll(); m_text_box->clearListeners(); m_text_box->setTextBoxType(TBT_CAP_SENTENCES); + // Unicode enter arrow + getWidget("send")->setText(L"\u21B2"); + // Unicode smile emoji + getWidget("emoji")->setText(L"\u263A"); if (UserConfigParams::m_lobby_chat) { m_text_box->setActive(true); getWidget("send")->setVisible(true); + getWidget("emoji")->setVisible(true); m_text_box->addListener(this); auto cl = LobbyProtocol::get(); if (cl && !cl->serverEnabledChat()) { m_text_box->setActive(false); getWidget("send")->setActive(false); + getWidget("emoji")->setActive(false); } } else @@ -94,6 +102,7 @@ RacePausedDialog::RacePausedDialog(const float percentWidth, m_text_box->setText( _("Chat is disabled, enable in options menu.")); getWidget("send")->setVisible(false); + getWidget("emoji")->setVisible(false); } } else @@ -175,6 +184,14 @@ GUIEngine::EventPropagation onEnterPressed(m_text_box->getText()); return GUIEngine::EVENT_BLOCK; } + else if (eventSource == "emoji" && m_text_box && + !ScreenKeyboard::isActive()) + { + EmojiKeyboard* ek = new EmojiKeyboard(1.0f, 0.40f, + m_text_box->getIrrlichtElement()); + ek->init(); + return GUIEngine::EVENT_BLOCK; + } else if (eventSource == "backbtnribbon") { // unpausing is done in the destructor so nothing more to do here