Пример #1
0
        private void InitializeGFX(IGraphicsDeviceService graphics)
        {
            services = new GameServiceContainer();
            services.AddService <IGraphicsDeviceService>(graphics);
            this.graphics = graphics.GraphicsDevice;

            Content     = new ContentManager(services, "Content");
            spriteBatch = new SpriteBatch(graphics.GraphicsDevice);

            Pixel = new Texture2D(graphics.GraphicsDevice, 1, 1);
            Pixel.SetData(new[] { Color.White });

            Format = new System.Globalization.NumberFormatInfo();
            Format.CurrencyDecimalSeparator = ".";

            Cam          = new Camera2D();
            Cam.Position = new Vector2(
                graphics.GraphicsDevice.Viewport.Width / 2, graphics.GraphicsDevice.Viewport.Height / 2);
#if DX
            InternContent = new ResourceContentManager(services, DX.Properties.Resources.ResourceManager);

            GetRenderTargetManager  = new RenderTargetManager(this);
            AntialisingRenderTarget = GetRenderTargetManager.CreateNewRenderTarget2D("MSAA", true);

            RenderTargetTimer          = new Timer();
            RenderTargetTimer.Interval = 500;
            RenderTargetTimer.Elapsed += (sender, e) => OnRenderTargetTimeOutEnd();
#elif GL
            InternContent = new ResourceContentManager(services, GL.Properties.Resources.ResourceManager);
#endif
            Font       = InternContent.Load <SpriteFont>("Font");
            FontHeight = Font.MeasureString("A").Y;

            FrameworkDispatcher.Update();
        }