Beispiel #1
0
 /// <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;
 }
Beispiel #2
0
        /// <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;
        }
Beispiel #3
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (XnaGame game = new XnaGame())
     {
         game.Run();
     }
 }
Beispiel #4
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (var game = new XnaGame())
     {
         game.Run();
     }
 }
Beispiel #5
0
 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;
 }
Beispiel #6
0
        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;
        }
Beispiel #7
0
        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
            };
        }
Beispiel #8
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="game"></param>
 public PostProcess(XnaGame game, InitializeDelegate initializer)
 {
     this._game       = game;
     this.Initializer = initializer;
 }
Beispiel #9
0
 /// <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;
 }
Beispiel #10
0
 public GameStateManager(XnaGame xnaGame)
 {
     CurrentGame = xnaGame;
     _gameStates = new Stack <GameState>();
 }
Beispiel #11
0
 /// <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;
 }
Beispiel #12
0
        public void Exit()
        {
#if !PLATFORM_IOS
            XnaGame.Exit();
#endif
        }
Beispiel #13
0
 public void Run()
 {
     XnaGame.Run();
 }
Beispiel #14
0
 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;
 }
Beispiel #17
0
 /// <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)
 {
 }
Beispiel #19
0
 /// <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)
 {
 }
Beispiel #20
0
 /// <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;
 }