final chat refactor v1.5
parent
c435af95bd
commit
e12453fcdc
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -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";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue