mirror of
https://github.com/digital-jellyfish/Virtu.git
synced 2024-05-31 15:41:33 +00:00
365e5723c1
--HG-- extra : convert_revision : svn%3Affd33b8c-2492-42e0-bdc5-587b920b7d6d/trunk%4050811
51 lines
1.5 KiB
C#
51 lines
1.5 KiB
C#
using System;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using Microsoft.Xna.Framework.Input;
|
|
|
|
namespace Jellyfish.Library
|
|
{
|
|
public class GameBase : Game
|
|
{
|
|
public GameBase() :
|
|
this(null)
|
|
{
|
|
}
|
|
|
|
public GameBase(string name)
|
|
{
|
|
Name = name;
|
|
|
|
Content.RootDirectory = "Content";
|
|
GraphicsDeviceManager = new GraphicsDeviceManager(this);
|
|
#if WINDOWS_PHONE
|
|
GraphicsDeviceManager.IsFullScreen = true;
|
|
TargetElapsedTime = TimeSpan.FromTicks(333333); // 30 fps
|
|
#endif
|
|
GraphicsDeviceService = (IGraphicsDeviceService)Services.GetService(typeof(IGraphicsDeviceService));
|
|
|
|
if (!string.IsNullOrEmpty(Name))
|
|
{
|
|
Window.Title = Name;
|
|
}
|
|
}
|
|
|
|
[SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase")]
|
|
protected override void Update(GameTime gameTime)
|
|
{
|
|
var gamePadState = GamePad.GetState(PlayerIndex.One);
|
|
if (gamePadState.Buttons.Back == ButtonState.Pressed)
|
|
{
|
|
Exit();
|
|
}
|
|
|
|
base.Update(gameTime);
|
|
}
|
|
|
|
public string Name { get; private set; }
|
|
public GraphicsDeviceManager GraphicsDeviceManager { get; private set; }
|
|
public IGraphicsDeviceService GraphicsDeviceService { get; private set; }
|
|
}
|
|
}
|