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


C++ CObj类代码示例

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


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

示例1: WriteError

BOOL CLinkMap::InsertObjLink( CObj* pObj )
{
	if( pObj->GetType() == OT_MOVER && ( (CMover*)pObj )->IsPlayer() && pObj->GetLinkLevel() != 0 )
		WriteError( "ML//%s//%d//%d", ( (CMover*)pObj )->GetName(), ( (CMover*)pObj )->m_idPlayer, pObj->GetLinkLevel() );
	
	CObj** ppObj = GetObjPtr( pObj->GetLinkPos(), pObj->GetLinkType(), pObj->GetLinkLevel() );
	if( ppObj )
	{
		CObj* pBegObj = *ppObj;
		if( pBegObj )
		{
			if( pObj->m_pNext || pObj->m_pPrev )
			{
				Error("헉 InsertObjWorld 새로 추가된 오브젝트가 Next와 Prev에 값이 있네?? Type = %d \n", pObj->GetType());
			}
			pBegObj->InsNextNode(pObj);
		}
		else 
		{
			*ppObj = pObj;
			if( pObj->m_pNext || pObj->m_pPrev )
			{
				Error("헉 InsertObjWorld 새로 추가된 오브젝트가 Next와 Prev에 값이 있네?? Type = %d \n", pObj->GetType());
			}
		}
	}
	else
	{
		Error("헉 InsObjInFld에서 범위를 벗어난게 추가되려고 하네?\n");
		return FALSE;
	}
	return TRUE;
}
开发者ID:iceberry,项目名称:flyffsf,代码行数:33,代码来源:LinkMap.cpp

示例2: g_WorldMng

BOOL CWndIndirectTalk::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult ) 
{ 
	CWorld* pWorld = g_WorldMng();
	CObj* pObj = pWorld->GetObjFocus();
	if( pObj && pObj->GetType() == OT_MOVER )
	{
		switch( nID )
		{
		case WIDC_EDIT2: // 본문 
			if( message != EN_RETURN )
				break;
		case WIDC_BUTTON1:
			{
				CWndEdit* pWndEdit1 = (CWndEdit*)GetDlgItem( WIDC_EDIT1 );
				CWndEdit* pWndEdit2 = (CWndEdit*)GetDlgItem( WIDC_EDIT2 );
				LPCTSTR lpId = pWndEdit1->m_string;
				LPCTSTR lpText = pWndEdit2->m_string;
				CString string;
				string.Format( "/id %s %s", lpId, lpText );
				ParsingCommand( string.LockBuffer(), g_pPlayer );
				string.UnlockBuffer();
				pWndEdit2->Empty();
			}
			break;
		}
	}
	if( nID == WTBID_CLOSE )
	{
		Destroy( TRUE );
		return TRUE;
	}
	return CWndNeuz::OnChildNotify( message, nID, pLResult ); 
} 
开发者ID:iceberry,项目名称:flyffsf,代码行数:33,代码来源:WndIndirectTalk.cpp

示例3: AddObject

HRESULT CObjMgr::AddObject( CPrototype* pProto, const TCHAR* pObjKey )
{
	map<const TCHAR*,list<CObj*>>::iterator iter = m_MapObject.find(pObjKey);
	
	CObj* pProtoInst = ((CObjProto*)pProto)->GetProto(pObjKey);

	if (pProtoInst == NULL)
	{
		return E_FAIL;
	} //객체를 가져온다

	CObj* pObject = pProtoInst->Clone(); //복사해서 담아온다
	pObject->Initialize();
	
	if (iter == m_MapObject.end())
	{//처음에 iter가 없다 (키가없다)
		list<CObj*> Objlist;
		Objlist.push_back(pObject); //프로토타입으로 복제한 오브젝트를 넣어줌

		m_MapObject.insert(make_pair(pObjKey,Objlist));
	}
	else
	{//키가 있을때 
		iter->second.push_back(pObject);
	}

	return S_OK;
}
开发者ID:luputona,项目名称:CStudy_3,代码行数:28,代码来源:ObjMgr.cpp

示例4: FOR_LINKMAP

