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


C++ ID函数代码示例

本文整理汇总了C++中ID函数的典型用法代码示例。如果您正苦于以下问题:C++ ID函数的具体用法?C++ ID怎么用?C++ ID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: vertex_set

inline Vertex::vertex_set Vertex::vertices() const {
    return vertex_set(vertex_it(data.mesh,data.mesh->data.vtov,ID()));
}
开发者ID:bilian1995,项目名称:Delite,代码行数:3,代码来源:Vertex.cpp

示例2: daeMetaElement

daeMetaElement *
domLinestrips::registerElement(DAE& dae)
{
	daeMetaElement* meta = dae.getMeta(ID());
	if ( meta != NULL ) return meta;

	meta = new daeMetaElement(dae);
	dae.setMeta(ID(), *meta);
	meta->setName( "linestrips" );
	meta->registerClass(domLinestrips::create);

	daeMetaCMPolicy *cm = NULL;
	daeMetaElementAttribute *mea = NULL;
	cm = new daeMetaSequence( meta, cm, 0, 1, 1 );

	mea = new daeMetaElementArrayAttribute( meta, cm, 0, 0, -1 );
	mea->setName( "input" );
	mea->setOffset( daeOffsetOf(domLinestrips,elemInput_array) );
	mea->setElementType( domInputLocalOffset::registerElement(dae) );
	cm->appendChild( mea );

	mea = new daeMetaElementArrayAttribute( meta, cm, 1, 0, -1 );
	mea->setName( "p" );
	mea->setOffset( daeOffsetOf(domLinestrips,elemP_array) );
	mea->setElementType( domP::registerElement(dae) );
	cm->appendChild( mea );

	mea = new daeMetaElementArrayAttribute( meta, cm, 2, 0, -1 );
	mea->setName( "extra" );
	mea->setOffset( daeOffsetOf(domLinestrips,elemExtra_array) );
	mea->setElementType( domExtra::registerElement(dae) );
	cm->appendChild( mea );

	cm->setMaxOrdinal( 2 );
	meta->setCMRoot( cm );	

	//	Add attribute: name
	{
		daeMetaAttribute *ma = new daeMetaAttribute;
		ma->setName( "name" );
		ma->setType( dae.getAtomicTypes().get("xsNCName"));
		ma->setOffset( daeOffsetOf( domLinestrips , attrName ));
		ma->setContainer( meta );
	
		meta->appendAttribute(ma);
	}

	//	Add attribute: count
	{
		daeMetaAttribute *ma = new daeMetaAttribute;
		ma->setName( "count" );
		ma->setType( dae.getAtomicTypes().get("Uint"));
		ma->setOffset( daeOffsetOf( domLinestrips , attrCount ));
		ma->setContainer( meta );
		ma->setIsRequired( true );
	
		meta->appendAttribute(ma);
	}

	//	Add attribute: material
	{
		daeMetaAttribute *ma = new daeMetaAttribute;
		ma->setName( "material" );
		ma->setType( dae.getAtomicTypes().get("xsNCName"));
		ma->setOffset( daeOffsetOf( domLinestrips , attrMaterial ));
		ma->setContainer( meta );
	
		meta->appendAttribute(ma);
	}

	meta->setElementSize(sizeof(domLinestrips));
	meta->validate();

	return meta;
}
开发者ID:jamesyan84,项目名称:mt36k_android_4.0.4,代码行数:75,代码来源:domLinestrips.cpp

示例3: ID

}

#endif /* CONFIG_PM */

