Replaced the arrows in server lobby buttons with images, made GUIImages rotatable (todo: make them align correctly when rotated/scaled), fixed the size of the sub save warning messagebox

This commit is contained in:
Regalis
2017-02-27 22:28:10 +02:00
parent 979c82443c
commit 9e16542b13
4 changed files with 34 additions and 14 deletions
+5 -3
View File
@@ -6,9 +6,11 @@ namespace Barotrauma
{
public class GUIImage : GUIComponent
{
Sprite sprite;
public float Rotation;
Rectangle sourceRect;
private Sprite sprite;
private Rectangle sourceRect;
bool crop;
@@ -85,7 +87,7 @@ namespace Barotrauma
if (sprite != null && sprite.Texture != null)
{
spriteBatch.Draw(sprite.Texture, new Vector2(rect.X, rect.Y), sourceRect, currColor * (currColor.A / 255.0f), 0.0f, Vector2.Zero,
spriteBatch.Draw(sprite.Texture, new Vector2(rect.X, rect.Y), sourceRect, currColor * (currColor.A / 255.0f), Rotation, Vector2.Zero,
Scale, SpriteEffects.None, 0.0f);
}
+11
View File
@@ -42,6 +42,17 @@ namespace Barotrauma
: base(new Rectangle(0,0, GameMain.GraphicsWidth, GameMain.GraphicsHeight),
Color.Black*0.5f, Alignment.TopLeft, null, parent)
{
if (height == 0)
{
string wrappedText = ToolBox.WrapText(text, width, GUI.Font);
string[] lines = wrappedText.Split('\n');
foreach (string line in lines)
{
height += (int)GUI.Font.MeasureString(line).Y;
}
height += 220;
}
var frame = new GUIFrame(new Rectangle(0,0,width,height), null, Alignment.Center, GUI.Style, this);
new GUITextBlock(new Rectangle(0, 0, 0, 30), header, Color.Transparent, Color.White, textAlignment, GUI.Style, frame, true);