Пример #1
0
        private void TryInitializeXna()
        {
            RegisterCommonEngineSingletons();
            game   = new XnaGame(this);
            window = new XnaWindow(game);
            window.ViewportPixelSize = settings.Resolution;
            RegisterInstance(window);
            RegisterSingleton <WindowsSystemInformation>();
            var device = new XnaDevice(game, window, settings);

            RegisterInstance(device);
            RegisterSingleton <Drawing>();
            RegisterSingleton <BatchRenderer2D>();
            RegisterSingleton <BatchRenderer3D>();
            game.StartXnaGameToInitializeGraphics();
            RegisterInstance(game);
            RegisterInstance(game.Content);
            RegisterSingleton <XnaSoundDevice>();
            RegisterSingleton <XnaScreenshotCapturer>();
            RegisterSingleton <XnaMouse>();
            RegisterSingleton <XnaKeyboard>();
            RegisterSingleton <XnaTouch>();
            RegisterSingleton <XnaGamePad>();
            Register <InputCommands>();
            if (IsAlreadyInitialized)
            {
                throw new UnableToRegisterMoreTypesAppAlreadyStarted();
            }
        }
Пример #2
0
 public XnaVideo(string filename, XnaMedia.VideoPlayer player, XnaDevice graphicsDevice,
                 SoundDevice soundDevice)
     : base(filename, soundDevice)
 {
     this.player         = player;
     this.graphicsDevice = graphicsDevice;
     image = new VideoImage(graphicsDevice);
 }