This commit is contained in:
Regalis
2015-08-18 22:29:21 +03:00
parent 00c64f0b20
commit e19ac600ff
13 changed files with 161 additions and 58 deletions

View File

@@ -80,6 +80,8 @@ namespace Subsurface
: this (rect, text, null, null, alignment, textAlignment, style, parent, wrap)
{
this.Font = font == null ? GUI.Font : font;
SetTextPos();
}
public GUITextBlock(Rectangle rect, string text, Color? color, Color? textColor, Alignment textAlignment = Alignment.Left, GUIStyle style = null, GUIComponent parent = null, bool wrap = false)

View File

@@ -41,19 +41,26 @@ namespace Subsurface
box.HoverColor = Color.Gray;
box.SelectedColor = Color.DarkGray;
text = new GUITextBlock(new Rectangle(rect.X + 40, rect.Y, 200, 30), label, Color.Transparent, Color.White, Alignment.TopLeft, null, this);
text = new GUITextBlock(new Rectangle(rect.X + 40, rect.Y, 200, rect.Height), label, Color.Transparent, Color.White, Alignment.TopLeft, null, this);
Enabled = true;
}
public override void Update(float deltaTime)
{
base.Update(deltaTime);
if (rect.Width ==420)
{
int asd = 1;
}
//base.Update(deltaTime);
if (!Enabled) return;
if (box.Rect.Contains(PlayerInput.GetMouseState.Position))
{
box.State = ComponentState.Hover;
if (PlayerInput.GetMouseState.LeftButton == ButtonState.Pressed)
@@ -77,12 +84,16 @@ namespace Subsurface
public override void Draw(SpriteBatch spriteBatch)
{
if (rect.Width == 420)
{
int asd = 1;
}
DrawChildren(spriteBatch);
if (Selected)
{
GUI.DrawRectangle(spriteBatch, new Rectangle(box.Rect.X + 2, box.Rect.Y + 2, box.Rect.Width - 4, box.Rect.Height - 4), Color.Green * 0.8f, true);
}
GUI.DrawRectangle(spriteBatch, new Rectangle(box.Rect.X + 2, box.Rect.Y + 2, box.Rect.Width - 4, box.Rect.Height - 4),
selected ? Color.Green * 0.8f : Color.Black, true);
}
}
}