rhythmbullet/RhythmBullet/Screens/MainMenu/MainPage.cs

59 lines
1.8 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;
namespace RhythmBullet.Screens.MainMenu
{
internal class MainPage : Page
{
Image title;
TextButton playButton;
TextButton quitButton;
PrimitiveBatch primitiveBatch = new PrimitiveBatch();
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 = (int)(width / 2f);
title.bounds.Y = (int)(height / 2f);
base.ApplySize(width, height);
}
public override void Draw(SpriteBatch batch)
{
base.Draw(batch);
primitiveBatch.Begin(PrimitiveType.LineList);
primitiveBatch.AddVertex(new Vector2(20, 20), Color.Red);
primitiveBatch.AddVertex(new Vector2(50, 60), Color.Red);
primitiveBatch.End();
}
}
}