summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/NetPlayChatUI.cpp
diff options
context:
space:
mode:
authorLéo Lam <leo@innovatetechnologi.es>2019-05-29 13:18:03 +0200
committerGitHub <noreply@github.com>2019-05-29 13:18:03 +0200
commit0cfdcf436dcec26a4ba2ad1f5733687694f5691f (patch)
tree83c60367646dcf6690c87ce7d989ebd473b3c896 /Source/Core/VideoCommon/NetPlayChatUI.cpp
parent4aaa00dd8c4f9698cb53c22e108d610aad00687f (diff)
parent778623c48c9236e3fde42c7a643fc6d7bd05ee55 (diff)
Merge pull request #8136 from lioncash/arglist
VideoCommon/{NetPlayChatUI/NetPlayGolfUI}: Minor changes
Diffstat (limited to 'Source/Core/VideoCommon/NetPlayChatUI.cpp')
-rw-r--r--Source/Core/VideoCommon/NetPlayChatUI.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/Source/Core/VideoCommon/NetPlayChatUI.cpp b/Source/Core/VideoCommon/NetPlayChatUI.cpp
index 7587229ee0..a84c26d8d7 100644
--- a/Source/Core/VideoCommon/NetPlayChatUI.cpp
+++ b/Source/Core/VideoCommon/NetPlayChatUI.cpp
@@ -14,10 +14,12 @@ constexpr size_t MAX_BACKLOG_SIZE = 100;
std::unique_ptr<NetPlayChatUI> g_netplay_chat_ui;
NetPlayChatUI::NetPlayChatUI(std::function<void(const std::string&)> callback)
+ : m_message_callback{std::move(callback)}
{
- m_message_callback = std::move(callback);
}
+NetPlayChatUI::~NetPlayChatUI() = default;
+
void NetPlayChatUI::Display()
{
const float scale = ImGui::GetIO().DisplayFramebufferScale.x;
@@ -78,12 +80,12 @@ void NetPlayChatUI::Display()
ImGui::End();
}
-void NetPlayChatUI::AppendChat(const std::string& message, NetPlayChatUI::Color color)
+void NetPlayChatUI::AppendChat(std::string message, Color color)
{
if (m_messages.size() > MAX_BACKLOG_SIZE)
m_messages.pop_front();
- m_messages.push_back({message, color});
+ m_messages.emplace_back(std::move(message), color);
// Only scroll to bottom, if we were at the bottom previously
if (m_is_scrolled_to_bottom)
@@ -106,7 +108,7 @@ void NetPlayChatUI::SendMessage()
void NetPlayChatUI::Activate()
{
if (ImGui::IsItemFocused())
- ImGui::SetWindowFocus(NULL);
+ ImGui::SetWindowFocus(nullptr);
else
m_activate = true;
}