本文整理汇总了C++中CGroupMap::getVisibleWorldMax方法的典型用法代码示例。如果您正苦于以下问题:C++ CGroupMap::getVisibleWorldMax方法的具体用法?C++ CGroupMap::getVisibleWorldMax怎么用?C++ CGroupMap::getVisibleWorldMax使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGroupMap
的用法示例。
在下文中一共展示了CGroupMap::getVisibleWorldMax方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onUpdate
//*********************************************************************************************************
void CInstanceMapDeco::onUpdate(CGroupMap &groupMap)
{
//H_AUTO(R2_CInstanceMapDeco_onUpdate)
if (!_Active) return;
nlassert(_Instance);
_GlowStarActive = false;
if (!_Main || !_Over || !_OverInvalid) return;
sint32 x;
sint32 y;
CVector2f worldPos = getWorldPos();
// if not in current map then don't disply anything
CIslandCollision &col = getEditor().getIslandCollision();
R2::CScenarioEntryPoints::CCompleteIsland *currIsland = col.getCurrIslandDesc();
if (currIsland)
{
if (!currIsland->isIn(worldPos))
{
setActive(false);
return;
}
}
groupMap.worldToWindowSnapped(x, y, getWorldPos());
_Main->setX(x);
_Main->setY(y);
CDisplayerVisual *vd = _Instance->getDisplayerVisual();
if (!vd)
{
_Over->setActive(false);
_OverInvalid->setActive(false);
return;
}
//
bool closeView = _CloseTexture.empty() ? false : groupMap.getMeterPerPixel() < CV_MapEntityCloseDist.get();
//
bool selected = vd->getDisplayFlag(CDisplayerVisual::FlagSelected);
bool hasFocus = vd->getDisplayFlag(CDisplayerVisual::FlagHasFocus);
//
setTextureAndFit(closeView ? _CloseTexture : CV_MapEntitySmallTexture.get());
_Main->setColor((selected && ! closeView) ? CV_MapEntitySelectColor.get() : vd->getDisplayModeColorInMap()); // if small icon, then change the icon color directly, because no over will be displayed
//
if (selected || hasFocus)
{
// if the selection is out of the window, then draw an arrow to locate it
const CVector2f &wmin = groupMap.getVisibleWorldMin();
const CVector2f &wmax = groupMap.getVisibleWorldMax();
if (worldPos.x < wmin.x || worldPos.x > wmax.x ||
worldPos.y < wmin.y || worldPos.y > wmax.y)
{
// OUT OF VISIBLE REGION CASE
_Over->setActive(true);
_Over->setColorRGBA(selected ? CV_MapEntitySelectColor.get() : CV_MapEntityHighlightColor.get());
// out of the visible portion, so draw an arrow instead
_Over->setTexture(CV_MapEntityFarTexture.get());
// snap position to inner visible world rect
CVector2f m = 0.5f * (wmin + wmax);
CVector2f dir = worldPos - m;
CVector2f inter;
float d0;
float d1;
if (dir.x > 0.f)
{
d0 = (wmax.x - m.x) / dir.x;
if (dir.y > 0.f)
{
d1 = (wmax.y - m.y) / dir.y;
inter = m + std::min(d0, d1) * dir;
}
else if (dir.y < 0.f)
{
d1 = (wmin.y - m.y) / dir.y;
inter = m + std::min(d0, d1) * dir;
}
else
{
inter.set(wmax.x, m.y);
}
}
else if (dir.x < 0.f)
{
d0 = (wmin.x - m.x) / dir.x;
if (dir.y > 0.f)
{
d1 = (wmax.y - m.y) / dir.y;
inter = m + std::min(d0, d1) * dir;
}
else if (dir.y < 0.f)
{
d1 = (wmin.y - m.y) / dir.y;
inter = m + std::min(d0, d1) * dir;
}
else
{
inter.set(wmin.x, m.y);
}
}
else
{
if (dir.y > 0.f)
{
//.........这里部分代码省略.........