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


C++ CL_NetGameEvent::get_argument_count方法代码示例

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


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

示例1: deserialize

void Car::deserialize(const CL_NetGameEvent &p_event)
{
	static const unsigned ARGUMENT_COUNT = 15;

	if (p_event.get_argument_count() != ARGUMENT_COUNT) {
		// when serialize data is invalid don't do anything
		cl_log_event(
				LOG_DEBUG,
				"invalid serialize data count: %1",
				p_event.get_argument_count()
		);

		return;
	}

	int idx = 0;

	// load iteration counter
	m_impl->m_iterId = p_event.get_argument(idx++);

	// saved inputs
	m_impl->m_inputState.accel = p_event.get_argument(idx++);
	m_impl->m_inputState.brake = p_event.get_argument(idx++);
	m_impl->m_inputState.turn = hexToFloat(p_event.get_argument(idx++));
	m_impl->m_inputLocked = p_event.get_argument(idx++);

	// corpse state
	m_impl->m_position.x = hexToFloat(p_event.get_argument(idx++));
	m_impl->m_position.y = hexToFloat(p_event.get_argument(idx++));
	m_impl->m_rotation.set_radians(hexToFloat(p_event.get_argument(idx++)));
	m_impl->m_speed = hexToFloat(p_event.get_argument(idx++));

	// physics parameters
	m_impl->m_phyMoveRot.set_radians(hexToFloat(p_event.get_argument(idx++)));
	m_impl->m_phyMoveVec.x = hexToFloat(p_event.get_argument(idx++));
	m_impl->m_phyMoveVec.y = hexToFloat(p_event.get_argument(idx++));
	m_impl->m_phySpeedDelta = hexToFloat(p_event.get_argument(idx++));
	m_impl->m_phyWheelsTurn = hexToFloat(p_event.get_argument(idx++));

	m_impl->m_damage = hexToFloat(p_event.get_argument(idx++));
}
开发者ID:genail,项目名称:gear,代码行数:41,代码来源:Car.cpp

示例2: parseEvent

void CarState::parseEvent(const CL_NetGameEvent &p_event)
{
	assert(p_event.get_name() == EVENT_CAR_STATE);

	m_name = p_event.get_argument(0);
	m_serialData = CL_NetGameEvent("");

	const int argCount = static_cast<signed>(p_event.get_argument_count());

	for (int i = 1; i < argCount; ++i) {
		m_serialData.add_argument(p_event.get_argument(i));
	}
}
开发者ID:bercik,项目名称:gear,代码行数:13,代码来源:CarState.cpp

示例3: on_evento_juego_actualizar_mouse

void Cliente::on_evento_juego_actualizar_mouse(const CL_NetGameEvent &e)
{
	cl_log_event("eventos", "Actualizar Mouse");
	int numarg = e.get_argument_count();

	int idtanque = e.get_argument(0);

	if(idtanque != mundo->getTanqueJugador()->getID())
	{
		if(numarg==1) //Boton Izquierdo (Disparar)
		{
			mundo->teclatanquedown(idtanque,CL_KEY_SPACE);
		}
		/*else if(numarg==3) //Mover mouse
		{
			float x=e.get_argument(1),y=e.get_argument(2); //coordenadas
			mundo->getTanqueID(idtanque)->setTargetPosTorreta(CL_Vec2f(x,y));
		}*/	
	}
}
开发者ID:vladimirdlc,项目名称:Tanknation,代码行数:20,代码来源:cliente.cpp


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