#region File Description //----------------------------------------------------------------------------- // BackgroundScreen.cs // // Microsoft XNA Community Game Platform // Copyright (C) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- #endregion #region Using Statements using System; using System.Collections.Generic; using System.Text; using GameStateManagement; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework; #endregion namespace Blackjack { class BackgroundScreen : GameScreen { Texture2D background; Rectangle safeArea; /// /// Initializes a new instance of the screen. /// public BackgroundScreen() { TransitionOnTime = TimeSpan.FromSeconds(0.0); TransitionOffTime = TimeSpan.FromSeconds(0.5); } #region Loading /// /// Load graphics content for the screen. /// public override void LoadContent() { background = ScreenManager.Game.Content.Load(@"Images\titlescreen"); safeArea = ScreenManager.Game.GraphicsDevice.Viewport.TitleSafeArea; base.LoadContent(); } #endregion #region Update and Render /// /// Allows the screen to run logic, such as updating the transition position. /// Unlike HandleInput, this method is called regardless of whether the screen /// is active, hidden, or in the middle of a transition. /// /// /// /// public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { base.Update(gameTime, otherScreenHasFocus, false); } /// /// This is called when the screen should draw itself. /// /// public override void Draw(Microsoft.Xna.Framework.GameTime gameTime) { ScreenManager.SpriteBatch.Begin(); ScreenManager.SpriteBatch.Draw(background, ScreenManager.GraphicsDevice.Viewport.Bounds, Color.White * TransitionAlpha); ScreenManager.SpriteBatch.End(); base.Draw(gameTime); } #endregion } }