示例#1
0
	void Application::warnAboutIgnoredConfigFile(const QString& filename)
	{
		QString message;
		message += "The file \'" + filename + "\' has been found in the applications working directory.";
		message += "\n\n";
		message += "The '.cfg' extension implies the file may usually be used by Ogre and/or the ExampleApplication framework. ";
		message += "However, the QtOgre framework currently only supports the 'plugins.cfg', 'plugins_d.cfg', and 'resources.cfg' files. ";
		message += "The file will be ignored by the QtOgre framework, and your application may not behave as expected. ";
		message += "\n\n";
		message += "If the file is being used by your application code, or by one of the plugins which you are loading, then you can suppress ";
		message += "this warning dialog box by passing the appropriate flags to the Application constructor. Please consult the documentation.";
		showWarningMessageBox(message);
	}
示例#2
0
	void Application::applySettings(void)
	{
		//Eventually Application settings might be applied here.
		//Until then, we just pass the settings on the the MainWindow and GameLogic
		if(!mOgreWidget->applySettings(mSettingsDialog->mSettings))
		{
			showWarningMessageBox("Unable to apply desired settings to the window.\nPlease consult the system log for details");
		}

		/*if(mGameLogic != 0)
		{
			mGameLogic->applySettings(mSettings);
		}*/
	}
示例#3
0
HRESULT DXManager::initializeDevice(bool fullscreen)
{
	HRESULT hr = S_OK;

	UINT createDeviceFlags = 0;
#ifdef _DEBUG
	createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif
	D3D_FEATURE_LEVEL featureLevel;
	featureLevel = D3D_FEATURE_LEVEL_11_0;
	DXGI_SWAP_CHAIN_DESC sd;
	ZeroMemory(&sd, sizeof(sd));
	sd.BufferCount = 1; 
	sd.BufferDesc.Width = m_ScreenWidth;
	sd.BufferDesc.Height = m_ScreenHeight;
	sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; 
	if (m_vsync_enabled)
	{
		sd.BufferDesc.RefreshRate.Numerator = mNumerator;
		sd.BufferDesc.RefreshRate.Denominator = mDenominator;
	}
	else
	{
		sd.BufferDesc.RefreshRate.Numerator = 0;
		sd.BufferDesc.RefreshRate.Denominator = 1;
	}
	sd.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
	sd.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
	sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; 
	sd.OutputWindow = mHWnd; 
	sd.SampleDesc.Count = mMuntisampleCount; 
	sd.SampleDesc.Quality = 0;
	if (fullscreen)
	{
		sd.Windowed = false;
	}
	else
	{
		sd.Windowed = true;
	}
	sd.Flags = 0;
	sd.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;

	D3D_DRIVER_TYPE driverTypes[] =
	{
		D3D_DRIVER_TYPE_HARDWARE,
		D3D_DRIVER_TYPE_REFERENCE,
		D3D_DRIVER_TYPE_SOFTWARE,
	};
	UINT numDriverTypes = sizeof(driverTypes) / sizeof(driverTypes[0]);

	for (UINT driverTypeIndex = 0; driverTypeIndex < numDriverTypes; ++driverTypeIndex)
	{
		mDriverType = driverTypes[driverTypeIndex];
		hr = D3D11CreateDeviceAndSwapChain(nullptr, mDriverType, nullptr, createDeviceFlags, &featureLevel, 1,
			D3D11_SDK_VERSION, &sd, &mPSwapChain, &mPd3dDevice, nullptr, &mPd3dDeviceContext);
		if (SUCCEEDED(hr))
		{
			if (mDriverType != D3D_DRIVER_TYPE_HARDWARE)
				showWarningMessageBox(L"No hardware Direct3D here.", L"Warning", mHWnd);
			break;
		}
	}
	if (FAILED(hr))
	{
		showErrorMessageBox(L"Device and swap chain creation failed!", L"Error", mHWnd);
		return hr;
	}

	return S_OK;
}