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


C++ CVar::GetBool方法代码示例

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


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

示例1: ExecuteSingleCmd

/*
================
CmdSystemEx::ExecuteSingleCmd
================
*/
void CmdSystemEx::ExecuteSingleCmd( const char *cmd ) {
	CmdArgs args(cmd);
	if ( !args.Argc() )
		return;

	const char *arg0 = args.Argv(0);
	int index = cmdList.Find( arg0 );
	if ( index != -1 ) {
		ConsoleCmd &cCmd = cmdList[index];
		if( cCmd.flags & CMD_DEVELOPER && !com_developer.GetBool() ) {
			User::Warning( "Developer mode is not active!" );
			return;
		}
		if( cCmd.flags & CMD_CHEAT && !net_allowCheats.GetBool() ) {
			User::Warning( Format( "$* is cheat protected" ) << cmdList.GetKey(index) );
			return;
		}
		if ( cCmd.usage->minArguments > (args.Argc()-1) )
			cCmd.usage->ShowUsage();
		else
			cCmd.func(args);
		return;
	}
	if ( !cvarSystemEx->OnCommand(args) )
		User::Warning( Format( "Unknown command '$*'.\n" ) << arg0 );
}
开发者ID:ensiform,项目名称:open-game-libraries,代码行数:31,代码来源:CmdSystemEx.cpp

示例2: Think

void CCamera::Think()
{
	bool bFreeMode = cam_free.GetBool();
	if (bFreeMode != m_bFreeMode)
	{
		m_vecFreeCamera = GetCameraPosition();
		m_angFreeCamera = VectorAngles((GetCameraTarget() - GetCameraPosition()).Normalized());
		m_bFreeMode = bFreeMode;
		CApplication::Get()->SetMouseCursorEnabled(!m_bFreeMode);
	}

	if (m_bFreeMode)
	{
		Vector vecForward, vecRight;
		AngleVectors(m_angFreeCamera, &vecForward, &vecRight, NULL);

		m_vecFreeCamera += vecForward * m_vecFreeVelocity.x * GameServer()->GetFrameTime() * 20;
		m_vecFreeCamera -= vecRight * m_vecFreeVelocity.z * GameServer()->GetFrameTime() * 20;
	}
	else
	{
		if (shrink_frustum.GetBool())
			GameServer()->GetRenderer()->FrustumOverride(GetCameraPosition(), GetCameraTarget(), GetCameraFOV()-1, GetCameraNear()+1, GetCameraFar()-1);
	}
}
开发者ID:dfk789,项目名称:CodenameInfinite,代码行数:25,代码来源:camera.cpp

示例3: r

void CTreeNode::CExpandButton::Paint(float x, float y, float w, float h)
{
	MakeQuad();

	::CRenderingContext r(nullptr, true);

	if ((w < 0) ^ (h < 0))
		r.SetBackCulling(false);

	r.UseMaterial(m_hMaterial);

	r.SetBlend(BLEND_ALPHA);
	r.SetUniform("iBorder", 0);
	r.SetUniform("bHighlight", false);
	r.SetUniform("vecColor", Color(255, 255, 255));
	r.SetUniform("bDiffuse", true);
	r.SetUniform("bTexCoords", false);

	r.SetUniform("vecDimensions", Vector4D(-w/2, -h/2, w, h));

	r.Translate(Vector((float)x+w/2, (float)y+h/2, 0));
	r.Rotate(m_flExpandedCurrent*90-90, Vector(0, 0, 1));

	// Hehe.
	if (glgui_spinnyarrows.GetBool())
		r.Rotate((float)RootPanel()->GetTime()*200, Vector(0, 0, 1));

	r.BeginRenderVertexArray(s_iQuad);
	r.SetPositionBuffer((size_t)0u, 24);
	r.SetTexCoordBuffer(12, 24);
	r.SetCustomIntBuffer("iVertex", 1, 20, 24);
	r.EndRenderVertexArray(6);
}
开发者ID:BSVino,项目名称:SMAK,代码行数:33,代码来源:tree.cpp

示例4: KeyDown

void CCamera::KeyDown(int c)
{
	if (CVar::GetCVarBool("cheats") && c == 'Z')
	{
		cam_free.SetValue(m_bFreeMode?_T("off"):_T("on"));

		if (lock_freemode_frustum.GetBool())
		{
			if (m_bFreeMode)
				GameServer()->GetRenderer()->FrustumOverride(GetCameraPosition(), GetCameraTarget(), GetCameraFOV(), GetCameraNear(), GetCameraFar());
			else
				GameServer()->GetRenderer()->CancelFrustumOverride();
		}
	}

	if (m_bFreeMode)
	{
		if (c == 'W')
			m_vecFreeVelocity.x = 10.0f;
		if (c == 'S')
			m_vecFreeVelocity.x = -10.0f;
		if (c == 'D')
			m_vecFreeVelocity.z = 10.0f;
		if (c == 'A')
			m_vecFreeVelocity.z = -10.0f;
	}
}
开发者ID:dfk789,项目名称:CodenameInfinite,代码行数:27,代码来源:camera.cpp

