-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathTitlePage.cs
39 lines (35 loc) · 1.6 KB
/
TitlePage.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using StardewValley;
namespace Entoarox.DynamicDungeons
{
internal class TitlePage : Page
{
/*********
** Fields
*********/
private readonly string Introduction;
private readonly string Subtitle;
private readonly string Title;
/*********
** Public methods
*********/
public TitlePage(string title, string subtitle, string introduction)
{
this.Title = title;
this.Subtitle = subtitle;
this.Introduction = introduction;
}
public override void Draw(SpriteBatch batch, Rectangle region)
{
string introduction = Game1.parseText(this.Introduction, Game1.smallFont, region.Width);
Vector2 titleSize = Game1.dialogueFont.MeasureString(this.Title);
Vector2 subtitleSize = Game1.dialogueFont.MeasureString(this.Subtitle) * 0.8f;
float titlePos = region.X + (region.Width - titleSize.X) / 2;
float subtitlePos = region.X + (region.Width - subtitleSize.X) / 2;
Utility.drawTextWithShadow(batch, this.Title, Game1.dialogueFont, new Vector2(titlePos, region.Y + 32), Game1.textColor, 1);
Utility.drawTextWithShadow(batch, this.Subtitle, Game1.dialogueFont, new Vector2(subtitlePos, region.Y + titleSize.Y + 32), Game1.textColor, 0.8f);
Utility.drawTextWithShadow(batch, introduction, Game1.smallFont, new Vector2(region.X, region.Y + titleSize.Y + subtitleSize.Y + subtitleSize.Y + 32), Game1.textColor);
}
}
}