// Project: Rocket Commander, File: Credits.cs
// Namespace: XnaGraphicEngine.GameScreens, Class: Credits
// Path: C:\code\XnaGraphicEngine\GameScreens, Author: Abi
// Code lines: 46, Size of file: 857 Bytes
// Creation date: 23.11.2005 18:37
// Last modified: 12.12.2005 05:30
// Generated with Commenter by abi.exDream.com
#region Using directives
using System;
using System.Collections.Generic;
using System.Text;
using XnaGraphicEngine.Graphics;
using XnaGraphicEngine.Game;
using XnaGraphicEngine.Properties;
using XnaGraphicEngine.Helpers;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.Threading;
using System.Diagnostics;
#endregion
namespace XnaGraphicEngine.GameScreens
{
///
/// Credits
///
class Credits : IGameScreen
{
#region Properties
///
/// Name of this game screen
///
/// String
public string Name
{
get
{
return "Credits";
} // get
} // Name
private bool quit = false;
///
/// Returns true if we want to quit this screen and return to the
/// previous screen. If no more screens are left the game is exited.
///
/// Bool
public bool Quit
{
get
{
return quit;
} // get
} // Quit
#endregion
#region Constructor
///
/// Create credits
///
public Credits()
{
} // Credits()
#endregion
#region Write credits
///
/// Write credits
///
/// X coordinate
/// Y coordinate
/// Left text
/// Right text
private void WriteCredits(int xPos, int yPos,
string leftText, string rightText)
{
TextureFont.WriteText(xPos, yPos, leftText);
TextureFont.WriteText(xPos + 440, yPos/* + 8*/, rightText);
} // WriteCredits(xPos, yPos, leftText)
///
/// Write credits with link
///
/// X coordinate
/// Y coordinate
/// Left text
/// Right text
/// Link text
private void WriteCreditsWithLink(int xPos, int yPos, string leftText,
string rightText, string linkText, YourGame game)
{
WriteCredits(xPos, yPos, leftText, rightText);
// Process link (put below rightText)
bool overLink = Input.MouseInBox(new Rectangle(
xPos + 440, yPos + 8 + TextureFont.Height, 200, TextureFont.Height));
TextureFont.WriteText(xPos + 440, yPos /*+ 8*/ + TextureFont.Height, linkText,
overLink ? Color.Red : Color.White);
if (overLink &&
Input.MouseLeftButtonJustPressed)
{
#if !XBOX360
Process.Start(linkText);
Thread.Sleep(100);
#endif
} // if
} // WriteCreditsWithLink(xPos, yPos, leftText)
#endregion
#region Run
///
/// Run game screen. Called each frame.
///
/// Form for access to asteroid manager and co
public void Run(YourGame game)
{
// Render background
game.RenderMenuBackground();
// Credits
int xPos = 50 * BaseGame.Width / 1024;
int yPos = 260 * BaseGame.Height / 768;
TextureFont.WriteText(xPos, yPos, "Credits");
WriteCreditsWithLink(xPos, yPos+56, "Idea, Design, Programming",
"Benjamin Nitschke (abi)",
"http://abi.exdream.com", game);
WriteCredits(xPos, yPos + 137, "Thanks fly out to",
"Leif Griga, Christoph Rienaecker,");
WriteCredits(xPos, yPos + 177, "",
"Boje Holtz, Enrico Cieslik (Judge),");
WriteCredits(xPos, yPos + 217, "",
"ZMan (www.thezbuffer.com),");
WriteCredits(xPos, yPos + 257, "",
"Dirk Primbs and Christina Storm");
WriteCredits(xPos, yPos + 297, "",
"of Microsoft and and the ");
WriteCredits(xPos, yPos + 337, "",
"XNA and .NET Teams at Microsoft :)");
TextureFont.WriteText(BaseGame.XToRes(150), BaseGame.YToRes(687),
"Dedicated to the great XNA Framework.");
if (game.RenderMenuButton(MenuButton.Back,
new Point(1024 - 230, 768 - 150)) ||
Input.KeyboardEscapeJustPressed ||
Input.GamePadBackJustPressed)
{
quit = true;
} // if
} // Run(game)
#endregion
} // class Credits
} // namespace XnaGraphicEngine.GameScreens