Better UI scaling, quest tweaking, contentpackage hash bugfix, misc bugfixes

This commit is contained in:
Regalis
2015-07-30 23:28:15 +03:00
parent c7dd6e55f0
commit 23d847a4ac
29 changed files with 287 additions and 138 deletions
+3
View File
@@ -297,6 +297,9 @@ namespace Subsurface
}
DebugConsole.Draw(spriteBatch);
if (GUIComponent.MouseOn != null && !string.IsNullOrWhiteSpace(GUIComponent.MouseOn.ToolTip)) GUIComponent.MouseOn.DrawToolTip(spriteBatch);
}
public static void Update(float deltaTime)
+22
View File
@@ -42,6 +42,14 @@ namespace Subsurface
set;
}
public string ToolTip
{
get;
set;
}
private GUITextBlock toolTipBlock;
//protected float alpha;
public GUIComponent Parent
@@ -222,6 +230,20 @@ namespace Subsurface
//DrawChildren(spriteBatch);
}
public void DrawToolTip(SpriteBatch spriteBatch)
{
int width = 200;
if (toolTipBlock==null || (string)toolTipBlock.userData != ToolTip)
{
string wrappedText = ToolBox.WrapText(ToolTip, width, GUI.SmallFont);
toolTipBlock = new GUITextBlock(new Rectangle(0,0,width, wrappedText.Split('\n').Length*15), ToolTip, GUI.style, null, true);
toolTipBlock.userData = ToolTip;
}
toolTipBlock.rect = new Rectangle((int)PlayerInput.MousePosition.X, (int)PlayerInput.MousePosition.Y, toolTipBlock.rect.Width, toolTipBlock.rect.Height);
toolTipBlock.Draw(spriteBatch);
}
public virtual void Update(float deltaTime)
{
if (CanBeFocused)
+5 -3
View File
@@ -111,9 +111,10 @@ namespace Subsurface
if (parent != null)
parent.AddChild(this);
scrollBarHidden = true;
scrollBar = new GUIScrollBar(
new Rectangle(this.rect.X + this.rect.Width, this.rect.Y, 20, this.rect.Height), color, 1.0f, style);
new Rectangle(this.rect.X + this.rect.Width-20, this.rect.Y, 20, this.rect.Height), color, 1.0f, style);
frame = new GUIFrame(Rectangle.Empty, style, this);
if (style != null) style.Apply(frame, this);
@@ -214,14 +215,15 @@ namespace Subsurface
private void ShowScrollBar()
{
if (scrollBarHidden) Rect = new Rectangle(rect.X, rect.Y, rect.Width - scrollBar.Rect.Width, rect.Height);
scrollBarHidden = false;
Rect = new Rectangle(rect.X, rect.Y, rect.Width - scrollBar.Rect.Width, rect.Height);
}
private void HideScrollBar()
{
if (!scrollBarHidden) Rect = new Rectangle(rect.X, rect.Y, rect.Width + scrollBar.Rect.Width, rect.Height);
scrollBarHidden = true;
Rect = new Rectangle(rect.X, rect.Y, rect.Width + scrollBar.Rect.Width, rect.Height);
}
public override void Draw(SpriteBatch spriteBatch)
+1
View File
@@ -193,6 +193,7 @@ namespace Subsurface
new Vector2((int)caretPos.X + 2, caretPos.Y + Font.MeasureString("I").Y - 3),
textBlock.TextColor * (textBlock.TextColor.A / 255.0f));
}
}
public void ReceiveTextInput(char inputChar)
+11 -1
View File
@@ -81,7 +81,17 @@ namespace Subsurface
titlePos, null,
Color.White * Math.Min((state - 3.0f) / 5.0f, 1.0f), 0.0f, new Vector2(titleTexture.Width / 2.0f, titleTexture.Height / 2.0f), scale, SpriteEffects.None, 0.0f);
string loadText = (loadState<100.0f) ? "Loading... "+(int)loadState+" %" : "Press any key to continue";
string loadText = "";
if (loadState == 100.0f)
{
loadText = "Press any key to continue";
}
else if (loadState > 0.0f)
{
loadText = "Loading... " + (int)loadState + " %";
}
spriteBatch.DrawString(GUI.Font, loadText, new Vector2(Game1.GraphicsWidth/2.0f - 50.0f, Game1.GraphicsHeight*0.8f), Color.White);
spriteBatch.End();