rhythmbullet/RhythmBullet/Screens/MainMenu/MainPage.cs

68 lines
2.2 KiB
C#
Raw Normal View History

using Microsoft.Xna.Framework.Graphics;
using RecrownedAthenaeum.ContentSystem;
2019-01-30 13:45:55 +00:00
using RecrownedAthenaeum.Render;
2019-01-28 17:41:36 +00:00
using RecrownedAthenaeum.UI.BookSystem;
using RecrownedAthenaeum.UI.Modular.Modules;
using RecrownedAthenaeum.UI.Modular.Modules.Interactive;
2019-01-28 17:41:36 +00:00
using RecrownedAthenaeum.UI.SkinSystem;
2018-11-13 00:50:00 +00:00
2019-01-23 01:31:15 +00:00
namespace RhythmBullet.Screens.MainMenu
2018-11-13 00:50:00 +00:00
{
internal class MainPage : Page
{
2018-11-15 07:22:35 +00:00
Image title;
2018-11-22 07:12:40 +00:00
TextButton playButton;
TextButton quitButton;
2019-01-28 17:41:36 +00:00
internal MainPage() : base(0, 0)
{
}
protected override void Initialize(ContentManagerController assets, ISkin skin, BasicScissor scissorBox)
2018-11-13 00:50:00 +00:00
{
2018-11-15 07:22:35 +00:00
title = new Image(assets.Get<Texture2D>("title"));
AddModule(title);
2019-01-28 17:41:36 +00:00
SpriteFont font = assets.Get<SpriteFont>("gasalt_regular");
playButton = new TextButton("Play!", font, skin);
AddModule(playButton);
quitButton = new TextButton("Quit", font, skin);
AddModule(quitButton);
base.Initialize(assets, skin, scissorBox);
2018-11-15 07:22:35 +00:00
}
public override void ApplySize(int width, int height)
{
2019-03-09 06:26:59 +00:00
base.ApplySize(width, height);
2019-03-02 05:30:43 +00:00
title.Scale = (width - 40) / title.texture.Width;
title.CenterOrigin();
title.CenterHorizontally();
title.CenterVertically();
2019-01-28 17:41:36 +00:00
2019-03-09 06:26:59 +00:00
playButton.situation.Width = (int)(0.3f * title.Boundaries.Width);
playButton.situation.Height = (int)(0.05f * title.Boundaries.Width);
playButton.CenterOrigin();
playButton.CenterHorizontally();
2019-03-09 06:50:46 +00:00
playButton.situation.Y = (int)playButton.origin.Y + title.Boundaries.Y + title.Boundaries.Height + 60;
2019-03-09 06:26:59 +00:00
quitButton.situation.Width = (int)(0.3f * title.Boundaries.Width);
quitButton.situation.Height = (int)(0.05f * title.Boundaries.Width);
quitButton.CenterOrigin();
quitButton.CenterHorizontally();
2019-03-09 06:26:59 +00:00
quitButton.situation.Y = (int)quitButton.origin.Y + playButton.Boundaries.Y + playButton.Boundaries.Height + 15;
base.ApplySize(width, height);
2018-11-13 01:54:33 +00:00
}
public override void Draw(ConsistentSpriteBatch batch)
2018-11-13 01:54:33 +00:00
{
2019-02-06 18:47:44 +00:00
base.Draw(batch);
2018-11-13 00:50:00 +00:00
}
}
}