From e12453fcdc7dd20ad3a391104c82da0bcbda5a6e Mon Sep 17 00:00:00 2001 From: CREAsTIVE Date: Sun, 24 Jul 2022 22:22:47 +0500 Subject: [PATCH] final chat refactor v1.5 --- Shooter.cpp | 6 ++---- network/Chat.cpp | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Shooter.cpp b/Shooter.cpp index 999c1a2..620441e 100644 --- a/Shooter.cpp +++ b/Shooter.cpp @@ -207,10 +207,8 @@ void Shooter::update() { } void Shooter::drawChat() { - sf::Color chatColor; - string chatText; - if (!isTypingMessage) { chatColor = sf::Color(0, 0, 0, chat->update(Time::deltaTime())); chatText = chat->getChatPreview(); } - else { chatColor = sf::Color(60, 60, 60, 200); chatText = chat->getChat();} + sf::Color chatColor = isTypingMessage? sf::Color(50, 50, 50, 255) : sf::Color(50, 50, 50, chat->update(Time::deltaTime())); + string chatText = isTypingMessage ? chat->getChat() : chat->getChatPreview(); screen->drawText(chatText, Vec2D{ 0, (double)screen->height()*0.25 }, 20, chatColor); diff --git a/network/Chat.cpp b/network/Chat.cpp index 860c964..e69b9e3 100644 --- a/network/Chat.cpp +++ b/network/Chat.cpp @@ -31,9 +31,9 @@ void ChatManager::updateChat() { for (int messageIndex = size - 1; messageIndex >= 0; messageIndex--) { if (messageIndex > size - 6) { - chatStrPrev += authors[messageIndex] + ": " + messages[messageIndex] + ";\n"; + chatStrPrev += authors[messageIndex] + ": " + messages[messageIndex] + "\n"; } - chatStr += authors[messageIndex] + ": " + messages[messageIndex] + ";\n"; + chatStr += authors[messageIndex] + ": " + messages[messageIndex] + "\n"; } } }