/* must be the same order as name table above */
static const struct pci_device_id agp_via_pci_table[] = {
#define ID(x) \
	{						\
	.class		= (PCI_CLASS_BRIDGE_HOST << 8),	\
	.class_mask	= ~0,				\
	.vendor		= PCI_VENDOR_ID_VIA,		\
	.device		= x,				\
	.subvendor	= PCI_ANY_ID,			\
	.subdevice	= PCI_ANY_ID,			\
	}
	ID(PCI_DEVICE_ID_VIA_82C597_0),
	ID(PCI_DEVICE_ID_VIA_82C598_0),
	ID(PCI_DEVICE_ID_VIA_8501_0),
	ID(PCI_DEVICE_ID_VIA_8601_0),
	ID(PCI_DEVICE_ID_VIA_82C691_0),
	ID(PCI_DEVICE_ID_VIA_8371_0),
	ID(PCI_DEVICE_ID_VIA_8633_0),
	ID(PCI_DEVICE_ID_VIA_XN266),
	ID(PCI_DEVICE_ID_VIA_8361),
	ID(PCI_DEVICE_ID_VIA_8363_0),
	ID(PCI_DEVICE_ID_VIA_8753_0),
	ID(PCI_DEVICE_ID_VIA_8367_0),
	ID(PCI_DEVICE_ID_VIA_8653_0),
	ID(PCI_DEVICE_ID_VIA_XM266),
	ID(PCI_DEVICE_ID_VIA_862X_0),
	ID(PCI_DEVICE_ID_VIA_8377_0),
开发者ID:ManiacTwister,项目名称:linux-hnd,代码行数:31,代码来源:via-agp.c

示例4: ID

bool CUISoundsResource::IsInUse() const
{
  return CSettings::Get().GetString("lookandfeel.soundskin") == ID();
}
开发者ID:Distrotech,项目名称:xbmc,代码行数:4,代码来源:UISoundsResource.cpp

示例5: switch

void CGameObject::OnEvent		(NET_Packet& P, u16 type)
{
	switch (type)
	{
	case GE_HIT:
	case GE_HIT_STATISTIC:
		{
/*
			u16				id,weapon_id;
			Fvector			dir;
			float			power, impulse;
			s16				element;
			Fvector			position_in_bone_space;
			u16				hit_type;
			float			ap = 0.0f;

			P.r_u16			(id);
			P.r_u16			(weapon_id);
			P.r_dir			(dir);
			P.r_float		(power);
			P.r_s16			(element);
			P.r_vec3		(position_in_bone_space);
			P.r_float		(impulse);
			P.r_u16			(hit_type);	//hit type
			if ((ALife::EHitType)hit_type == ALife::eHitTypeFireWound)
			{
				P.r_float	(ap);
			}

			CObject*	Hitter = Level().Objects.net_Find(id);
			CObject*	Weapon = Level().Objects.net_Find(weapon_id);

			SHit	HDS = SHit(power, dir, Hitter, element, position_in_bone_space, impulse, (ALife::EHitType)hit_type, ap);
*/
			SHit	HDS;
			HDS.PACKET_TYPE = type;
			HDS.Read_Packet_Cont(P);
//			Msg("Hit received: %d[%d,%d]", HDS.whoID, HDS.weaponID, HDS.BulletID);
			CObject*	Hitter = Level().Objects.net_Find(HDS.whoID);
			CObject*	Weapon = Level().Objects.net_Find(HDS.weaponID);
			HDS.who		= Hitter;
			if (!HDS.who)
			{
				Msg("! ERROR: hitter object [%d] is NULL on client.", HDS.whoID);
			}
			//-------------------------------------------------------
			switch (HDS.PACKET_TYPE)
			{
			case GE_HIT_STATISTIC:
				{
					if (GameID() != eGameIDSingle)
						Game().m_WeaponUsageStatistic->OnBullet_Check_Request(&HDS);
				}break;
			default:
				{
				}break;
			}
			SetHitInfo(Hitter, Weapon, HDS.bone(), HDS.p_in_bone_space, HDS.dir);
			Hit				(&HDS);
			//---------------------------------------------------------------------------
			if (GameID() != eGameIDSingle)
			{
				Game().m_WeaponUsageStatistic->OnBullet_Check_Result(false);
				game_cl_mp*	mp_game = smart_cast<game_cl_mp*>(&Game());
				if (mp_game->get_reward_generator())
					mp_game->get_reward_generator()->OnBullet_Hit(Hitter, this, Weapon, HDS.boneID);
			}
			//---------------------------------------------------------------------------
		}
		break;
	case GE_DESTROY:
		{
			if ( H_Parent() )
			{
				Msg( "! ERROR (GameObject): GE_DESTROY arrived to object[%d][%s], that has parent[%d][%s], frame[%d]",
					ID(), cNameSect().c_str(),
					H_Parent()->ID(), H_Parent()->cName().c_str(), Device.dwFrame );
				
				// This object will be destroy on call function <H_Parent::Destroy>
				// or it will be call <H_Parent::Reject>  ==>  H_Parent = NULL
				// !!! ___ it is necessary to be check!
				break;
			}
#ifdef MP_LOGGING
			Msg("--- Object: GE_DESTROY of [%d][%s]", ID(), cNameSect().c_str());
#endif // MP_LOGGING

			setDestroy		(TRUE);
//			MakeMeCrow		();
		}
		break;
	}
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:93,代码来源:GameObject.cpp

示例6: daeMetaElement

daeMetaElement *
domGl_samplerRECT::registerElement(DAE& dae)
{
	daeMetaElement* meta = dae.getMeta(ID());
	if ( meta != NULL ) return meta;

	meta = new daeMetaElement(dae);
	dae.setMeta(ID(), *meta);
	meta->setName( "gl_samplerRECT" );
	meta->registerClass(domGl_samplerRECT::create);

	daeMetaCMPolicy *cm = NULL;
	daeMetaElementAttribute *mea = NULL;
	cm = new daeMetaSequence( meta, cm, 0, 1, 1 );

	cm = new daeMetaSequence( meta, cm, 0, 1, 1 );

	mea = new daeMetaElementAttribute( meta, cm, 0, 1, 1 );
	mea->setName( "source" );
	mea->setOffset( daeOffsetOf(domGl_samplerRECT,elemSource) );
	mea->setElementType( domSource::registerElement(dae) );
	cm->appendChild( mea );

	mea = new daeMetaElementAttribute( meta, cm, 1, 0, 1 );
	mea->setName( "wrap_s" );
	mea->setOffset( daeOffsetOf(domGl_samplerRECT,elemWrap_s) );
	mea->setElementType( domWrap_s::registerElement(dae) );
	cm->appendChild( mea );

	mea = new daeMetaElementAttribute( meta, cm, 2, 0, 1 );
	mea->setName( "wrap_t" );
	mea->setOffset( daeOffsetOf(domGl_samplerRECT,elemWrap_t) );
	mea->setElementType( domWrap_t::registerElement(dae) );
	cm->appendChild( mea );

	mea = new daeMetaElementAttribute( meta, cm, 3, 0, 1 );
	mea->setName( "minfilter" );
	mea->setOffset( daeOffsetOf(domGl_samplerRECT,elemMinfilter) );
	mea->setElementType( domMinfilter::registerElement(dae) );
	cm->appendChild( mea );

	mea = new daeMetaElementAttribute( meta, cm, 4, 0, 1 );
	mea->setName( "magfilter" );
	mea->setOffset( daeOffsetOf(domGl_samplerRECT,elemMagfilter) );
	mea->setElementType( domMagfilter::registerElement(dae) );
	cm->appendChild( mea );

	mea = new daeMetaElementAttribute( meta, cm, 5, 0, 1 );
	mea->setName( "mipfilter" );
	mea->setOffset( daeOffsetOf(domGl_samplerRECT,elemMipfilter) );
	mea->setElementType( domMipfilter::registerElement(dae) );
	cm->appendChild( mea );

	mea = new daeMetaElementAttribute( meta, cm, 6, 0, 1 );
	mea->setName( "border_color" );
	mea->setOffset( daeOffsetOf(domGl_samplerRECT,elemBorder_color) );
	mea->setElementType( domBorder_color::registerElement(dae) );
	cm->appendChild( mea );

	mea = new daeMetaElementAttribute( meta, cm, 7, 0, 1 );
	mea->setName( "mipmap_maxlevel" );
	mea->setOffset( daeOffsetOf(domGl_samplerRECT,elemMipmap_maxlevel) );
	mea->setElementType( domMipmap_maxlevel::registerElement(dae) );
	cm->appendChild( mea );

	mea = new daeMetaElementAttribute( meta, cm, 8, 0, 1 );
	mea->setName( "mipmap_bias" );
	mea->setOffset( daeOffsetOf(domGl_samplerRECT,elemMipmap_bias) );
	mea->setElementType( domMipmap_bias::registerElement(dae) );
	cm->appendChild( mea );

	mea = new daeMetaElementArrayAttribute( meta, cm, 9, 0, -1 );
	mea->setName( "extra" );
	mea->setOffset( daeOffsetOf(domGl_samplerRECT,elemExtra_array) );
	mea->setElementType( domExtra::registerElement(dae) );
	cm->appendChild( mea );

	cm->setMaxOrdinal( 9 );
	cm->getParent()->appendChild( cm );
	cm = cm->getParent();

	cm->setMaxOrdinal( 9 );
	meta->setCMRoot( cm );	

	meta->setElementSize(sizeof(domGl_samplerRECT));
	meta->validate();

	return meta;
}
开发者ID:ACSOP,项目名称:android_external_collada,代码行数:89,代码来源:domGl_samplerRECT.cpp

示例7: ID

void FontPage::Load( FontPageSettings cfg )
{
	m_sTexturePath = cfg.m_sTexturePath;

	// load texture
	RageTextureID ID( m_sTexturePath );
	if( cfg.m_sTextureHints != "default" )
		ID.AdditionalTextureHints = cfg.m_sTextureHints;
	else
		ID.AdditionalTextureHints = "16bpp";

	m_pTexture = TEXTUREMAN->LoadTexture( ID );
	ASSERT( m_pTexture != NULL );

	// load character widths
	vector<int> aiFrameWidths;

	int default_width = m_pTexture->GetSourceFrameWidth();
	if( cfg.m_iDefaultWidth != -1 )
		default_width = cfg.m_iDefaultWidth;

	// Assume each character is the width of the frame by default.
	for( int i=0; i<m_pTexture->GetNumFrames(); i++ )
	{
		map<int,int>::const_iterator it = cfg.m_mapGlyphWidths.find(i);
		if( it != cfg.m_mapGlyphWidths.end() )
			aiFrameWidths.push_back( it->second );
		else
			aiFrameWidths.push_back( default_width );
	}

	if( cfg.m_iAddToAllWidths )
	{
		for( int i=0; i<m_pTexture->GetNumFrames(); i++ )
			aiFrameWidths[i] += cfg.m_iAddToAllWidths;
	}

	if( cfg.m_fScaleAllWidthsBy != 1 )
	{
		for( int i=0; i<m_pTexture->GetNumFrames(); i++ )
			aiFrameWidths[i] = int(roundf( aiFrameWidths[i] * cfg.m_fScaleAllWidthsBy ));
	}

	m_iCharToGlyphNo = cfg.CharToGlyphNo;

	m_iLineSpacing = cfg.m_iLineSpacing;
	if( m_iLineSpacing == -1 )
		m_iLineSpacing = m_pTexture->GetSourceFrameHeight();

	int iBaseline=0;
	/* If we don't have a top and/or baseline, assume we're centered in the
	 * frame, and that LineSpacing is the total height. */
	if( cfg.m_iBaseline == -1 )
	{
		float center = m_pTexture->GetSourceFrameHeight()/2.0f;
		cfg.m_iBaseline = int( center + m_iLineSpacing/2 );
	}

	if( cfg.m_iTop == -1 )
	{
		float center = m_pTexture->GetSourceFrameHeight()/2.0f;
		cfg.m_iTop = int( center - m_iLineSpacing/2 );
	}
	iBaseline = cfg.m_iBaseline;
	m_iHeight = iBaseline - cfg.m_iTop;
	m_iDrawExtraPixelsLeft = cfg.m_iDrawExtraPixelsLeft;
	m_iDrawExtraPixelsRight = cfg.m_iDrawExtraPixelsRight;

	/* Shift the character up so the top will be rendered at the baseline. */
	m_fVshift = (float) -iBaseline;

	SetTextureCoords( aiFrameWidths, cfg.m_iAdvanceExtraPixels );
	SetExtraPixels( cfg.m_iDrawExtraPixelsLeft, cfg.m_iDrawExtraPixelsRight );

//	LOG->Trace("Font %s: height %i, baseline %i ( == top %i)",
//		   m_sTexturePath.c_str(), height, baseline, baseline-height);
}
开发者ID:BitMax,项目名称:openitg,代码行数:77,代码来源:Font.cpp

示例8: make_capture_field

// Process the given capture and create the AST for the corresponding field.
// Returns the create field AST, which must be freed by the caller.
// Returns NULL on error.
static ast_t* make_capture_field(pass_opt_t* opt, ast_t* capture)
{
    assert(capture != NULL);

    AST_GET_CHILDREN(capture, id_node, type, value);
    const char* name = ast_name(id_node);

    // There are 3 varieties of capture:
    // x -> capture variable x, type from defn of x
    // x = y -> capture expression y, type inferred from expression type
    // x: T = y -> capture expression y, type T

    if(ast_id(value) == TK_NONE)
    {
        // Variable capture
        assert(ast_id(type) == TK_NONE);

        ast_t* def = ast_get(capture, name, NULL);

        if(def == NULL)
        {
            ast_error(id_node, "cannot capture \"%s\", variable not defined",
                      name);
            return NULL;
        }

        token_id def_id = ast_id(def);

        if(def_id != TK_ID && def_id != TK_FVAR && def_id != TK_FLET &&
                def_id != TK_PARAM)
        {
            ast_error(id_node, "cannot capture \"%s\", can only capture fields, "
                      "parameters and local variables", name);
            return NULL;
        }

        BUILD(capture_rhs, id_node, NODE(TK_REFERENCE, ID(name)));

        type = ast_type(def);
        value = capture_rhs;
    }
    else
    {
        // Expression capture
        if(ast_id(type) == TK_NONE)
        {
            // No type specified, use type of the captured expression
            type = ast_type(value);
        }
        else
        {
            // Type given, infer literals
            if(!coerce_literals(&value, type, opt))
                return NULL;
        }
    }

    if(is_typecheck_error(type))
        return NULL;

    type = sanitise_type(type);

    BUILD(field, id_node,
          NODE(TK_FLET,
               TREE(id_node)
               TREE(type)
               TREE(value)
               NONE));  // Delegate type

    return field;
}
开发者ID:cosinuz,项目名称:ponyc,代码行数:74,代码来源:lambda.c

示例9: expr_lambda

bool expr_lambda(pass_opt_t* opt, ast_t** astp)
{
    assert(astp != NULL);
    ast_t* ast = *astp;
    assert(ast != NULL);

    AST_GET_CHILDREN(ast, cap, t_params, params, captures, ret_type, raises,
                     body);

    ast_t* members = ast_from(ast, TK_MEMBERS);
    ast_t* last_member = NULL;
    bool failed = false;

    // Process captures
    for(ast_t* p = ast_child(captures); p != NULL; p = ast_sibling(p))
    {
        ast_t* field = make_capture_field(opt, p);

        if(field != NULL)
            ast_list_append(members, &last_member, field);
        else  // An error occurred, just keep going to potentially find more errors
            failed = true;
    }

    if(failed)
    {
        ast_free(members);
        return false;
    }

    // Stop the various elements being marked as preserve
    ast_clearflag(t_params, AST_FLAG_PRESERVE);
    ast_clearflag(params, AST_FLAG_PRESERVE);
    ast_clearflag(ret_type, AST_FLAG_PRESERVE);
    ast_clearflag(body, AST_FLAG_PRESERVE);

    // Make the apply function
    BUILD(apply, ast,
          NODE(TK_FUN, AST_SCOPE
               TREE(cap)
               ID("apply")
               TREE(t_params)
               TREE(params)
               TREE(ret_type)
               TREE(raises)
               TREE(body)
               NONE    // Doc string
               NONE)); // Guard

    ast_list_append(members, &last_member, apply);

    // Replace lambda with object literal
    REPLACE(astp,
            NODE(TK_OBJECT,
                 NONE
                 NONE  // Provides list
                 TREE(members)));

    // Catch up passes
    return ast_passes_subtree(astp, opt, PASS_EXPR);
}
开发者ID:cosinuz,项目名称:ponyc,代码行数:61,代码来源:lambda.c

示例10: Type

	int  Type (void)               { return (ID ()); }
开发者ID:kravitz,项目名称:transims4,代码行数:1,代码来源:Area_Type.hpp

示例11: daeMetaElement

daeMetaElement *
domCg_newarray_type::registerElement(DAE& dae)
{
	daeMetaElement* meta = dae.getMeta(ID());
	if ( meta != NULL ) return meta;

	meta = new daeMetaElement(dae);
	dae.setMeta(ID(), *meta);
	meta->setName( "cg_newarray_type" );
	meta->registerClass(domCg_newarray_type::create);

	daeMetaCMPolicy *cm = NULL;
	daeMetaElementAttribute *mea = NULL;
	cm = new daeMetaChoice( meta, cm, 0, 0, 0, -1 );

	mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 );
	mea->setName( "cg_param_type" );
	mea->setOffset( daeOffsetOf(domCg_newarray_type,elemCg_param_type_array) );
	mea->setElementType( domCg_param_type::registerElement(dae) );
	cm->appendChild( new daeMetaGroup( mea, meta, cm, 0, 1, 1 ) );

	mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 );
	mea->setName( "array" );
	mea->setOffset( daeOffsetOf(domCg_newarray_type,elemArray_array) );
	mea->setElementType( domCg_newarray_type::registerElement(dae) );
	cm->appendChild( mea );

	mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 );
	mea->setName( "usertype" );
	mea->setOffset( daeOffsetOf(domCg_newarray_type,elemUsertype_array) );
	mea->setElementType( domCg_setuser_type::registerElement(dae) );
	cm->appendChild( mea );

	mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, 1 );
	mea->setName( "connect_param" );
	mea->setOffset( daeOffsetOf(domCg_newarray_type,elemConnect_param_array) );
	mea->setElementType( domCg_connect_param::registerElement(dae) );
	cm->appendChild( mea );

	cm->setMaxOrdinal( 3000 );
	meta->setCMRoot( cm );	
	// Ordered list of sub-elements
	meta->addContents(daeOffsetOf(domCg_newarray_type,_contents));
	meta->addContentsOrder(daeOffsetOf(domCg_newarray_type,_contentsOrder));

	meta->addCMDataArray(daeOffsetOf(domCg_newarray_type,_CMData), 1);
	//	Add attribute: length
	{
		daeMetaAttribute *ma = new daeMetaAttribute;
		ma->setName( "length" );
		ma->setType( dae.getAtomicTypes().get("xsPositiveInteger"));
		ma->setOffset( daeOffsetOf( domCg_newarray_type , attrLength ));
		ma->setContainer( meta );
		ma->setIsRequired( true );
	
		meta->appendAttribute(ma);
	}

	meta->setElementSize(sizeof(domCg_newarray_type));
	meta->validate();

	return meta;
}
开发者ID:AbuShaqra,项目名称:openrave,代码行数:63,代码来源:domCg_newarray_type.cpp

