|
ScreenManagerSpecs
Design Specifications for Screen Manager
Phase-Design IntroductionThe propose of the Screen Manager is to allow switching between different "screens" of the game. Definitions/Language
Specifications
Ideas for implementationScreen Managerpublic class ScreenManager : Microsoft.Xna.Framework.Game
{
public SpriteBatch SpriteBatch { get; }
public LineBatch LineBatch { get; }
//Update: call update on top most screen only
//Draw: call draw on all active screen in reverse order
}Screenpublic abstract Screen
{
ScreenManager sm;
public Screen(ScreenManager sm) { this.sm = sm;}
public abstract void Update(GameTime gameTime);
public abstract void Draw(GameTime gameTime);
}Test Screenpublic TestScreen : Screen
{
Part test;
public TestScreen(ScreenManager sm) : base(sm)
{
sm.Content.Load<Part>("sexyhull");
}
public override void Update(GameTime gameTime)
{
test.Rotation = (float)gameTime.TotalGameTime.TotalSeconds * 2;
}
public override void Draw(GameTime gameTime)
{
sm.LineDraw.Begin();
sm.LineDraw.Draw(test);
sm.LineDraw.End();
}
}
|