diff options
| author | spycrab <spycrab@users.noreply.github.com> | 2019-03-17 01:09:06 +0100 |
|---|---|---|
| committer | spycrab <spycrab@users.noreply.github.com> | 2019-03-23 20:13:24 +0100 |
| commit | 7cfb626a834cdc065e56e529bbed81df755a7c09 (patch) | |
| tree | e547c145eed01129174d122852960f9f29b51c6f /Source/Core/VideoCommon/NetPlayChatUI.h | |
| parent | 8cfbbbe9dc49186b40d5c2a3edc0e7e6d7059191 (diff) | |
Add imgui-based Netplay Chat
Diffstat (limited to 'Source/Core/VideoCommon/NetPlayChatUI.h')
| -rw-r--r-- | Source/Core/VideoCommon/NetPlayChatUI.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/NetPlayChatUI.h b/Source/Core/VideoCommon/NetPlayChatUI.h new file mode 100644 index 0000000000..c355aa462d --- /dev/null +++ b/Source/Core/VideoCommon/NetPlayChatUI.h @@ -0,0 +1,35 @@ +// Copyright 2019 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#pragma once + +#include <array> +#include <deque> +#include <functional> +#include <memory> +#include <string> +#include <utility> + +class NetPlayChatUI +{ +public: + explicit NetPlayChatUI(std::function<void(const std::string&)> callback); + ~NetPlayChatUI() = default; + + using Color = std::array<float, 3>; + + void Display(); + void AppendChat(const std::string& message, Color color); + void SendMessage(); + +private: + char m_message_buf[256] = {}; + bool m_scroll_to_bottom = false; + bool m_is_scrolled_to_bottom = true; + + std::deque<std::pair<std::string, Color>> m_messages; + std::function<void(const std::string&)> m_message_callback; +}; + +extern std::unique_ptr<NetPlayChatUI> g_netplay_chat_ui; |
