示例#1
0
        public static GraphicsDeviceServiceTestHelper AddRef(IntPtr windowHandle, int width, int height)
        {
            if (Interlocked.Increment(ref _referenceCount) == 1)
            {
                _singletonInstance = new GraphicsDeviceServiceTestHelper(windowHandle, width, height);
            }

            return(_singletonInstance);
        }
        public GraphicsDeviceTestHelper()
        {
            _form = new Form();
            _game = new Game();
            GraphicsDeviceManager = new GraphicsDeviceManager(_game);

            var gds = GraphicsDeviceServiceTestHelper.AddRef(_form.Handle, _form.ClientSize.Width, _form.ClientSize.Height);

            _serviceContainer = new ServiceContainer();
            _serviceContainer.AddService(typeof(IGraphicsDeviceService), gds);

            GraphicsDeviceManager.CreateDevice();
        }