当前位置: 首页>>代码示例>>C++>>正文


C++ ConVar::SetChangeCallback方法代码示例

本文整理汇总了C++中ConVar::SetChangeCallback方法的典型用法代码示例。如果您正苦于以下问题:C++ ConVar::SetChangeCallback方法的具体用法?C++ ConVar::SetChangeCallback怎么用?C++ ConVar::SetChangeCallback使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConVar的用法示例。


在下文中一共展示了ConVar::SetChangeCallback方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sizeof


//.........这里部分代码省略.........
	if (g_pMaterialManager == NULL) 
	{
		CON(MSG_ERR_FATAL, "Renderer: Can't obtain MaterialManager!");
		return false;
	}
	float ViewportSize[2];
	ViewportSize[0] = 1.0f / float(g_pEngSet.Width);
	ViewportSize[1] = 1.0f / float(g_pEngSet.Height);
	g_pMaterialManager->OnViewportSizeChange (ViewportSize);

	g_pPostProcessMgr = (IP3DPostprocessManager*)I_GetClass(IP3DRENDERER_POSTPROCESSMANAGER);
	if (g_pPostProcessMgr == NULL) 
	{
		CON(MSG_ERR_FATAL, "Renderer: Can't obtain PostProcessManager!");
		return false;
	}

	g_pPhysEngine = (IP3DPhysEngine*)I_GetClass(IP3DPHYS_PHYSENGINE);
	if (g_pPhysEngine == NULL) 
	{
		CON(MSG_ERR_FATAL, "Renderer: Can't obtain Physics Engine Class!");
		return false;
	}

	g_pLightManager = (IP3DLightManager*)I_GetClass(IP3DRENDERER_LIGHTMANAGER);
	if (g_pLightManager == NULL) 
	{
		CON(MSG_ERR_FATAL, "Renderer: Can't obtain DynlightManager!");
		return false;
	}

	if ( !g_TextureLoader.Init() ) 
	{
		CON(MSG_ERR_FATAL, "Renderer: Can't initialize TextureLoader!");
		return false;
	}

	g_pSoundMan = (IP3DSoundManager*)I_GetClass(IP3DSOUND_SOUNDMANAGER);
	if (g_pSoundMan == NULL) 
	{
		CON(MSG_ERR_FATAL, "Renderer: Can't obtain SoundManager!");
		return false;
	}

	SetDefaultRenderStates ();

	// nastavenie sampler states pre potreby shader modelu 3.0
	g_pD3DDevice->SetSamplerState(4, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
	g_pD3DDevice->SetSamplerState(4, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
	g_pD3DDevice->SetSamplerState(4, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR );
	g_pD3DDevice->SetSamplerState(5, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
	g_pD3DDevice->SetSamplerState(5, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
	g_pD3DDevice->SetSamplerState(5, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR );
	g_pD3DDevice->SetSamplerState(6, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
	g_pD3DDevice->SetSamplerState(6, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
	g_pD3DDevice->SetSamplerState(6, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR );
	g_pD3DDevice->SetSamplerState(7, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
	g_pD3DDevice->SetSamplerState(7, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
	g_pD3DDevice->SetSamplerState(7, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR );

	// --- get original parameters
	g_pD3DDevice->GetGammaRamp(0, &m_origGama);

	// get default render target
	if(FAILED(g_pD3DDevice->GetRenderTarget(0, &m_pBackBufferSurf)))

	CON(MSG_CON_INFO, "Renderer: DX9 %d x %d %s initialized!", m_pparams.BackBufferWidth, m_pparams.BackBufferHeight, m_pparams.Windowed ? "windowed" : "fullscreen");
	// nastavit callbacky ConVar-ov
	CVr_wireframe.SetChangeCallback(CV_wireframe);
	CVr_gamma.SetChangeCallback(&CP3DRenderer::CV_SetGamma);

	#ifdef _DEBUG
	g_stats.Init(); // STATS
	#endif

	/////////////////
	tmpVertPosClr myvert[] =
	{
		{P3DXPoint3D(-50,0,0), P3DXPoint3D(1,0,0)},
		{P3DXPoint3D(-50,50,0), P3DXPoint3D(0,1,0)},
		{P3DXPoint3D(50,50,0), P3DXPoint3D(0,0,1)}
	};
	P3DVertexElement ve[3];
	ve[0] = P3DVertexElement(P3DVD_FLOAT3, P3DVU_POSITION);
	ve[1] = P3DVertexElement(P3DVD_FLOAT3, P3DVU_COLOR);
	ve[2] = P3DVE_END();

	vb.CreateVB(3, ve, sizeof(tmpVertPosClr));
	tmpVertPosClr *pv = 0;
	
	vb.Lock((void**)&pv);
		pv[0] = myvert[0];
		pv[1] = myvert[1];
		pv[2] = myvert[2];
	vb.UnLock();
	effect.Create("solid.fx");
	////////////////

	return true;
}
开发者ID:k3a,项目名称:Panther3D-1,代码行数:101,代码来源:renderer.cpp


注:本文中的ConVar::SetChangeCallback方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。