Transposer/Scenes/TitleScene.cs

Title scene for the Transposer game. Creates the animated background and centers the title text sprite, with an overload that keeps the title above a minimum Y position.

namespace Sandbox.Transposer;

/// <summary>The animated backdrop shared by the platform and in-game title screens.</summary>
public class TitleScene : TransposerScene
{
	public override void Activate() => Activate( 0 );

	public void Activate( int minimumTitleY )
	{
		base.Activate();
		AddEntity( new Background( 0, 0, this ) );

		var title = new TitleText( "transposer", this, 0, 0, "font", 2 ) { MinimumY = minimumTitleY };
		title.PixelX = (Screen.PixelWidth - title.Hitbox.Width) / 2;
		title.PixelY = (minimumTitleY + Screen.PixelHeight - title.Hitbox.Height) / 2;
		title.Depth -= 1;
		AddEntity( title );
	}
}