TextBoxes align text to the right and hide any overflowing text at the left if the width of the box is exceeded
This commit is contained in:
@@ -193,10 +193,10 @@ namespace Barotrauma
|
||||
var catButton = new GUIButton(new Rectangle(0, y, 0, 20), category.ToString(), Alignment.Left, "", leftPanel);
|
||||
catButton.UserData = i;
|
||||
catButton.OnClicked = SelectTab;
|
||||
y+=25;
|
||||
y += 25;
|
||||
|
||||
GUItabs[i] = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), "");
|
||||
GUItabs[i].Padding = new Vector4(10.0f, 30.0f, 10.0f, 10.0f);
|
||||
GUItabs[i].Padding = new Vector4(10.0f, 30.0f, 10.0f, 20.0f);
|
||||
|
||||
new GUITextBlock(new Rectangle(-200, 0, 100, 15), "Filter", "", Alignment.TopRight, Alignment.CenterRight, GUItabs[i], false, GUI.SmallFont);
|
||||
|
||||
|
||||
@@ -3,9 +3,6 @@ using Lidgren.Network;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Barotrauma.Networking;
|
||||
using FarseerPhysics;
|
||||
using FarseerPhysics.Factories;
|
||||
using FarseerPhysics.Dynamics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
@@ -188,6 +185,7 @@ namespace Barotrauma
|
||||
|
||||
chatBox = new GUIListBox(new Rectangle(0,0,0,chatFrame.Rect.Height-80), Color.White, "", chatFrame);
|
||||
textBox = new GUITextBox(new Rectangle(0, 25, 0, 25), Alignment.Bottom, "", chatFrame);
|
||||
textBox.MaxTextWidth = textBox.Rect.Width * 2;
|
||||
textBox.Font = GUI.SmallFont;
|
||||
|
||||
//player info panel ------------------------------------------------------------
|
||||
@@ -1031,16 +1029,15 @@ namespace Barotrauma
|
||||
{
|
||||
float prevSize = chatBox.BarSize;
|
||||
|
||||
while (chatBox.CountChildren>20)
|
||||
while (chatBox.CountChildren > 20)
|
||||
{
|
||||
chatBox.RemoveChild(chatBox.children[1]);
|
||||
}
|
||||
|
||||
GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, 0, 20),
|
||||
GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, chatBox.Rect.Width-20, 0),
|
||||
message.TextWithSender,
|
||||
((chatBox.CountChildren % 2) == 0) ? Color.Transparent : Color.Black*0.1f, message.Color,
|
||||
Alignment.Left, "", null, true);
|
||||
msg.Font = GUI.SmallFont;
|
||||
Alignment.Left, Alignment.TopLeft, "", null, true, GUI.SmallFont);
|
||||
msg.UserData = message.SenderName;
|
||||
msg.CanBeFocused = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user