示例5: IsVisible

bool CConsole::IsVisible()
{
	if (developer.GetBool() && m_bBackground)
		return true;

	return BaseClass::IsVisible();
}
开发者ID:BSVino,项目名称:LunarWorkshop,代码行数:7,代码来源:console.cpp

示例6: Instructor_LessonLearned

void CPlayer::Instructor_LessonLearned(const tstring& sLesson)
{
    if (!GameWindow()->GetInstructor()->IsInitialized())
        GameWindow()->GetInstructor()->Initialize();

    auto it = m_apLessonProgress.find(sLesson);
    TAssert(it != m_apLessonProgress.end());
    if (it == m_apLessonProgress.end())
        return;

    CLessonProgress* pLessonProgress = &it->second;

    TAssert(pLessonProgress);
    if (!pLessonProgress)
        return;

    // Can only learn a lesson once in a while, to ensure that it is truly learned.
    // The idea is that the player spends a couple seconds toying around with the
    // new feature, but won't spend all of the lessons in that time.
    if (GameServer()->GetGameTime() < pLessonProgress->m_flLastTimeLearned + lesson_learntime.GetFloat())
        return;

    pLessonProgress->m_flLastTimeLearned = GameServer()->GetGameTime();
    pLessonProgress->m_iTimesLearned++;

    if (lesson_debug.GetBool())
    {
        CLesson* pLesson = GameWindow()->GetInstructor()->GetLesson(sLesson);

        if (pLessonProgress->m_iTimesLearned < pLesson->m_iTimesToLearn)
            TMsg(tsprintf("Instructor: Trained lesson " + sLesson + " - %d/%d\n", pLessonProgress->m_iTimesLearned, pLesson->m_iTimesToLearn));
        else if (pLessonProgress->m_iTimesLearned == pLesson->m_iTimesToLearn)
            TMsg("Instructor: Learned lesson " + sLesson + "\n");
    }
}
开发者ID:BSVino,项目名称:Digitanks,代码行数:35,代码来源:instructor.cpp

示例7: IsCursorListener

bool CConsole::IsCursorListener()
{
	// Don't interfere with mouse events, we're just showing an overlay.
	if (developer.GetBool() && !BaseClass::IsVisible())
		return false;

	return BaseClass::IsCursorListener();
}
开发者ID:BSVino,项目名称:LunarWorkshop,代码行数:8,代码来源:console.cpp

示例8: GetCVarBool

bool CVar::GetCVarBool(tstring sName)
{
	CVar* pVar = FindCVar(sName);
	if (!pVar)
		return false;

	return pVar->GetBool();
}
开发者ID:BSVino,项目名称:CodenameInfinite,代码行数:8,代码来源:cvar.cpp

示例9: GetConsole

CConsole* CApplication::GetConsole()
{
	if (m_pConsole == NULL)
	{
		m_pConsole = new CConsole();

		if (developer.GetBool())
			TMsg("Developer mode ON.\n");
	}

	return m_pConsole;
}
开发者ID:BSVino,项目名称:LunarWorkshop,代码行数:12,代码来源:console.cpp

示例10: GLDebugCallback

void CALLBACK GLDebugCallback(GLenum iSource, GLenum iType, GLuint id, GLenum iSeverity, GLsizei iLength, const GLchar* pszMessage, GLvoid* pUserParam)
{
	if (iType != GL_DEBUG_TYPE_PERFORMANCE_ARB)
	{
		TAssert(iSeverity != GL_DEBUG_SEVERITY_HIGH_ARB);
		TAssert(iSeverity != GL_DEBUG_SEVERITY_MEDIUM_ARB);
	}

	if (gl_debug.GetBool())
	{
		tstring sMessage = "OpenGL Debug Message (";

		if (iSource == GL_DEBUG_SOURCE_API_ARB)
			sMessage += "Source: API ";
		else if (iSource == GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB)
			sMessage += "Source: Window System ";
		else if (iSource == GL_DEBUG_SOURCE_SHADER_COMPILER_ARB)
			sMessage += "Source: Shader Compiler ";
		else if (iSource == GL_DEBUG_SOURCE_THIRD_PARTY_ARB)
			sMessage += "Source: Third Party ";
		else if (iSource == GL_DEBUG_SOURCE_APPLICATION_ARB)
			sMessage += "Source: Application ";
		else if (iSource == GL_DEBUG_SOURCE_OTHER_ARB)
			sMessage += "Source: Other ";

		if (iType == GL_DEBUG_TYPE_ERROR_ARB)
			sMessage += "Type: Error ";
		else if (iType == GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB)
			sMessage += "Type: Deprecated Behavior ";
		else if (iType == GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB)
			sMessage += "Type: Undefined Behavior ";
		else if (iType == GL_DEBUG_TYPE_PORTABILITY_ARB)
			sMessage += "Type: Portability ";
		else if (iType == GL_DEBUG_TYPE_PERFORMANCE_ARB)
			sMessage += "Type: Performance ";
		else if (iType == GL_DEBUG_TYPE_OTHER_ARB)
			sMessage += "Type: Other ";

		if (iSeverity == GL_DEBUG_SEVERITY_HIGH_ARB)
			sMessage += "Severity: High) ";
		else if (iSeverity == GL_DEBUG_SEVERITY_MEDIUM_ARB)
			sMessage += "Severity: Medium) ";
		else if (iSeverity == GL_DEBUG_SEVERITY_LOW_ARB)
			sMessage += "Severity: Low) ";

		sMessage += convertstring<GLchar, tchar>(pszMessage) + "\n";

		TMsg(convertstring<GLchar, tchar>(sMessage).c_str());
	}
}
开发者ID:BSVino,项目名称:CodenameInfinite,代码行数:50,代码来源:application.cpp

