Beispiel #1
0
        // Performs initialization of the XNA types required for the application.
        private void InitializeXnaApplication()
        {
            // Create the service provider
            Services = new AppServiceProvider();

            // Add the SharedGraphicsDeviceManager to the Services as the IGraphicsDeviceService for the app
            foreach (object obj in ApplicationLifetimeObjects)
            {
                if (obj is IGraphicsDeviceService)
                {
                    Services.AddService(typeof(IGraphicsDeviceService), obj);
                }
            }

            // Create the ContentManager so the application can load precompiled assets
            Content = new ContentManager(Services, "Content");

            // Create a GameTimer to pump the XNA FrameworkDispatcher
            FrameworkDispatcherTimer              = new GameTimer();
            FrameworkDispatcherTimer.FrameAction += FrameworkDispatcherFrameAction;
            FrameworkDispatcherTimer.Start();
        }
Beispiel #2
0
        // Выполняет инициализацию типов XNA, необходимых для приложения.
        private void InitializeXnaApplication()
        {
            // Создание поставщика услуг
            Services = new AppServiceProvider();

            // Добавить SharedGraphicsDeviceManager к службам в качестве IGraphicsDeviceService для приложения
            foreach (object obj in ApplicationLifetimeObjects)
            {
                if (obj is IGraphicsDeviceService)
                {
                    Services.AddService(typeof(IGraphicsDeviceService), obj);
                }
            }

            // Создайте ContentManager для загрузки в приложение предварительно скомпилированных ресурсов
            Content = new ContentManager(Services, "Content");

            // Создайте GameTimer для получения XNA FrameworkDispatcher
            FrameworkDispatcherTimer              = new GameTimer();
            FrameworkDispatcherTimer.FrameAction += FrameworkDispatcherFrameAction;
            FrameworkDispatcherTimer.Start();
        }