void CPartyQuestProcessor::RemoveAllDynamicObj( DWORD dwWorldID, D3DXVECTOR3 vPos, int nRange  )
{
	CWorld* pWorld	= g_WorldMng.GetWorld( dwWorldID );

	if( !pWorld )
		return;

	CObj*		pObj;
	D3DXVECTOR3 vDist;

	FOR_LINKMAP( pWorld, vPos, pObj, nRange, CObj::linkDynamic, nTempLayer )
	{
		if( pObj )
		{
			if( pObj->GetType() == OT_MOVER && ((CMover *)pObj)->IsPeaceful() == FALSE )
			{
				pObj->Delete();
			}
		}
	}
	END_LINKMAP

	D3DXVECTOR3 vPos2	= D3DXVECTOR3( 6968.0f, 0, 3328.8f );
	FOR_LINKMAP( pWorld, vPos, pObj, nRange, CObj::linkPlayer, nTempLayer )
	{
		if( pObj )
		{
			CUser* pUser = (CUser*)pObj;
			pUser->AddQuestTextTime( 0, 0, 0xffffffff );			
			( (CUser*)pObj )->REPLACE( g_uIdofMulti, WI_WORLD_MADRIGAL, vPos2, REPLACE_NORMAL, nDefaultLayer );
		}
	}
	END_LINKMAP
}
开发者ID:iceberry,项目名称:flyffsf,代码行数:34,代码来源:partyquest.cpp

示例5: GetPlugin

void ObjectBarDialog::OnBeginDrag(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
	*pResult = 0;

	POSITION Pos = objects.GetFirstSelectedItemPosition();
	int Item = objects.GetNextSelectedItem(Pos);

	if (Item == -1) return; // Safety first

	// Select in layout editor, if it's open
	if (parent.m_tabs.SelectionGet() == 0 && parent.m_tabs.ItemGetCount() == 2)
	{
		// Find a CObj for the CObjType
		CObjType* pType;
		long ID = objects.GetItemData(Item);

		if (ID == -1)
			return; //folder

		application->object_types.Lookup(ID, pType);

		// Find out if this is a nonframe object
		CPlugin plugin = GetPlugin(pType->DLLIndex);

		if (plugin.m_Flags & OF_NODRAW)
			return;

		CLayout* pLayout = parent.layout_editor[0][0]->layout;

		// We're creating a duplicate
		g_bDuplicate = TRUE;

		parent.layout_editor[0][0]->m_sel.RemoveAll();

		// Iterate each instance
		POSITION InstancePos = pLayout->objects.GetStartPosition();
		long unused = 0;
		CObj* pObj;

		while (InstancePos)
		{
			pLayout->objects.GetNextAssoc(InstancePos, unused, pObj);

			// Add 
			if (pObj->editObject->ObjectIdentifier == pType->ObjectIdentifier)
				break;
		}

		long OID = pObj->GetInstanceID();

		parent.layout_editor[0][0]->m_sel.AddTail(OID);
		CPoint pt = pObj->GetObjectRect(parent.layout_editor[0][0]).GetBoundingRect().CenterPoint();

		parent.layout_editor[0][0]->m_oldPt = pt;
		pt.Offset(3,3);

		parent.layout_editor[0][0]->InitializeMove(pt);
	}
}
开发者ID:segafan,项目名称:Construct-classic,代码行数:60,代码来源:Object+Bar.cpp

示例6: CProgressRateZone

CObj* CProgressRateZone::Create(CDevice* _pDevice)
{
	CObj* pObj = new CProgressRateZone(_pDevice);
	if (FAILED(pObj->Init()))
		::Safe_Delete(pObj);

	return pObj;
}
开发者ID:NewCordingBirds,项目名称:InTheGorest,代码行数:8,代码来源:ProgressRateZone.cpp

示例7: CAmmo

CObj* CAmmo::Create(CDevice* _pDevice)
{
	CObj* pObj = new CAmmo(_pDevice);
	if (FAILED(pObj->Init()))
		::Safe_Delete(pObj);

	return pObj;
}
开发者ID:NewCordingBirds,项目名称:InTheGorest,代码行数:8,代码来源:Ammo.cpp

示例8: CSkyBox

CObj* CSkyBox::Create(CDevice* _pDevice, const wstring& _wstrTextureKey)
{
	CObj* pObj = new CSkyBox(_pDevice);
	if (FAILED(pObj->Init()))
		::Safe_Delete(pObj);

	((CSkyBox*)pObj)->AddComponent(_wstrTextureKey);

	return pObj;
}
开发者ID:NewCordingBirds,项目名称:InTheGorest,代码行数:10,代码来源:SkyBox.cpp

示例9: CBlock

