| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- //-----------------------------------------------------------------------------
- // BackgroundScreen.cs
- //
- // Microsoft XNA Community Game Platform
- // Copyright (C) Microsoft Corporation. All rights reserved.
- //-----------------------------------------------------------------------------
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Microsoft.Xna.Framework.Graphics;
- using Microsoft.Xna.Framework;
- using GameStateManagement;
- namespace CatapultGame
- {
- class BackgroundScreen : GameScreen
- {
- Texture2D background;
- public BackgroundScreen()
- {
- TransitionOnTime = TimeSpan.FromSeconds(0.0);
- TransitionOffTime = TimeSpan.FromSeconds(0.5);
- }
- public override void LoadContent()
- {
- background = Load<Texture2D>("Textures/Backgrounds/title_screen");
- }
- /// <summary>
- /// Updates the background screen. Unlike most screens, this should not
- /// transition off even if it has been covered by another screen: it is
- /// supposed to be covered, after all! This overload forces the
- /// coveredByOtherScreen parameter to false in order to stop the base
- /// Update method wanting to transition off.
- /// </summary>
- public override void Update(GameTime gameTime, bool otherScreenHasFocus,
- bool coveredByOtherScreen)
- {
- base.Update(gameTime, otherScreenHasFocus, false);
- }
- public override void Draw(GameTime gameTime)
- {
- SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
- spriteBatch.Begin();
- // Draw Background
- spriteBatch.Draw(background, new Vector2(0, 0),
- new Color(255, 255, 255, TransitionAlpha));
- spriteBatch.End();
- }
- }
- }
|