rhythmbullet/RhythmBullet/Screens/MainMenu/MainPage.cs
2019-03-09 00:50:46 -06:00

67 lines
2.2 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)
{
base.ApplySize(width, height);
title.Scale = (width - 40) / title.texture.Width;
title.CenterOrigin();
title.CenterHorizontally(Boundaries);
title.CenterVertically(Boundaries);
playButton.situation.Width = (int)(0.3f * title.Boundaries.Width);
playButton.situation.Height = (int)(0.05f * title.Boundaries.Width);
playButton.CenterOrigin();
playButton.CenterHorizontally(Boundaries);
playButton.situation.Y = (int)playButton.origin.Y + title.Boundaries.Y + title.Boundaries.Height + 60;
quitButton.situation.Width = (int)(0.3f * title.Boundaries.Width);
quitButton.situation.Height = (int)(0.05f * title.Boundaries.Width);
quitButton.CenterOrigin();
quitButton.CenterHorizontally(Boundaries);
quitButton.situation.Y = (int)quitButton.origin.Y + playButton.Boundaries.Y + playButton.Boundaries.Height + 15;
}
public override void Draw(SpriteBatch batch)
{
base.Draw(batch);
}
}
}