void CGameFrameWork::CreateBlock(const Point2D& pos)
{
	vector<Tile*> tile = dynamic_cast<CBoard*>(m_pBoard)->GetTile();

	int idx = 0;

	for (auto p = tile.cbegin(); p != tile.cend(); ++p, ++idx)
	{
		if ((*p)->pos.x == pos.x && (*p)->pos.y == pos.y)
			break;
	}

	tile[idx]->option = 1;

	CObj* block = new CBlock(pos, 2, idx);
	block->Initialize();

	m_vecBlock.push_back(block);
}
开发者ID:ricky626,项目名称:WindowsAPI-Programming,代码行数:19,代码来源:GameFrameWork.cpp

示例10: OpenFileDialog

//	Check the point on BC1
//	and check the element line
void Utility::processPointIndex()
{

	CString fileObjPath = OpenFileDialog(FILE_TYPE_OBJ, "Open whole object");
	CString fileBCPath = OpenFileDialog(FILE_TYPE_OBJ, "Open Boundary data");
	if(fileObjPath.IsEmpty() || fileBCPath.IsEmpty())
		return;
	
	CObj object;
	CObj BCObj;


	if(object.ReadObjData(fileObjPath.GetBuffer()) && BCObj.ReadObjData(fileBCPath.GetBuffer()))
	{
		int* BCNode = new int[BCObj.PointNum()];
		int index = 0;
		for (int i = 0; i< object.PointNum(); i++)
		{
			vec3d* curPoint = (object.Point() + i);
			//Check if this point belong to boundary
			for (int j = 0; j < BCObj.PointNum(); j++)
			{
				vec3d* curBCPoint = (BCObj.Point() + j);
				if(*curPoint == *curBCPoint)
				{
					*(BCNode + index++) = i;
					break;
				}
			}
		}

		//Write to file
		CString output = fileBCPath;
		output.Delete(output.GetLength()-3,3);
		output += "txt";
		if(FILE* fp = fopen(output.GetBuffer(), "w"))
		{
			for(int i=0; i<index;i++)
				fprintf(fp,"%d\n",*(BCNode + i));

			fclose(fp);

			AfxMessageBox("Process finished", MB_OK|MB_ICONINFORMATION);
		}
		delete []BCNode;
	}
}
开发者ID:tranthudo,项目名称:ERCP1.0,代码行数:49,代码来源:Utility.cpp

示例11: srand

void CGameFrameWork::CreateBlock()
{
	srand(unsigned(time(NULL)));

	vector<Tile*> tile = dynamic_cast<CBoard*>(m_pBoard)->GetTile();

	int idx = rand() % 16;

	while (tile[idx]->option != 0)
		idx = rand() % 16;

	tile[idx]->option = 1;

	CObj* block = new CBlock(tile[idx]->pos, 2, idx);
	block->Initialize();

	m_vecBlock.push_back(block);

	/////////////////////////////////////////
	m_NewBlockPos = tile[idx]->pos;
	/////////////////////////////////////////
}
开发者ID:ricky626,项目名称:WindowsAPI-Programming,代码行数:22,代码来源:GameFrameWork.cpp

示例12: GetOINFO

void AnimatorBar::AnimationHasChanged()
{
	if(m_pObjType)
	{
		OINFO* info = GetOINFO(m_pObjType->DLLIndex);

		vector<CObj*> objs;
		CObj* o;

		POSITION pos = application->layouts.GetHeadPosition();
		while(pos)
		{
			CLayout* layout = application->layouts.GetNext(pos);
			
			POSITION pos2 = layout->objects.GetStartPosition();

			for (int i = 0; i < layout->objects.GetCount(); i++) 
			{
				long ID;
				layout->objects.GetNextAssoc(pos2, ID, o);

				if (o->GetGlobalID() == m_pObjType->ObjectIdentifier)
						objs.push_back(o);

			}
		}

		// Now loop each of the objects and call the end animation function.
		for(vector<CObj*>::iterator i = objs.begin(); i!= objs.end(); i++)
		{
			if(info->ETOnNotify)
				info->ETOnNotify((*i)->editObject, 2);
		}
		if(objs.size() > 0)
			if(info->ETOnNotify)
				info->ETOnNotify((*objs.begin())->editObject, 3);
	}
}
开发者ID:aolko,项目名称:construct,代码行数:38,代码来源:Animator+Bar.cpp

示例13: Update

