Browse Source

Fixed wrong number of rows in chat history of Sample 16_Chat.

LordGolias 7 years ago
parent
commit
45793b8ae2
1 changed files with 5 additions and 2 deletions
  1. 5 2
      Source/Samples/16_Chat/Chat.cpp

+ 5 - 2
Source/Samples/16_Chat/Chat.cpp

@@ -110,10 +110,13 @@ void Chat::CreateUI()
 
     UpdateButtons();
 
-    int rowHeight = chatHistoryText_->GetRowHeight();
+    float rowHeight = chatHistoryText_->GetRowHeight();
     // Row height would be zero if the font failed to load
     if (rowHeight)
-        chatHistory_.Resize((graphics->GetHeight() - 20) / rowHeight);
+    {
+        float numberOfRows = (graphics->GetHeight() - 20) / rowHeight;
+        chatHistory_.Resize(static_cast<unsigned int>(numberOfRows));
+    }
 
     // No viewports or scene is defined. However, the default zone's fog color controls the fill color
     GetSubsystem<Renderer>()->GetDefaultZone()->SetFogColor(Color(0.0f, 0.0f, 0.1f));