本文整理汇总了C++中CGroupMap类的典型用法代码示例。如果您正苦于以下问题:C++ CGroupMap类的具体用法?C++ CGroupMap怎么用?C++ CGroupMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CGroupMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getEditor
// *********************************************************************************************************
void CDisplayerVisualEntity::setActive(bool active)
{
//H_AUTO(R2_CDisplayerVisualEntity_setActive)
if (active && !getActive())
{
if (getEditor().getEntitySorter())
{
_CreationTimeSwpBufCount = Driver->getSwapBufferCounter();
_ClipBlend = -1.f;
getEditor().getEntitySorter()->registerEntityDisplayer(this);
}
_RegisteredInEditor = true;
updateWorldMapPresence();
}
if (!active && getActive())
{
if (getEditor().getEntitySorter())
{
getEditor().getEntitySorter()->unregisterEntityDisplayer(this);
}
eraseEntity();
// in map
if (_MapDeco.isAddedToMap())
{
CGroupMap *gm = CTool::getWorldMap();
if (gm) gm->removeDeco(&_MapDeco);
}
deletePlaceHolder();
_RegisteredInEditor = false;
}
}
示例2: drawPan
// --------------------------------------------------------------------------------------------------------------------
bool CViewPointer::drawPan(CCtrlBase* pCB, NLMISC::CRGBA col)
{
CGroupMap *gm = dynamic_cast<CGroupMap *>(pCB);
if (gm)
{
sint32 texId;
if (ClientCfg.R2EDEnabled && R2::getEditor().getCurrentTool())
{
/** If cursor is set to anything other than the default cursor, use that cursor (because action can be performed on the map
* by the current tool
*/
if (_TxDefault == "curs_default.tga")
{
texId = gm->isPanning() ? _TxIdPanR2 : _TxIdCanPanR2;
}
else return false;
}
else
{
texId = gm->isPanning() ? _TxIdPan : _TxIdCanPan;
}
drawCursor(texId, col, 0);
return true;
}
return false;
}
示例3: nlassert
//*********************************************************
void CDisplayerVisualActivitySequence::setWorldMapNumEdges(uint count)
{
//H_AUTO(R2_CDisplayerVisualActivitySequence_setWorldMapNumEdges)
// TODO nico : try to factor with CPrimRender::setWorldMapNumEdges
nlassert(_AddedToWorldMap);
CGroupMap *gm = CTool::getWorldMap();
nlassert(gm);
if (count < _WorldMapEdges.size())
{
for(uint k = count; k < _WorldMapEdges.size(); ++k)
{
gm->delCtrl(_WorldMapEdges[k]);
}
}
else
{
uint left = count - (uint)_WorldMapEdges.size();
while (left --)
{
CCtrlQuad *cq = new CCtrlQuad;
cq->setModulateGlobalColor(false);
cq->setActive(true);
gm->addCtrl(cq);
cq->setParent(gm);
cq->setRenderLayer(1);
_WorldMapEdges.push_back(cq);
}
}
_WorldMapEdges.resize(count);
for(uint k = 0; k < count; ++k)
{
_WorldMapEdges[k]->setTexture(CV_FootStepMapTexture.get());
}
}
示例4: getGroupingCandidate
//***************************************************************
void CAutoGroup::update(const CVector &testPos, const std::string &paletteEntry, bool valid)
{
//H_AUTO(R2_CAutoGroup_update)
_TestPos = testPos;
_PaletteEntry = paletteEntry;
_AutoGroupEnabled = valid;
CInstance *candidate = getGroupingCandidate();
if (!candidate && _AutoGroup.isAddedToWorldMap())
{
clear();
}
else if (candidate)
{
// update the display
if (!_AutoGroup.isAddedToWorldMap())
{
CGroupMap *gm = CTool::getWorldMap();
if (gm)
{
gm->addDeco(&_AutoGroup);
}
}
CDisplayerVisual *dv = candidate->getDisplayerVisual();
nlassert(dv); // should not be null because getGrou^pingCandidate succeeded
_PrimRenderVertices.resize(2);
CVector pos = dv->isCompound() ? dv->getSon(0)->getWorldPos() : dv->getWorldPos();
_PrimRenderVertices[0] = pos;
_PrimRenderVertices[1] = _TestPos;
_AutoGroup.setVertices(_PrimRenderVertices);
_AutoGroup.addDecalsToRenderList();
}
}
示例5: onRemove
//*********************************************************************************************************
void CInstanceMapDeco::onRemove(CGroupMap &owner)
{
//H_AUTO(R2_CInstanceMapDeco_onRemove)
nlassert(_Instance);
nlassert(_Main);
nlassert(_Over);
nlassert(_OverInvalid);
owner.delCtrl(_Main);
_Main = NULL;
owner.delCtrl(_Over);
_Over = NULL;
owner.delCtrl(_OverInvalid);
_OverInvalid = NULL;
if (_Orient)
{
owner.delCtrl(_Orient);
_Orient = NULL;
}
if (_GlowStar[0])
{
_GlowStar[0]->getParent()->delCtrl(_GlowStar[0]);
_GlowStar[0] = NULL;
_GlowStar[1]->getParent()->delCtrl(_GlowStar[1]);
_GlowStar[1] = NULL;
}
_AddedToMap = false;
_Instance = NULL;
}
示例6: isMouseOnWorldMap
//***************************************************************
void CTool::computeWorldViewRay(sint32 posX, sint32 posY, CWorldViewRay &dest)
{
//H_AUTO(R2_CTool_computeWorldViewRay)
CGroupMap *gm = isMouseOnWorldMap();
if (gm)
{
sint32 windowX = posX - gm->getXReal();
sint32 windowY = posY - gm->getYReal();
CVector2f mapPos;
gm->windowToMap(mapPos, windowX, windowY);
if (mapPos.x >= 0.f && mapPos.y >= 0.f && mapPos.x <= 1.f && mapPos.y <= 1.f)
{
CVector2f worldPos;
gm->mapToWorld(worldPos, mapPos);
dest.Dir = -CVector::K;
dest.Origin.set(worldPos.x, worldPos.y, 10000.f); // look from above
dest.OnMiniMap = true;
dest.Right = CVector(1.f, 0.f, 0.f);
dest.Up = CVector(0.f, 1.f, 0.f);
dest.Valid = true;
return;
}
else
{
dest.OnMiniMap = true;
dest.Valid = false;
return;
}
}
uint32 scrW, scrH;
getScreenSize(scrW, scrH);
const NL3D::CFrustum &fru = MainCam.getFrustum();
//
dest.Dir.x = posX / (float) scrW;
dest.Dir.x = fru.Left + (fru.Right - fru.Left) * dest.Dir.x;
dest.Dir.z = posY / (float) scrH;
dest.Dir.z = fru.Bottom + (fru.Top - fru.Bottom) * dest.Dir.z;
dest.Dir.y = fru.Near;
//
dest.Dir /= fru.Near;
CMatrix camMatrix = MainCam.getMatrix();
dest.Right = camMatrix.getI().normed();
dest.Up = camMatrix.getK().normed();
dest.Dir = camMatrix.mulVector(dest.Dir);
dest.Origin = camMatrix.getPos();
dest.OnMiniMap = false;
dest.Valid = true;
// When looking upward, the camera may be "snapped" to the ground
// In this case, false intersection with the ground may be detected, so move forward
// in ray direction to resolve that problem
const float distBias = 0.20f;
dest.Origin += distBias * dest.Dir;
}
示例7: removeFromWorldMap
//*********************************************************************************************************
void CDisplayerVisualActivitySequence::removeFromWorldMap()
{
//H_AUTO(R2_CDisplayerVisualActivitySequence_removeFromWorldMap)
if (_AddedToWorldMap)
{
CGroupMap *gm = CTool::getWorldMap();
nlassert(gm);
gm->removeDeco(this);
_AddedToWorldMap = false;
}
}
示例8: setContextHelp
//***************************************************************
void CToolCreateEntity::updateBeforeRender()
{
//H_AUTO(R2_CToolCreateEntity_updateBeforeRender)
if (_CreateState != DrawArray)
{
CToolChoosePos::updateBeforeRender();
_AutoGroup.update(_CreatePosition, _PaletteId, _Valid && !isCtrlDown());
setContextHelp(CI18N::get(_AutoGroup.getGroupingCandidate() ? "uiR2EDToolCreateEntityAutoGroup" : "uiR2EDToolCreateEntity"));
return;
}
setContextHelp(CI18N::get("uiR2EDDrawArrayContextHelp"));
// update for array mode
bool valid = true;
sint32 mouseX, mouseY;
getMousePos(mouseX, mouseY);
if (!isInScreen(mouseX, mouseY) || (isMouseOnUI() && !isMouseOnWorldMap()))
{
valid = false;
_ArrayEnd = _ArrayOrigin;
}
//
CTool::CWorldViewRay worldViewRay;
computeWorldViewRay(mouseX, mouseY, worldViewRay);
//
CVector entityPos; // the pos where the ghost will be shown
CVector inter; // intersection of view ray with landscape
_ValidArray = true;
TRayIntersectionType rayIntersectionType = computeLandscapeRayIntersection(worldViewRay, inter);
switch(rayIntersectionType)
{
case NoIntersection:
_ValidArray = false;
_ArrayEnd = _ArrayOrigin;
break;
case ValidPacsPos:
case InvalidPacsPos:
_ArrayEnd = inter;
break;
}
for (uint k = 0; valid && k < _ArrayElements.size(); ++k)
{
if (_ArrayElements[k])
{
if (_ArrayElements[k]->getDisplayFlag(CDisplayerVisual::FlagBadPos))
{
_ValidArray = false;
}
}
}
CGroupMap *worldMap = getWorldMap();
if (worldMap) worldMap->setSelectionAxis(_ValidArray);
setMouseCursor(_ValidArray ? _CursValid.c_str() : _CursInvalid.c_str());
}
示例9: clear
//***************************************************************
void CAutoGroup::clear()
{
//H_AUTO(R2_CAutoGroup__clear)
if (_AutoGroup.isAddedToWorldMap())
{
CGroupMap *gm = CTool::getWorldMap();
if (gm)
{
gm->removeDeco(&_AutoGroup);
}
}
_AutoGroup.clear();
}
示例10: onAdd
//*********************************************************************************************************
void CInstanceMapDeco::onAdd(CGroupMap &owner)
{
//H_AUTO(R2_CInstanceMapDeco_onAdd)
nlassert(_Instance);
nlassert(!_Main);
nlassert(!_Over);
nlassert(!_OverInvalid);
_Main = new CCtrlButtonEntity(*_Instance);
_Main->setPosRef(Hotspot_MM);
_Main->setParentPosRef(Hotspot_BL);
_Main->setModulateGlobalColorAll(false);
owner.addCtrl(_Main);
_Main->setParent(&owner);
_Main->setRenderLayer(2);
_Main->setId(owner.getId() + ":" + _Instance->getId());
_Main->setActive(_Active);
//
_Over = newQuad(owner);
_Over->setRenderLayer(3);
_Over->setActive(_Active);
//
_OverInvalid = newQuad(owner);
_OverInvalid->setRenderLayer(4);
_OverInvalid->setActive(_Active && _InvalidPos);
//
if (_Orientable)
{
_Orient = newQuad(owner);
_Orient->setTexture(CV_MapEntityOrientTexture.get());
_Orient->setRenderLayer(3);
_Orient->setActive(_Active);
}
//
CInterfaceGroup *window = owner.getParentContainer();
if (window)
{
for(uint k = 0; k < 2; ++k)
{
_GlowStar[k] = new CCtrlQuad;
_GlowStar[k]->setActive(false);
_GlowStar[k]->setModulateGlobalColor(false);
window->addCtrl(_GlowStar[k]);
_GlowStar[k]->setParent(window);
_GlowStar[k]->setAdditif(true);
_GlowStar[k]->setTexture(CV_MapGlowStarTexture.get());
}
}
_AddedToMap = true;
}
示例11: onAdd
// *********************************************************
void CPrimRender::onAdd(CGroupMap &owner)
{
//H_AUTO(R2_CPrimRender_onAdd)
nlassert(!_AddedToWorldMap);
_AddedToWorldMap = true;
_WorldMapPoly = newCtrlPolygon(); // TODO: create only if needed
_WorldMapPoly->setParent(&owner);
owner.addCtrl(_WorldMapPoly);
_WorldMapPoly->setActive(false);
_WorldMapPoly->setId(owner.getId() + ":" + _WorldMapPoly->getId());
for(uint k = 0; k < _WorldMapEdges.size(); ++k)
{
_WorldMapEdges[k]->setId(_WorldMapPoly->getId() + toString("_e%d", (int) k ));
}
}
示例12: deleteShape
// *********************************************************************************************************
void CDisplayerVisualShape::deleteShape()
{
//H_AUTO(R2_CDisplayerVisualShape_deleteShape)
if (!_Instance.empty())
{
Scene->deleteInstance(_Instance);
}
if (_MapDeco.isAddedToMap())
{
CGroupMap *gm = CTool::getWorldMap();
if (gm)
{
gm->removeDeco(&_MapDeco);
}
}
}
示例13: execute
void execute (CCtrlBase * /* pCaller */, const std::string &sParams)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CGroupMap *pMap = dynamic_cast<CGroupMap*>(CWidgetManager::getInstance()->getElementFromId(sParams));
if (pMap == NULL)
return;
// Get the spawn index (from selected squad)
uint8 nSpawnIndex = getOutpostSquadSpawnIndex();
// Get Spawn index selected by the user
uint8 nSpawnSelected = (uint8)pMap->getRespawnSelected();
if (nSpawnIndex != nSpawnSelected)
{
// get Squad slot
uint8 nSquadSlot = NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:OUTPOST:SQUAD_SLOT_SELECTED")->getValue8();
sendMsgToServer("OUTPOST:SET_SQUAD_SPAWN", getOutpostSheet(), nSquadSlot, nSpawnSelected);
}
}
示例14: onRemove
// *********************************************************
void CPrimRender::onRemove(CGroupMap &owner)
{
//H_AUTO(R2_CPrimRender_onRemove)
nlassert(_AddedToWorldMap);
setWorldMapNumVertices(0);
setWorldMapNumEdges(0);
if (_WorldMapPoly)
{
owner.delCtrl(_WorldMapPoly);
_WorldMapPoly = NULL;
}
_AddedToWorldMap = false;
}
示例15: nlassert
// *********************************************************
void CPrimRender::setWorldMapNumEdges(uint count)
{
//H_AUTO(R2_CPrimRender_setWorldMapNumEdges)
nlassert(_AddedToWorldMap);
CGroupMap *gm = CTool::getWorldMap();
nlassert(gm);
if (count < _WorldMapEdges.size())
{
for(uint k = count; k < _WorldMapEdges.size(); ++k)
{
gm->delCtrl(_WorldMapEdges[k]);
}
}
else
{
uint left = count - (uint)_WorldMapEdges.size();
while (left --)
{
CCtrlQuad *cq = newCtrlQuad((uint)_WorldMapEdges.size());
cq->setModulateGlobalColor(false);
cq->setActive(_Active);
gm->addCtrl(cq);
cq->setParent(gm);
cq->setRenderLayer(1);
_WorldMapEdges.push_back(cq);
if (_WorldMapPoly)
{
cq->setId(_WorldMapPoly->getId() + toString("_e%d", _WorldMapEdges.size() - 1));
}
}
}
_WorldMapEdges.resize(count);
for(uint k = 0; k < count; ++k)
{
_WorldMapEdges[k]->setTexture(_Look.EdgeLook.WorldMapTexture);
_WorldMapEdges[k]->setColorRGBA(_Look.EdgeLook.WorldMapColor);
}
}