void CMixer::Update(const float dt, const uint32_t ticks)
{
    OBJITER iter;
    CObj* obj;
    bool success;

    for(iter=m_world->ObjBegin();iter!=m_world->ObjEnd();iter++)
    {
        obj = (*iter).second;

        if(obj->GetSound() && !obj->GetSoundState()->is_playing)
        {
            success = obj->GetSound()->Play(obj->GetSoundState());

            CObj* localplayer = m_world->GetLocalObj();
            if(success && localplayer)
            {
                // Distance to sound source
                const vec3_t diff = localplayer->GetOrigin() - obj->GetOrigin();
                const float dist = std::min(diff.Abs(), SOUND_MAX_DIST);
                int volume = (int)(dist*255/SOUND_MAX_DIST);
                if(volume > 255)
                    volume = 255;

                uint16_t angle; // 0-360 deg. for Mix_SetPosition
                vec3_t playerlook; // player is looking in this direction
                float fAlpha; // riwi to sound source
                float fBeta; // riwi look dir
                m_world->GetLocalController()->GetDir(&playerlook, NULL, NULL);

                fAlpha = atan2(diff.x, -diff.z);
                fBeta = atan2(playerlook.x, -playerlook.z);
                angle = (uint16_t)((fAlpha - fBeta)*180/lynxmath::PI);
                Mix_SetPosition(obj->GetSoundState()->cur_channel,
                                angle, (uint8_t)volume);
            }
        }
    }
}
开发者ID:jnz,项目名称:Lynx,代码行数:39,代码来源:Mixer.cpp

示例14: safe_delete

