/// <summary> /// Public constructor. /// </summary> public StarSystemScreen(XnaGame game) { m_game = game; m_debug = new Debug(m_game); m_content = m_game.Content; m_graphics = m_game.GraphicsDevice; }
/// <summary> /// Create the ThreadPoolComponent in your application constructor, and add it /// to your Components collection. The ThreadPool will deliver any completed /// tasks first in the update order. /// /// On Xbox, creates 3 threads. On PC, creates one or more threads, depending /// on the number of CPU cores. Always creates at least one thread. The thread /// tasks are assumed to be computationally expensive, so more threads than /// there are CPU cores is not recommended. /// </summary> /// <param name="game">Your game instance.</param> public ThreadPoolComponent(XnaGame game) : base(game) { #if XBOX360 var hardwareThread = new [] { 3, 4, 5 }; _nThreads = hardwareThread.Length; var threadNames = new string[_nThreads]; for (int i = 0; i < _nThreads; i++) { threadNames[i] = ((ThreadTarget)i).ToString(); } #else _nThreads = Environment.ProcessorCount; var hardwareThread = new int[_nThreads]; var threadNames = new string[_nThreads]; for (int i = 0; i < _nThreads; i++) { threadNames[i] = "Thread" + i; } #endif //hoaky but reasonable way of getting the number of processors in .NET _wrappers = new ThreadPoolWrapper[_nThreads]; for (int i = 0; i != _nThreads; ++i) { _wrappers[i] = new ThreadPoolWrapper(threadNames[i], hardwareThread[i]); } UpdateOrder = Int32.MinValue; }
/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { using (XnaGame game = new XnaGame()) { game.Run(); } }
/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { using (var game = new XnaGame()) { game.Run(); } }
internal Window(App.Config appConfig, XnaGame xnaGame) { XnaGame = xnaGame; AllowResize = appConfig.WindowConfig.AllowResize; ShowCursor = appConfig.WindowConfig.ShowCursor; size = appConfig.WindowConfig.WindowSize; xnaGame.Window.ClientSizeChanged += Window_ClientSizeChanged; }
public void Run(Space firstSpace) { if (SS != null) { throw new Exception("Only one App can run at a time"); } using (var game = new XnaGame(this, config)) using (SS = game.InitializeSubsystems()) { NextSpace = firstSpace; game.Run(); } SS = null; }
internal Renderer(Config config, XnaGame gameImpl) { graphicsDevice = gameImpl.GraphicsDevice; graphicsDeviceManager = gameImpl.Graphics; // initial values for vsync and resolution are set in XnaGame ClearColor = config.ClearColor; spriteBatch = new SpriteBatch(graphicsDevice); pixel = new Texture2D(gameImpl.GraphicsDevice, 1, 1); pixel.SetData(new[] { Color.White }); renderContext = new RenderContext() { Pixel = pixel }; }
/// <summary> /// /// </summary> /// <param name="game"></param> public PostProcess(XnaGame game, InitializeDelegate initializer) { this._game = game; this.Initializer = initializer; }
/// <summary> /// Initialises a new instance of a <see cref="BarrelDistortionProcessor">BarrelDistortionProcessor</see>. /// </summary> /// <param name="game">A reference to the game.</param> public BarrelDistortionProcessor(XnaGame game) : base(game) { CrtStrength = 0.15f; Bulge = 0.95f; }
public GameStateManager(XnaGame xnaGame) { CurrentGame = xnaGame; _gameStates = new Stack <GameState>(); }
/// <summary> /// Initialises a new instance of a <see cref="BaseProcessor">PostProcessEffect</see>. /// </summary> /// <param name="game">A reference to the game.</param> protected BaseProcessor(XnaGame game) { this.Game = game; }
public void Exit() { #if !PLATFORM_IOS XnaGame.Exit(); #endif }
public void Run() { XnaGame.Run(); }
public override void Dispose() { XnaGame.Dispose(); }
public void Stop() { xnaGame.Dispose(); xnaGame = null; }
public void Start(IApi platformImplementation, Action update, Action render) { xnaGame = new XnaGame(update, render); xnaGame.Run(); Graphics.BlendState = Microsoft.Xna.Framework.Graphics.BlendState.Opaque; Graphics.DepthStencilState = Microsoft.Xna.Framework.Graphics.DepthStencilState.Default; Graphics.RasterizerState = Microsoft.Xna.Framework.Graphics.RasterizerState.CullNone; }
/// <summary> /// The main entry point for the application. /// </summary> private static void Main(string[] args) { using (var game = new XnaGame()) { game.Run(); } }
/// <summary> /// Initialises a new instance of a <see cref="ScanlinesProcessor">ScanlinesProcessor</see>. /// </summary> /// <param name="game">A reference to the game.</param> public ScanlinesProcessor(XnaGame game) : base(game) { }
/// <summary> /// Initialises a new instance of a <see cref="BloomProcessor">BloomProcessor</see>. /// </summary> /// <param name="game">A reference to the game.</param> public BloomProcessor(XnaGame game) : base(game) { }
/// <summary> /// Creates a new instance of the Debug class. /// </summary> /// <param name="game">The Game instance.</param> public Debug(XnaGame game) { m_content = game.Content; m_graphics = game.GraphicsDevice; }