示例11: Render

void CParticleSystemLibrary::Render()
{
	TPROF("CParticleSystemLibrary::Render");

	if (!r_particles.GetBool())
		return;

	MakeQuad();

	CParticleSystemLibrary* pPSL = Get();

	if (!pPSL->m_apInstances.size())
		return;

	tmap<size_t, CSystemInstance*>::iterator it;

	if (true)
	{
		CGameRenderingContext c(GameServer()->GetRenderer(), true);
		c.UseProgram("particle");
		c.SetUniform("bDiffuse", true);
		c.SetUniform("iDiffuse", 0);

		for (it = pPSL->m_apInstances.begin(); it != pPSL->m_apInstances.end(); it++)
		{
			CSystemInstance* pInstance = (*it).second;
			pInstance->Render(&c, false);
		}
	}

	if (true)
	{
		CGameRenderingContext c(GameServer()->GetRenderer(), true);
		c.UseProgram("particle");
		c.SetUniform("bDiffuse", true);
		c.SetUniform("iDiffuse", 0);
		c.SetDepthMask(false);

		for (it = pPSL->m_apInstances.begin(); it != pPSL->m_apInstances.end(); it++)
		{
			CSystemInstance* pInstance = (*it).second;
			pInstance->Render(&c, true);
		}
	}

	CRenderingContext::DebugFinish();
}
开发者ID:BSVino,项目名称:Digitanks,代码行数:47,代码来源:particles.cpp

示例12: Paint

void CConsole::Paint(float x, float y, float w, float h)
{
	if (!CApplication::Get()->IsOpen())
		return;

	if (!BaseClass::IsVisible() && developer.GetBool())
	{
		int iAlpha = m_hOutput->GetAlpha();
		m_hOutput->SetAlpha(100);
		m_hOutput->Paint();
		m_hOutput->SetAlpha(iAlpha);
		return;
	}

	if (!BaseClass::IsVisible())
		return;

	glgui::CRootPanel::PaintRect(x, y, w, h, Color(0, 0, 0, 200), 1, true);

	BaseClass::Paint(x, y, w, h);
}
开发者ID:BSVino,项目名称:LunarWorkshop,代码行数:21,代码来源:console.cpp

示例13: DisplayLesson

void CInstructor::DisplayLesson(tstring sLesson)
{
    if (!lesson_enable.GetBool())
        return;

    if (!m_bActive)
        return;

    if (sLesson.length() == 0 || m_apLessons.find(sLesson) == m_apLessons.end())
    {
        if (m_apLessons[m_sCurrentLesson] && m_apLessons[m_sCurrentLesson]->m_bKillOnFinish)
            SetActive(false);

        if (m_pCurrentPanel)
            HideLesson();

        return;
    }

    if (m_pCurrentPanel)
        HideLesson();

    m_sCurrentLesson = sLesson;

    if (Game() && m_sLastLesson != m_sCurrentLesson)
        Game()->OnDisplayLesson(sLesson);

    m_sLastLesson = m_sCurrentLesson;

    CLesson* pLesson = m_apLessons[sLesson];

    CPlayer *pLocalPlayer = Game()->GetLocalPlayer();
    if (pLesson->m_iLearningMethod == CLesson::LEARN_DISPLAYING)
        pLocalPlayer->Instructor_LessonLearned(sLesson);

    m_pCurrentPanel = new CLessonPanel(pLesson);
    RootPanel()->AddControl(m_pCurrentPanel, true);

    CallOutput("OnDisplay");
}
开发者ID:BSVino,项目名称:Digitanks,代码行数:40,代码来源:instructor.cpp

