| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- //-----------------------------------------------------------------------------
- // BackgroundScreen.cs
- //
- // Microsoft XNA Community Game Platform
- // Copyright (C) Microsoft Corporation. All rights reserved.
- //-----------------------------------------------------------------------------
- using System;
- using System.Collections.Generic;
- using System.Text;
- using GameStateManagement;
- using Microsoft.Xna.Framework.Graphics;
- using Microsoft.Xna.Framework;
- using System.IO;
- namespace Blackjack
- {
- class BackgroundScreen : GameScreen
- {
- Texture2D background;
- Rectangle safeArea;
- /// <summary>
- /// Initializes a new instance of the screen.
- /// </summary>
- public BackgroundScreen()
- {
- TransitionOnTime = TimeSpan.FromSeconds(0.0);
- TransitionOffTime = TimeSpan.FromSeconds(0.5);
- }
- /// <summary>
- /// Load graphics content for the screen.
- /// </summary>
- public override void LoadContent()
- {
- background = ScreenManager.Game.Content.Load<Texture2D>(Path.Combine("Images", "titlescreen"));
- safeArea = new Rectangle(0, 0, ScreenManager.BASE_BUFFER_WIDTH, ScreenManager.BASE_BUFFER_HEIGHT);
- base.LoadContent();
- }
- /// <summary>
- /// 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.
- /// </summary>
- /// <param name="gameTime"></param>
- /// <param name="otherScreenHasFocus"></param>
- /// <param name="coveredByOtherScreen"></param>
- public override void Update(GameTime gameTime, bool otherScreenHasFocus,
- bool coveredByOtherScreen)
- {
- base.Update(gameTime, otherScreenHasFocus, false);
- }
- /// <summary>
- /// This is called when the screen should draw itself.
- /// </summary>
- /// <param name="gameTime"></param>
- public override void Draw(Microsoft.Xna.Framework.GameTime gameTime)
- {
- ScreenManager.SpriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenManager.GlobalTransformation);
- ScreenManager.SpriteBatch.Draw(background, safeArea, Color.White * TransitionAlpha);
- ScreenManager.SpriteBatch.End();
- base.Draw(gameTime);
- }
- }
- }
|