Add system messages to chat

This commit is contained in:
2025-01-20 00:03:50 +01:00
parent 4549ee7517
commit d5bb464d9f
3 changed files with 19 additions and 2 deletions

View File

@ -118,8 +118,14 @@ func (c *Chat) Draw(screenWidth, screenHeight int32) {
for i := startIdx; i < endIdx; i++ {
msg := c.messages[i]
var color rl.Color
if msg.PlayerID == 0 { // System message
color = rl.Gold
} else {
color = rl.White
}
text := fmt.Sprintf("%s: %s", msg.Username, msg.Content)
rl.DrawText(text, int32(chatX)+5, int32(messageY), 20, rl.White)
rl.DrawText(text, int32(chatX)+5, int32(messageY), 20, color)
messageY += messageHeight
}