- Harlinn.WindowsPhone.XNA.zip
- AnatomyOfAGame
- AnatomyOfAGame
- AnatomyOfAGameContent
- AnatomyOfAGameContent.contentproj
- bin
- Windows Phone
- Debug
- obj
- Windows Phone
- Debug
- DesignTimeResolveAssemblyReferencesInput.cache
- TempPE
- Farseer Physics Engine 3.3.1 XNA
- DebugView XNA
- Farseer Physics Engine 3.3 XNA
- Samples XNA WP7.sln
- Samples XNA Xbox360.sln
- Samples XNA.sln
- Samples XNA
- Samples XNA
- Samples XNAContent
- Common
- arrow.png
- buttons.png
- cursor.png
- gradient.png
- logo.png
- popup.png
- slider.png
- socket.png
- stick.png
- Fonts
- detailsFont.spritefont
- frameRateCounterFont.spritefont
- menufont.spritefont
- Materials
- blank.png
- dots.png
- pavement.png
- squares.png
- waves.png
- Samples XNA Content.contentproj
- Samples
- alphabet.png
- car.png
- goo.png
- link.png
- object.png
- wheel.png
- FarseerPhysicsIntro
- FarseerPhysicsIntro
- FarseerPhysicsIntroContent
- bin
- Windows Phone
- Debug
- Release
- DefaultSpriteFont.spritefont
- FarseerPhysicsIntroContent.contentproj
- FarseerPhysicsIntroContent.contentproj.user
- Thumbs.db
- white.png
- Harlinn.WindowsPhone.XNA.sln
- HarlinnFarseerXNA
- XNAImageIntro
- XNAImageIntro
- XNAImageIntroContent
- bin
- Windows Phone
- Debug
- XNAImageIntroContent.contentproj
|
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
namespace FarseerPhysics.SamplesFramework
{
public class LogoScreen : GameScreen
{
private const float LogoScreenHeightRatio = 4f / 6f;
private const float LogoWidthHeightRatio = 1.4f;
private ContentManager _content;
private Rectangle _destination;
private TimeSpan _duration;
private Texture2D _farseerLogoTexture;
public LogoScreen(TimeSpan duration)
{
_duration = duration;
TransitionOffTime = TimeSpan.FromSeconds(2.0);
}
/// <summary>
/// Loads graphics content for this screen. The background texture is quite
/// big, so we use our own local ContentManager to load it. This allows us
/// to unload before going from the menus into the game itself, wheras if we
/// used the shared ContentManager provided by the Game class, the content
/// would remain loaded forever.
/// </summary>
public override void LoadContent()
{
if (_content == null)
{
_content = new ContentManager(ScreenManager.Game.Services, "Content");
}
_farseerLogoTexture = _content.Load<Texture2D>("Common/logo");
Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
int rectHeight = (int)(viewport.Height * LogoScreenHeightRatio);
int rectWidth = (int)(rectHeight * LogoWidthHeightRatio);
int posX = viewport.Bounds.Center.X - rectWidth / 2;
int posY = viewport.Bounds.Center.Y - rectHeight / 2;
_destination = new Rectangle(posX, posY, rectWidth, rectHeight);
}
/// <summary>
/// Unloads graphics content for this screen.
/// </summary>
public override void UnloadContent()
{
_content.Unload();
}
public override void HandleInput(InputHelper input, GameTime gameTime)
{
if (input.KeyboardState.GetPressedKeys().Length > 0 ||
input.GamePadState.IsButtonDown(Buttons.A | Buttons.Start | Buttons.Back) ||
input.MouseState.LeftButton == ButtonState.Pressed)
{
_duration = TimeSpan.Zero;
}
}
public override void Update(GameTime gameTime, bool otherScreenHasFocus,
bool coveredByOtherScreen)
{
_duration -= gameTime.ElapsedGameTime;
if (_duration <= TimeSpan.Zero)
{
ExitScreen();
}
base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
}
public override void Draw(GameTime gameTime)
{
ScreenManager.GraphicsDevice.Clear(Color.White);
ScreenManager.SpriteBatch.Begin();
ScreenManager.SpriteBatch.Draw(_farseerLogoTexture, _destination, Color.White);
ScreenManager.SpriteBatch.End();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Chief Architect - Sea Surveillance AS.
Specializing in integrated operations and high performance computing solutions.
I’ve been fooling around with computers since the early eighties, I’ve even done work on CP/M and MP/M.
Wrote my first “real” program on a BBC micro model B based on a series in a magazine at that time. It was fun and I got hooked on this thing called programming ...
A few Highlights:
- High performance application server development
- Model Driven Architecture and Code generators
- Real-Time Distributed Solutions
- C, C++, C#, Java, TSQL, PL/SQL, Delphi, ActionScript, Perl, Rexx
- Microsoft SQL Server, Oracle RDBMS, IBM DB2, PostGreSQL
- AMQP, Apache qpid, RabbitMQ, Microsoft Message Queuing, IBM WebSphereMQ, Oracle TuxidoMQ
- Oracle WebLogic, IBM WebSphere
- Corba, COM, DCE, WCF
- AspenTech InfoPlus.21(IP21), OsiSoft PI
More information about what I do for a living can be found at:
harlinn.com or
LinkedIn
You can contact me at
espen@harlinn.no