本文整理汇总了C++中CNavArea::DrawFilled方法的典型用法代码示例。如果您正苦于以下问题:C++ CNavArea::DrawFilled方法的具体用法?C++ CNavArea::DrawFilled怎么用?C++ CNavArea::DrawFilled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CNavArea
的用法示例。
在下文中一共展示了CNavArea::DrawFilled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FrameUpdatePostEntityThink
virtual void FrameUpdatePostEntityThink() override
{
static long frame = 0;
++frame;
if (frame % 22 == 0) {
Enhancement_NotifyDefendersAboutBombs();
}
UpdateTrackers();
#if 0
/* remove me */
if (frame % 7 == 0) {
CCaptureFlag *flag = GetClosestFlagToHatch();
if (flag != nullptr) {
CNavArea *area = TheNavMesh->GetNavArea(flag->GetAbsOrigin());
if (area != nullptr) {
float flag_dist = reinterpret_cast<CTFNavArea *>(area)->GetIncursionDistance(TF_TEAM_BLUE);
constexpr float D_LOW = 0.0f;
constexpr float D_HIGH = 300.0f;
for (auto area : (CUtlVector<CTFNavArea *>&)TheNavAreas) {
float dist = area->GetIncursionDistance(TF_TEAM_BLUE);
if (dist < flag_dist - D_LOW) continue;
if (dist > flag_dist + D_HIGH) continue;
area->DrawFilled(0xff, 0xff, 0xff, 0x00, gpGlobals->interval_per_tick * 7, true, 0.0f);
area->DrawFilled(0xff, 0xff, 0xff, 0x40, gpGlobals->interval_per_tick * 7, true, 0.0f);
}
}
}
}
#endif
#if 0
if (frame % 22 == 0) {
float inc_min = FLT_MAX;
float inc_max = FLT_MIN;
for (auto area : (CUtlVector<CTFNavArea *>&)TheNavAreas) {
float inc = area->GetIncursionDistance(TF_TEAM_BLUE);
if (inc < 0.0f) continue;
if (inc < inc_min) inc_min = inc;
if (inc > inc_max) inc_max = inc;
}
for (auto area : (CUtlVector<CTFNavArea *>&)TheNavAreas) {
float val = area->GetIncursionDistance(TF_TEAM_BLUE);
float rat = RemapValClamped(val, 0.0f, inc_max, 0.0f, 1.0f);
int r;
int g;
int b;
if (rat < 0.25f) {
r = 0xff;
g = RemapValClamped(rat, 0.00f, 0.25f, 0.0f, 255.0f);
b = 0x00;
} else if (rat < 0.50f) {
r = RemapValClamped(rat, 0.25f, 0.50f, 255.0f, 0.0f);
g = 0xff;
b = 0x00;
} else if (rat < 0.75f) {
r = 0x00;
g = 0xff;
b = RemapValClamped(rat, 0.50f, 0.75f, 0.0f, 255.0f);
} else {
r = 0x00;
g = RemapValClamped(rat, 0.75f, 1.00f, 255.0f, 0.0f);
b = 0xff;
}
area->DrawFilled(r, g, b, 0x00, 0.33f, true, 0.0f);
area->DrawFilled(r, g, b, 0x80, 0.33f, true, 0.0f);
NDebugOverlay::EntityTextAtPosition(area->GetCenter(), 0,
CFmtStrN<64>("%.1f%%", rat * 100.0f),
0.33f, 0xff, 0xff, 0xff, 0xff);
// NDebugOverlay::EntityTextAtPosition(area->GetCenter(), 1,
// CFmtStrN<64>("%.0f HU", val),
// 0.33f, 0xff, 0xff, 0xff, 0xff);
}
}
#endif
DrawOverlay_Ownership(frame);
}