示例14: EndRenderVertexArrayIndexed

void CRenderingContext::EndRenderVertexArrayIndexed(size_t iBuffer, size_t iVertices)
{
	CRenderContext& oContext = GetContext();

	if (!oContext.m_bProjectionUpdated)
		SetUniform("mProjection", oContext.m_mProjection);

	if (!oContext.m_bViewUpdated)
		SetUniform("mView", oContext.m_mView);

	if (!oContext.m_bTransformUpdated)
		SetUniform("mGlobal", oContext.m_mTransformations);

	oContext.m_bProjectionUpdated = oContext.m_bViewUpdated = oContext.m_bTransformUpdated = true;

	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, iBuffer);
	glDrawElements(r_wireframe.GetBool()?GL_LINES:GL_TRIANGLES, iVertices, GL_UNSIGNED_INT, nullptr);

	glDisableVertexAttribArray(m_pShader->m_iPositionAttribute);
	for (size_t i = 0; i < MAX_TEXTURE_CHANNELS; i++)
	{
		if (m_pShader->m_aiTexCoordAttributes[i] != ~0)
			glDisableVertexAttribArray(m_pShader->m_aiTexCoordAttributes[i]);
	}
	if (m_pShader->m_iNormalAttribute != ~0)
		glDisableVertexAttribArray(m_pShader->m_iNormalAttribute);
	if (m_pShader->m_iTangentAttribute != ~0)
		glDisableVertexAttribArray(m_pShader->m_iTangentAttribute);
	if (m_pShader->m_iBitangentAttribute != ~0)
		glDisableVertexAttribArray(m_pShader->m_iBitangentAttribute);
	if (m_pShader->m_iColorAttribute != ~0)
		glDisableVertexAttribArray(m_pShader->m_iColorAttribute);

	glBindBuffer(GL_ARRAY_BUFFER, 0);
	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}
开发者ID:BSVino,项目名称:CodenameInfinite,代码行数:36,代码来源:renderingcontext.cpp

示例15: UpdateNetworkVariables

void CGameServerNetwork::UpdateNetworkVariables(int iClient, bool bForceAll)
{
	if (!GameNetwork()->IsConnected())
		return;

	double flTime = GameServer()->GetGameTime();

	size_t iMaxEnts = GameServer()->GetMaxEntities();
	for (size_t i = 0; i < iMaxEnts; i++)
	{
		CBaseEntity* pEntity = CBaseEntity::GetEntity(i);
		if (!pEntity)
			continue;

		const tchar* pszClassName = pEntity->GetClassName();

		CEntityRegistration* pRegistration = NULL;
		do
		{
			pRegistration = pEntity->GetRegisteredEntity(pszClassName);

			TAssert(pRegistration);
			if (!pRegistration)
				break;

			size_t iNetVarsSize = pRegistration->m_aNetworkVariables.size();
			for (size_t j = 0; j < iNetVarsSize; j++)
			{
				CNetworkedVariableData* pVarData = &pRegistration->m_aNetworkVariables[j];
				CNetworkedVariableBase* pVariable = pVarData->GetNetworkedVariableBase(pEntity);

				if (!bForceAll)
				{
					if (!pVariable->IsDirty())
						continue;

					if (flTime - pVariable->m_flLastUpdate < pVarData->m_flUpdateInterval)
						continue;
				}

				// For one, m_flLastUpdate needs to be a double
				pVariable->m_flLastUpdate = (float)flTime;
				// For two, it's shit.
				TUnimplemented();
				// Try some testing or something.

				CNetworkParameters p;
				p.ui1 = pEntity->GetHandle();

				size_t iDataSize;
				void* pValue = pVariable->Serialize(iDataSize);

				if (net_replication_debug.GetBool())
				{
					if (iDataSize >= 4)
						TMsg(tstring("Updating ") + pVarData->GetName() + sprintf(tstring(" (%x) (%f) (%d)\n"), *(unsigned int*)pValue, *(float*)pValue, *(int*)pValue));
					else
						TMsg(tstring("Updating ") + pVarData->GetName() + "\n");
				}

				p.CreateExtraData(iDataSize + strlen(pVarData->GetName())+1);
				strcpy((char*)p.m_pExtraData, pVarData->GetName());
				memcpy((unsigned char*)(p.m_pExtraData) + strlen(pVarData->GetName())+1, pValue, iDataSize);

				// UV stands for UpdateValue
				GameNetwork()->CallFunctionParameters(iClient, "UV", &p);

				// Only reset the dirty flag if all clients got the message.
				if (iClient == NETWORK_TOCLIENTS)
					pVariable->SetDirty(false);
			}

			pszClassName = pRegistration->m_pszParentClass;
		} while (pszClassName);
	}
}
开发者ID:BSVino,项目名称:CodenameInfinite,代码行数:76,代码来源:replication.cpp


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