void CDialogMsg::Render( C2DRender* p2DRender )
{
	CSize size;	
	LPCUSTOMTEXT lpCustomText;
	for( int i = 0; i < m_textArray.GetSize(); i++ )
	{
		lpCustomText = (LPCUSTOMTEXT) m_textArray.GetAt( i );
		if( lpCustomText->m_timer.TimeOut() )
		{
			// 퀘스트 이모티콘을 다시 보이게 한다.
			if( lpCustomText->m_pObj->GetType() == OT_MOVER )
				((CMover*)lpCustomText->m_pObj)->m_bShowQuestEmoticon = TRUE;
			safe_delete( lpCustomText );
			m_textArray.RemoveAt( i );
			i --;
		}
		else
		{
			LPCTSTR lpStr = lpCustomText->m_string;
			lpCustomText->m_pFont->GetTextExtent( (TCHAR*)lpStr, &size );
			CObj* pObj = lpCustomText->m_pObj;

			if( pObj->IsCull() == FALSE )
			{
				int nAlpha = 200;
				if( lpCustomText->m_timer.GetLeftTime() > 4000 )
					nAlpha = 200 - ( ( lpCustomText->m_timer.GetLeftTime() - 4000 )* 200 / 1000 );
				LPDIRECT3DDEVICE9 pd3dDevice = p2DRender->m_pd3dDevice;

				// 월드 좌표를 스크린 좌표로 프로젝션 한다.
				D3DXVECTOR3 vOut, vPos = pObj->GetPos(), vPosHeight;
				D3DVIEWPORT9 vp;
				const BOUND_BOX* pBB = pObj->m_pModel->GetBBVector();

				pd3dDevice->GetViewport( &vp );

				D3DXMATRIX matTrans;
				D3DXMATRIX matWorld;
				D3DXMatrixIdentity(&matWorld);
				D3DXMatrixTranslation( &matTrans, vPos.x, vPos.y , vPos.z);

				D3DXMatrixMultiply( &matWorld, &matWorld, &pObj->GetMatrixScale() );
				D3DXMatrixMultiply( &matWorld, &matWorld, &pObj->GetMatrixRotation() );
				D3DXMatrixMultiply( &matWorld, &matWorld, &matTrans );

				vPosHeight = pBB->m_vPos[0];
				vPosHeight.x = 0;
				vPosHeight.z = 0;
				
				D3DXVec3Project( &vOut, &vPosHeight, &vp, &pObj->GetWorld()->m_matProj,
					&pObj->GetWorld()->m_pCamera->m_matView, &matWorld);
			
				CRect rect = lpCustomText->m_rect;
				vOut.x -= rect.Width() / 2;
				vOut.y -= rect.Height();
				CRectClip rectClip = p2DRender->m_clipRect;
				DWORD dwLineCount = lpCustomText->m_string.GetLineCount();
				DWORD dwMaxHeight = lpCustomText->m_pFont->GetMaxHeight();
				CPoint ptOrigin = p2DRender->GetViewportOrg();
				p2DRender->SetViewportOrg( 0, 0 );
				int x = vOut.x;
				int y = vOut.y;
				int nHeight = rect.Height() / 8;
				int nWidth  = rect.Width()  / 8;

				for( int i = 0; i < nHeight; i++)
				{
					int nIndex;
					if( i == 0 ) 
						nIndex = 0; 
					else if( i != nHeight - 1 ) 
						nIndex = 3;
					else 
						nIndex = 6;
					for( int j = 0; j < nWidth; j++)
					{
						CPoint point = CPoint( x + j * 8, y + i * 8);
						if( j == 0 )
							m_texPack.Render( p2DRender, point, nIndex, nAlpha ); 
						else
						if( j != nWidth - 1 )
						{
							// 맨 밑쪽 
							/*
							if( i == nHeight - 1 ) 
							{
								if( nWidth >= 6 && ( j == 3 * nWidth / 5 || j == 3 * nWidth / 5 + 1) )
								{ m_texPack.Render( p2DRender, point, 4); continue; } // 5 : 3 = 10 : 6 
								else
								if( nWidth == 5 && ( j == 2 || j == 3 ) )
								{ m_texPack.Render( p2DRender, point, 4); continue; }
								else
								if( nWidth == 4 && j == 2 )
								{ m_texPack.Render( p2DRender, point, 4); continue; }
								else
								if( nWidth == 3 && j == 1 )
								{ m_texPack.Render( p2DRender, point, 4); continue; }
							}*/
							m_texPack.Render( p2DRender, point, nIndex + 1, nAlpha); 
						}
//.........这里部分代码省略.........
开发者ID:KerwinMa,项目名称:SourceFlyFF,代码行数:101,代码来源:DialogMsg.cpp

示例15: CObj

bool CLayout::Serialize(CArchive& ar)
{
	CString ExpectedName = "CLayout";
	int     Version      = 5;

	if (!SerializeClassHeader(ExpectedName, Version, ar))
		return false;

	g_pFrame = this;
	if(ar.IsLoading())
	{
		ar >> identifier >> m_w >> m_h >> m_Name >> m_clr >> m_unboundedScrolling >> application_background;
		
		m_ObjectFrameIsLockedTo = 0;
		m_oTemporyBehaviorInfo=0;	// used inbetwen creation of tempory Behaviors for modifying properties - I use it so if an edittime function is called, we can work out from what object it is if the identifier is -1
		m_pTempMovExt=0;	// used inbetwen creation of tempory Behaviors for modifying properties - I use it so if an edittime function is called, we can work out from what object it is if the identifier is -1
		m_oControlBehaviorInfo=0;	// If you tell a Behavior to be in control of the frame editor this is used
		m_pControlBehaviorExt=0;// If you tell a Behavior to be in control of the frame editor this is used
		m_pControlBehaviorData=0;	// If you tell a Behavior to be in control of the frame editor, this is used to serialize to once unlocked.
		m_pControlBehaviorDataSize=0;
		m_ParentObjectFrameIsLockedTo=0;

		objects.RemoveAll();
		long objCnt;

		ar >> objCnt;
		CObj *o;
		int i;
		for (i = 0; i < objCnt; i++) 
		{
			long nKey;
			ar >> nKey;
			o = new CObj();

			if (!o->Serialize(ar))
				return false;

			objects.SetAt(nKey, o);
		}

		ar >> objCnt;
		CLayer *layer;
		for (i = 0; i < objCnt; i++)
		{
			layer = new CLayer("", LAYER_NORMAL);

			if (!layer->Serialize(ar))
				return false;

			layers.AddTail(layer);
			if (i == 1)
				current_layer = layer;
		}

		if (Version < 4)
		{
			// add non-layout layer if one doesn't exist
			if (layers.GetHead()->m_layerType != LAYER_NONFRAME)
			{
				CString layer_name;
				layer_name.Format("Non-layout");
				CLayer* nonlayout_layer = new CLayer(layer_name, LAYER_NONFRAME);
				nonlayout_layer->m_state = LAYSTATE_HIDDEN;

				nonlayout_layer->m_layerID = application->m_layerID++;
				layers.AddHead(nonlayout_layer);
			}
		}

		ar >> temporary_event_sheet_id;

		// This changed in v2; make sure the function knows
		if (Version >= 2)
			layoutKeys.Serialize(ar, true);
		else
			layoutKeys.Serialize(ar, false);

		// V3: save grid details
		if (Version >= 3) {
			ar >> m_Grid >> m_SnapMovements >> m_SnapResize >> m_GridWidth >> m_GridHeight;
		}
开发者ID:aolko,项目名称:construct,代码行数:81,代码来源:CLayout.cpp


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