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


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

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


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

示例1: SCR_SizeDown_f

void SCR_SizeDown_f(void) {
	//JHL:HACK; changed to affect the HUD, not SCR size
	if (hud.getInt() > 0) {
		hud.set(hud.getFloat() - 1);
		vid.recalc_refdef = 1;
	}
	//qmb :hud
	//Cvar_SetValue ("viewsize",scr_viewsize.value-10);
	//vid.recalc_refdef = 1;
}
开发者ID:DrLabman,项目名称:QMB,代码行数:10,代码来源:gl_screen.cpp

示例2: Host_FindMaxClients

void Host_FindMaxClients(void) {
    svs.maxclients = 1;

    int i = COM_CheckParm("-dedicated");
    if (i) {
        cls.state = ca_dedicated;
        if (i != (com_argc - 1)) {
            svs.maxclients = atoi(com_argv[i + 1]);
        } else
            svs.maxclients = 8;
    } else
        cls.state = ca_disconnected;

    //qmb :64 clients
    //various number changes including max_scoreboard
    i = COM_CheckParm("-listen");
    if (i) {
        if (cls.state == ca_dedicated)
            Sys_Error("Only one of -dedicated or -listen can be specified");
        if (i != (com_argc - 1))
            svs.maxclients = atoi(com_argv[i + 1]);
        else
            svs.maxclients = 32;
    }
    if (svs.maxclients < 1)
        svs.maxclients = 32;
    else if (svs.maxclients > MAX_SCOREBOARD)
        svs.maxclients = MAX_SCOREBOARD;

    svs.maxclientslimit = svs.maxclients;
    if (svs.maxclientslimit < 32)
        svs.maxclientslimit = 32;
    svs.clients = (client_t *) Hunk_AllocName(svs.maxclientslimit * sizeof (client_t), "clients");

    if (svs.maxclients > 1)
        deathmatch.set(1.0f);
    else
        deathmatch.set(0.0f);
}
开发者ID:DrLabman,项目名称:QMB,代码行数:39,代码来源:host.cpp

示例3: setCVar

bool Settings::setCVar(const std::string& name, const unsigned int& value)
{
	CVar* cvar = cvarlist[name];
	if ( cvar )
	{
		if ( cvar->set(value) )
			return true;
		else
			BE_LOG( "warning failed to set value for cvar '" << name << "': value must be >=" << cvarlist[name]->getIntMin() << " and <=" << cvarlist[name]->getIntMax() );
	}
	else
		BE_LOG( "unknown cvar: '" << name << "'");
	return false;
}
开发者ID:lyonjuniper,项目名称:critterding,代码行数:14,代码来源:settings.cpp

示例4: setCVar

bool Settings::setCVar(const std::string& name, const unsigned int& value)
{
	CVar* cvar = cvarlist[name];
	if ( cvar )
	{
		if ( cvar->set(value) )
			return true;
		else
			m_logDebug << "::SETTINGS warning failed to set value for cvar '" << name << "': value must be >=" << cvarlist[name]->getIntMin() << " and <=" << cvarlist[name]->getIntMax() << "'\n";
	}
	else
		m_logDebug << "::SETTINGS unknown cvar: '" << name << "'\n";
	return false;
}
开发者ID:ethicalfive,项目名称:critterding,代码行数:14,代码来源:settings.cpp

示例5: CL_FinishTimeDemo

/**
 * CL_FinishTimeDemo
 */
void CL_FinishTimeDemo(void) {
	int frames;
	float time;

	cls.timedemo = false;

	// the first frame didn't count
	frames = (host_framecount - cls.td_startframe) - 1;
	time = realtime - cls.td_starttime;
	if (!time)
		time = 1;
	Con_Printf("%i frames %5.1f seconds %5.1f fps\n", frames, time, frames / time);

	//restore console speed
	scr_conspeed.set(saveconspeed);
}
开发者ID:DrLabman,项目名称:QMB,代码行数:19,代码来源:cl_demo.cpp

示例6: CL_TimeDemo_f

/**
 * timedemo [demoname]
 */
void CL_TimeDemo_f(void) {
	if (CmdArgs::getSource() != CmdArgs::COMMAND)
		return;

	if (CmdArgs::getArgCount() != 2) {
		Con_Printf("timedemo <demoname> : gets demo speeds\n");
		return;
	}

	if (key_dest == key_console) {
		//make console disappare fast
		saveconspeed = scr_conspeed.getFloat();
		scr_conspeed.set(1000000.0f);
		Con_ToggleConsole_f();
	}

	CL_PlayDemo_f();

	// cls.td_starttime will be grabbed at the second frame of the demo, so
	// all the loading time doesn't get counted
	cls.timedemo = true;
	cls.td_startframe = host_framecount;
	cls.td_lastframe = -1; // get a new message this frame
}
开发者ID:DrLabman,项目名称:QMB,代码行数:27,代码来源:cl_demo.cpp

示例7: SCR_CalcRefdef

/**
 * Must be called whenever vid changes
 * 
 * Internal use only
 */
static void SCR_CalcRefdef(void) {
	float size, fov;
	int h;
	bool full = false;

	scr_fullupdate = 0; // force a background redraw
	vid.recalc_refdef = 0;

	//========================================
	size = scr_viewsize.getFloat();
	fov = scr_fov.getFloat();

	// bound viewsize
	size = max(30, size);
	size = min(120, size);

	// bound field of view
	fov = max(10, fov);
	fov = min(170, fov);

	if (size != scr_viewsize.getFloat())
		scr_viewsize.set(size);
	if (fov != scr_fov.getFloat())
		scr_fov.set(fov);

	sb_lines = 24 + 16 + 8;
	if (size >= 100.0) {
		full = true;
		size = 100.0;
	}

	if (cl.intermission) {
		full = true;
		size = 100;
		sb_lines = 0;
	}

	size /= 100.0f;

	// TODO: remove sb_lines variable
	h = vid.height; // - sb_lines;

	r_refdef.vrect.width = vid.width * size;
	if (r_refdef.vrect.width < 96) {
		size = 96.0 / r_refdef.vrect.width;
		r_refdef.vrect.width = 96; // min for icons
	}

	r_refdef.vrect.height = (signed)vid.height * size;
	//if (r_refdef.vrect.height > (signed)vid.height - sb_lines)
	//	r_refdef.vrect.height = (signed)vid.height - sb_lines;
	if (r_refdef.vrect.height > (signed)vid.height)
		r_refdef.vrect.height = vid.height;
	r_refdef.vrect.x = (vid.width - r_refdef.vrect.width) / 2;

	if (full)
		r_refdef.vrect.y = 0;
	else
		r_refdef.vrect.y = (h - r_refdef.vrect.height) / 2;

	r_refdef.fov_x = fov;
	r_refdef.fov_y = CalcFov(r_refdef.fov_x, r_refdef.vrect.width, r_refdef.vrect.height);

	scr_vrect = r_refdef.vrect;
}
开发者ID:DrLabman,项目名称:QMB,代码行数:70,代码来源:gl_screen.cpp


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