示例#1
0
        internal GameDeviceContext(AppContext context) 
		{
			SwapChain defaultSwapChain;

			SlimDX.Direct3D11.Device.CreateWithSwapChain(SlimDX.Direct3D11.DriverType.Hardware, GameConfiguration.CreationFlags, context[0].SwapChainDescription, out m_Device, out defaultSwapChain);
			
			m_Factory = m_Device.Factory;

			int numberOfAdditionalWindows = m_Factory.GetAdapter(GameConfiguration.AdapterOrdinal).GetOutputCount() - 1;

			if (numberOfAdditionalWindows > 0)
			{
				context.CreateAdditionalForms(numberOfAdditionalWindows);
			}

			context[0].SwapChain = defaultSwapChain; 

			m_Factory.SetWindowAssociation(context[0].Form.Handle, WindowAssociationFlags.IgnoreAll | WindowAssociationFlags.IgnoreAltEnter);
			
			for (int i = 1; i < context.Count; i++)
			{				
				context[i].SwapChain = new SlimDX.DXGI.SwapChain(m_Factory, m_Device, context[i].SwapChainDescription);

				m_Device.Factory.SetWindowAssociation(context[i].Form.Handle, WindowAssociationFlags.IgnoreAll | WindowAssociationFlags.IgnoreAltEnter);
			}

			for (int i = 0; i < context.Count; i++)
			{
				context[i].Form.Location = m_Factory.GetAdapter(GameConfiguration.AdapterOrdinal).GetOutput(i).Description.DesktopBounds.Location; 
			}
        }