示例12: SetfHealth

BOOL CHelicopter::net_Spawn(CSE_Abstract*	DC)
{

    SetfHealth(100.0f);
    setState(CHelicopter::eAlive);
    m_flame_started					=false;
    m_light_started					=false;
    m_exploded						=false;
    m_ready_explode					=false;
    m_dead							=false;

    if (!inherited::net_Spawn(DC))
        return			(FALSE);

    CPHSkeleton::Spawn((CSE_Abstract*)(DC));
    for(u32 i=0; i<4; ++i)
        CRocketLauncher::SpawnRocket(*m_sRocketSection, smart_cast<CGameObject*>(this));

    // assigning m_animator here
    CSE_Abstract		*abstract	=(CSE_Abstract*)(DC);
    CSE_ALifeHelicopter	*heli		= smart_cast<CSE_ALifeHelicopter*>(abstract);
    VERIFY				(heli);

    R_ASSERT						(Visual()&&smart_cast<IKinematics*>(Visual()));
    IKinematics* K					= smart_cast<IKinematics*>(Visual());
    CInifile* pUserData				= K->LL_UserData();

    m_rotate_x_bone			= K->LL_BoneID	(pUserData->r_string("helicopter_definition","wpn_rotate_x_bone"));
    m_rotate_y_bone			= K->LL_BoneID	(pUserData->r_string("helicopter_definition","wpn_rotate_y_bone"));
    m_fire_bone				= K->LL_BoneID	(pUserData->r_string("helicopter_definition","wpn_fire_bone"));
    m_death_bones_to_hide	= pUserData->r_string("on_death_mode","scale_bone");
    m_left_rocket_bone		= K->LL_BoneID	(pUserData->r_string("helicopter_definition","left_rocket_bone"));
    m_right_rocket_bone		= K->LL_BoneID	(pUserData->r_string("helicopter_definition","right_rocket_bone"));

    m_smoke_bone 			= K->LL_BoneID	(pUserData->r_string("helicopter_definition","smoke_bone"));
    m_light_bone 			= K->LL_BoneID	(pUserData->r_string("helicopter_definition","light_bone"));

    CExplosive::Load		(pUserData,"explosion");
    CExplosive::SetInitiator(ID());

    LPCSTR s = pUserData->r_string("helicopter_definition","hit_section");

    if( pUserData->section_exist(s) ) {
        int lc = pUserData->line_count(s);
        LPCSTR name;
        LPCSTR value;
        s16 boneID;
        for (int i=0 ; i<lc; ++i) {
            pUserData->r_line( s, i, &name, &value);
            boneID	=K->LL_BoneID(name);
            m_hitBones.insert( std::make_pair(boneID, (float)atof(value)) );
        }
    }

    CBoneInstance& biX		= smart_cast<IKinematics*>(Visual())->LL_GetBoneInstance(m_rotate_x_bone);
    biX.set_callback		(bctCustom,BoneMGunCallbackX,this);
    CBoneInstance& biY		= smart_cast<IKinematics*>(Visual())->LL_GetBoneInstance(m_rotate_y_bone);
    biY.set_callback		(bctCustom,BoneMGunCallbackY,this);
    CBoneData& bdX			= K->LL_GetData(m_rotate_x_bone);
    VERIFY(bdX.IK_data.type==jtJoint);
    m_lim_x_rot.set			(bdX.IK_data.limits[0].limit.x,bdX.IK_data.limits[0].limit.y);
    CBoneData& bdY			= K->LL_GetData(m_rotate_y_bone);
    VERIFY(bdY.IK_data.type==jtJoint);
    m_lim_y_rot.set			(bdY.IK_data.limits[1].limit.x,bdY.IK_data.limits[1].limit.y);

    xr_vector<Fmatrix> matrices;
    K->LL_GetBindTransform	(matrices);
    m_i_bind_x_xform.invert	(matrices[m_rotate_x_bone]);
    m_i_bind_y_xform.invert	(matrices[m_rotate_y_bone]);
    m_bind_rot.x			= matrices[m_rotate_x_bone].k.getP();
    m_bind_rot.y			= matrices[m_rotate_y_bone].k.getH();
    m_bind_x.set			(matrices[m_rotate_x_bone].c);
    m_bind_y.set			(matrices[m_rotate_y_bone].c);

    IKinematicsAnimated	*A	= smart_cast<IKinematicsAnimated*>(Visual());
    if (A) {
        A->PlayCycle		(*heli->startup_animation);
        K->CalculateBones	(TRUE);
    }

    m_engineSound.create			(*heli->engine_sound,st_Effect,sg_SourceType);
    m_engineSound.play_at_pos		(0,XFORM().c,sm_Looped);

    CShootingObject::Light_Create	();


    setVisible						(TRUE);
    setEnabled						(TRUE);



    m_stepRemains						= 0.0f;

//lighting
    m_light_render						= ::Render->light_create();
    m_light_render->set_shadow			(false);
    m_light_render->set_type			(IRender_Light::POINT);
    m_light_render->set_range			(m_light_range);
    m_light_render->set_color			(m_light_color);

//.........这里部分代码省略.........
开发者ID:Zen13L,项目名称:xray-16,代码行数:101,代码来源:Helicopter.cpp

示例13: daeMetaElement

daeMetaElement *
domLibrary_lights::registerElement(DAE& dae)
{
	daeMetaElement* meta = dae.getMeta(ID());
	if ( meta != NULL ) return meta;

	meta = new daeMetaElement(dae);
	dae.setMeta(ID(), *meta);
	meta->setName( "library_lights" );
	meta->registerClass(domLibrary_lights::create);

	daeMetaCMPolicy *cm = NULL;
	daeMetaElementAttribute *mea = NULL;
	cm = new daeMetaSequence( meta, cm, 0, 1, 1 );

	mea = new daeMetaElementAttribute( meta, cm, 0, 0, 1 );
	mea->setName( "asset" );
	mea->setOffset( daeOffsetOf(domLibrary_lights,elemAsset) );
	mea->setElementType( domAsset::registerElement(dae) );
	cm->appendChild( mea );

	mea = new daeMetaElementArrayAttribute( meta, cm, 1, 1, -1 );
	mea->setName( "light" );
	mea->setOffset( daeOffsetOf(domLibrary_lights,elemLight_array) );
	mea->setElementType( domLight::registerElement(dae) );
	cm->appendChild( mea );

	mea = new daeMetaElementArrayAttribute( meta, cm, 2, 0, -1 );
	mea->setName( "extra" );
	mea->setOffset( daeOffsetOf(domLibrary_lights,elemExtra_array) );
	mea->setElementType( domExtra::registerElement(dae) );
	cm->appendChild( mea );

	cm->setMaxOrdinal( 2 );
	meta->setCMRoot( cm );	

	//	Add attribute: id
	{
		daeMetaAttribute *ma = new daeMetaAttribute;
		ma->setName( "id" );
		ma->setType( dae.getAtomicTypes().get("xsID"));
		ma->setOffset( daeOffsetOf( domLibrary_lights , attrId ));
		ma->setContainer( meta );
	
		meta->appendAttribute(ma);
	}

	//	Add attribute: name
	{
		daeMetaAttribute *ma = new daeMetaAttribute;
		ma->setName( "name" );
		ma->setType( dae.getAtomicTypes().get("xsNCName"));
		ma->setOffset( daeOffsetOf( domLibrary_lights , attrName ));
		ma->setContainer( meta );
	
		meta->appendAttribute(ma);
	}

	meta->setElementSize(sizeof(domLibrary_lights));
	meta->validate();

	return meta;
}
开发者ID:jamesyan84,项目名称:mt36k_android_4.0.4,代码行数:63,代码来源:domLibrary_lights.cpp

示例14: daeMetaElement

daeMetaElement *
domPhysics_model::registerElement(DAE& dae)
{
	daeMetaElement* meta = dae.getMeta(ID());
	if ( meta != NULL ) return meta;

	meta = new daeMetaElement(dae);
	dae.setMeta(ID(), *meta);
	meta->setName( "physics_model" );
	meta->registerClass(domPhysics_model::create);

	daeMetaCMPolicy *cm = NULL;
	daeMetaElementAttribute *mea = NULL;
	cm = new daeMetaSequence( meta, cm, 0, 1, 1 );

	mea = new daeMetaElementAttribute( meta, cm, 0, 0, 1 );
	mea->setName( "asset" );
	mea->setOffset( daeOffsetOf(domPhysics_model,elemAsset) );
	mea->setElementType( domAsset::registerElement(dae) );
	cm->appendChild( mea );

	mea = new daeMetaElementArrayAttribute( meta, cm, 1, 0, -1 );
	mea->setName( "rigid_body" );
	mea->setOffset( daeOffsetOf(domPhysics_model,elemRigid_body_array) );
	mea->setElementType( domRigid_body::registerElement(dae) );
	cm->appendChild( mea );

	mea = new daeMetaElementArrayAttribute( meta, cm, 2, 0, -1 );
	mea->setName( "rigid_constraint" );
	mea->setOffset( daeOffsetOf(domPhysics_model,elemRigid_constraint_array) );
	mea->setElementType( domRigid_constraint::registerElement(dae) );
	cm->appendChild( mea );

	mea = new daeMetaElementArrayAttribute( meta, cm, 3, 0, -1 );
	mea->setName( "instance_physics_model" );
	mea->setOffset( daeOffsetOf(domPhysics_model,elemInstance_physics_model_array) );
	mea->setElementType( domInstance_physics_model::registerElement(dae) );
	cm->appendChild( mea );

	mea = new daeMetaElementArrayAttribute( meta, cm, 4, 0, -1 );
	mea->setName( "extra" );
	mea->setOffset( daeOffsetOf(domPhysics_model,elemExtra_array) );
	mea->setElementType( domExtra::registerElement(dae) );
	cm->appendChild( mea );

	cm->setMaxOrdinal( 4 );
	meta->setCMRoot( cm );	

	//	Add attribute: id
	{
		daeMetaAttribute *ma = new daeMetaAttribute;
		ma->setName( "id" );
		ma->setType( dae.getAtomicTypes().get("xsID"));
		ma->setOffset( daeOffsetOf( domPhysics_model , attrId ));
		ma->setContainer( meta );
	
		meta->appendAttribute(ma);
	}

	//	Add attribute: name
	{
		daeMetaAttribute *ma = new daeMetaAttribute;
		ma->setName( "name" );
		ma->setType( dae.getAtomicTypes().get("xsNCName"));
		ma->setOffset( daeOffsetOf( domPhysics_model , attrName ));
		ma->setContainer( meta );
	
		meta->appendAttribute(ma);
	}

	meta->setElementSize(sizeof(domPhysics_model));
	meta->validate();

	return meta;
}
开发者ID:jamesyan84,项目名称:mt36k_android_4.0.4,代码行数:75,代码来源:domPhysics_model.cpp

示例15: if

void CMMDesktopHandler::EventHandler(CGUIEvent *event)
{
	if(!event || !MMDesktop)
		return;

	if(event->eventID == EClicked )
	{
		if(event->sender==exit)
		{
			eventServer->SendPriorityEvent(ECommand,GetID(),mainGUI->handler->GetID(),4);
		}else
		if(event->sender==editlevel)
		{
			MMDesktop->EditLevel();
		}
		else if(event->sender==editscript)
		{
			//MMdesktop->GetSelectedLevel();
			eventServer->SendPriorityEvent(ECommand,GetID(),mainGUI->handler->GetID(),1);
		}
		else if(event->sender==play)
		{
			MMDesktop->PlayLevel(0);
		}
		else if(event->sender==restartlevel)
		{
			MMDesktop->PlayLevel(1);
		}
		else if(event->sender==help)
		{
			MMDesktop->ShowHelp();
		}
		else if(event->sender==about)
		{
			MMDesktop->ShowCredits();			
		}				
		else if (event->sender == donate)
		{
			CGUIMessageBox *dlgd = GUIMessageBoxOkCancel("en{{Open Danate PDF?}}cs{{Otevøít Donate PDF?}}", "en{{Do you want to open external document?}}cs{{Chceš otevøít externí dokument?}}", 1);
			donateOpen = dlgd->GetID();
			dlgd->AcceptEvent(GetID(), EOk);
		}
		else if (event->sender == cfg)
		{
			CGUIMessageBox *dlgd = GUIMessageBoxOkCancel("en{{Restart and Edit Configuration?}}cs{{Restartovat a Editovat Konfiguraci?}}", "en{{Do you want to edit game's configuration file?\nWhen you close the editor, Krkal will start again.}}cs{{Chceš editovat konfiguraèní soubor hry?\nKrkal se poté, co zavøeš editor, opìt nastartuje.}}", 1);
			cfgOpen = dlgd->GetID();
			dlgd->AcceptEvent(GetID(), EOk);
		}
		else if(event->sender==mmLeft)
		{
			MMDesktop->levBrowser->MoveLeft();
		}				
		else if(event->sender==mmRight)
		{
			MMDesktop->levBrowser->MoveRight();
		}				
	}

	if (event->eventID == EOk && event->sender == donateOpen)
	{
		KRKAL->SetFullscreen(0);
		char *fullPath;
		if (KRKAL->cfg.lang == langEN) FS->ParseString("$KRKAL$\\Documentation.EN\\Donate.pdf", &fullPath);
		else FS->ParseString("$KRKAL$\\Dokumentace.CS\\Donate.pdf", &fullPath);
		char *cmd = new char[strlen(fullPath) + 30];
		sprintf(cmd, "start cmd /c \"%s\"", fullPath);
		system(cmd);
		SAFE_DELETE_ARRAY(fullPath);
		SAFE_DELETE_ARRAY(cmd);
	}

	if (event->eventID == EOk && event->sender == cfgOpen)
	{
		FS->ChangeDir("$cfg$");
		char *fullPath;
		FS->ParseString("$KRKAL$/krkal.cfg", &fullPath);
		char *cmd = new char[strlen(fullPath) + 64];
		sprintf(cmd, "start cmd /c \"notepad \"%s\" && krkal.exe\"", fullPath);
		system(cmd);
		SAFE_DELETE_ARRAY(fullPath);
		SAFE_DELETE_ARRAY(cmd);
		eventServer->SendPriorityEvent(ECommand, GetID(), mainGUI->handler->GetID(), 4);
	}

	if(event->eventID == EList )
	{
		CGUIListItem* ID(it,event->pID);

		if(it){
			MMDesktop->PlayLevel(it->GetData(),mainGUI->key_ctrl);
		}

	}

	if(event->eventID == ETree)
	{
		if(event->sender==regbrow)
			RegBrowEvent(event);
	}

//.........这里部分代码省略.........
开发者ID:HonzaMD,项目名称:Krkal2,代码行数:101,代码来源:MMDesktop.cpp


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