예제 #1
0
GGInput::GGInput( const GGWindow& _window )
{
	RAWINPUTDEVICE mouse;
	mouse.usUsagePage = 0x01;
	mouse.usUsage = 0x02;
	mouse.dwFlags = RIDEV_CAPTUREMOUSE | RIDEV_NOLEGACY;
	mouse.hwndTarget = _window.GetHandle();

	if( !RegisterRawInputDevices( &mouse, 1, sizeof( mouse ) ) )
	{
		GG_THROW;
	}
}
예제 #2
0
GGDirectXDriver::GGDirectXDriver( const GGWindow& _window, UINT _resX, UINT _resY )
	:
	m_resX( _resX ),
	m_resY( _resY )
{
	UINT createDeviceFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
#ifdef _DEBUG
	createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif

	D3D_FEATURE_LEVEL featureLevels[] =
	{
		D3D_FEATURE_LEVEL_11_0
	};
	UINT numFeatureLevels = ARRAYSIZE( featureLevels );

	DXGI_SWAP_CHAIN_DESC sd;
	ZeroMemory( &sd, sizeof( sd ) );
	sd.BufferCount = 1;
	sd.BufferDesc.Width = _resX;
	sd.BufferDesc.Height = _resY;
	sd.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
	sd.BufferDesc.RefreshRate.Numerator = 60;
	sd.BufferDesc.RefreshRate.Denominator = 1;
	sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
	sd.OutputWindow = _window.GetHandle();
	sd.SampleDesc.Count = 1;
	sd.SampleDesc.Quality = 0;
	sd.Windowed = TRUE;

	HRESULT hr = D3D11CreateDeviceAndSwapChain( nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, createDeviceFlags, featureLevels, numFeatureLevels, D3D11_SDK_VERSION, &sd, m_swapChain.GetAddressOf(), m_device.GetAddressOf(), nullptr, m_deviceContext.GetAddressOf() );
	if( FAILED( hr ) )
	{
		GG_THROW;
	}

	hr = D2D1CreateFactory( D2D1_FACTORY_TYPE_SINGLE_THREADED, static_cast<ID2D1Factory**>(m_factory2d.GetAddressOf()) );
	if( FAILED( hr ) )
	{
		GG_THROW;
	}
}