final chat refactor v1.5

master
CREAsTIVE 2022-07-24 22:22:47 +05:00
parent c435af95bd
commit e12453fcdc
2 changed files with 4 additions and 6 deletions

View File

@ -207,10 +207,8 @@ void Shooter::update() {
} }
void Shooter::drawChat() { void Shooter::drawChat() {
sf::Color chatColor; sf::Color chatColor = isTypingMessage? sf::Color(50, 50, 50, 255) : sf::Color(50, 50, 50, chat->update(Time::deltaTime()));
string chatText; string chatText = isTypingMessage ? chat->getChat() : chat->getChatPreview();
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();}
screen->drawText(chatText, Vec2D{ 0, (double)screen->height()*0.25 }, 20, chatColor); screen->drawText(chatText, Vec2D{ 0, (double)screen->height()*0.25 }, 20, chatColor);

View File

@ -31,9 +31,9 @@ void ChatManager::updateChat() {
for (int messageIndex = size - 1; messageIndex >= 0; messageIndex--) for (int messageIndex = size - 1; messageIndex >= 0; messageIndex--)
{ {
if (messageIndex > size - 6) { 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";
} }
} }
} }