rhythmbullet/RhythmBullet/Screens/MainMenu/MainPage.cs
2021-12-23 21:33:01 -06:00

68 lines
2.2 KiB
C#
Executable File

using Microsoft.Xna.Framework.Graphics;
using RecrownedAthenaeum.ContentSystem;
using RecrownedAthenaeum.Render;
using RecrownedAthenaeum.UI.BookSystem;
using RecrownedAthenaeum.UI.Modular.Modules;
using RecrownedAthenaeum.UI.Modular.Modules.Interactive;
using RecrownedAthenaeum.UI.SkinSystem;
namespace RhythmBullet.Screens.MainMenu
{
internal class MainPage : Page
{
Image title;
TextButton playButton;
TextButton quitButton;
internal MainPage() : base(0, 0)
{
}
protected override void Initialize(ContentManagerController assets, ISkin skin, BasicScissor scissorBox)
{
title = new Image(assets.Get<Texture2D>("title"));
AddModules(title);
SpriteFont font = assets.Get<SpriteFont>("gasalt_regular");
playButton = new TextButton("Play!", font, skin);
AddModules(playButton);
quitButton = new TextButton("Quit", font, skin);
AddModules(quitButton);
base.Initialize(assets, skin, scissorBox);
}
public override void ApplySize(int width, int height)
{
base.ApplySize(width, height);
title.Scale = (width - 40) / title.texture.Width;
title.CenterOrigin();
title.CenterHorizontally();
title.CenterVertically();
playButton.Width = (int)(0.3f * title.Boundaries.Width);
playButton.Height = (int)(0.05f * title.Boundaries.Width);
playButton.CenterOrigin();
playButton.CenterHorizontally();
playButton.Y = (int)playButton.origin.Y + title.Boundaries.Y + title.Boundaries.Height + 60;
quitButton.Width = (int)(0.3f * title.Boundaries.Width);
quitButton.Height = (int)(0.05f * title.Boundaries.Width);
quitButton.CenterOrigin();
quitButton.CenterHorizontally();
quitButton.Y = (int)quitButton.origin.Y + playButton.Boundaries.Y + playButton.Boundaries.Height + 15;
base.ApplySize(width, height);
}
public override void Draw(ConsistentSpriteBatch batch)
{
base.Draw(batch);
}
}
}