rhythmbullet/RhythmBullet/Screens/MainMenu/MainPage.cs

66 lines
2.1 KiB
C#

using Microsoft.Xna.Framework;
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;
using RecrownedAthenaeum.UI.SkinSystem.Definitions;
using System;
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)
{
title = new Image(assets.Get<Texture2D>("title"));
AddModule(title);
SpriteFont font = assets.Get<SpriteFont>("gasalt_regular");
playButton = new TextButton("Play!", font, skin);
AddModule(playButton);
quitButton = new TextButton("Quit", font, skin);
AddModule(quitButton);
}
public override void ApplySize(int width, int height)
{
title.Scale = (width - 40) / title.texture.Width;
title.CenterOrigin();
title.bounds.X = width / 2;
title.bounds.Y = height / 2;
playButton.CenterOrigin();
playButton.bounds.Width = (int) (0.3f * title.TrueBounds.Width);
playButton.CenterHorizontally(new Rectangle(0, 0, width, height));
playButton.bounds.Y = title.bounds.X + title.TrueBounds.Height + 30;
quitButton.CenterOrigin();
quitButton.bounds.Width = (int) (0.3f * title.bounds.Width);
quitButton.bounds.Height = (int) (0.15f * playButton.bounds.Width);
playButton.CenterHorizontally(new Rectangle(0, 0, width, height));
quitButton.bounds.Y = playButton.bounds.X + playButton.bounds.Height + 15;
base.ApplySize(width, height);
}
public override void Draw(SpriteBatch batch)
{
base.Draw(batch);
}
}
}