#region File Description
//-----------------------------------------------------------------------------
// BackgroundScreen.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion
#region Using Statements
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
#endregion
namespace HoneycombRush
{
class BackgroundScreen : GameScreen
{
#region Fields
Texture2D background;
string backgroundName;
#endregion
#region Initialization
///
/// Creates a new background screen.
///
/// Name of the background texture to use.
public BackgroundScreen(string backgroundName)
{
TransitionOnTime = TimeSpan.FromSeconds(0.0);
TransitionOffTime = TimeSpan.FromSeconds(0.5);
this.backgroundName = backgroundName;
}
///
/// Load screen resources.
///
public override void LoadContent()
{
background = ScreenManager.Game.Content.Load("Textures/Backgrounds/" + backgroundName);
base.LoadContent();
}
#endregion
#region Update
///
/// Update the screen.
///
/// Game time information.
/// Whether or not another screen currently has the focus.
/// Whether or not this screen is covered by another.
public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
{
base.Update(gameTime, otherScreenHasFocus, false);
}
#endregion
#region Render
///
/// Renders the screen.
///
/// Game time information.
public override void Draw(GameTime gameTime)
{
SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
spriteBatch.Begin();
// Draw background
spriteBatch.Draw(background, ScreenManager.GraphicsDevice.Viewport.Bounds, Color.White * TransitionAlpha);
spriteBatch.End();
}
#endregion
}
}