本文整理汇总了C++中Point::Moved方法的典型用法代码示例。如果您正苦于以下问题:C++ Point::Moved方法的具体用法?C++ Point::Moved怎么用?C++ Point::Moved使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point
的用法示例。
在下文中一共展示了Point::Moved方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExamineUnit
void Chest::ExamineUnit(ui::Gui &table, const Point &start, const Point &range) const
{
Point nameplate = start.Moved(Point(1, 0));
// name
table.SetTextColor(Color(1, 1, 1));
table.Write(nameplate, "Chest");
table.Write(nameplate.Moved(Point(0, 2)), "Press E");
table.Write(nameplate.Moved(Point(0, 3)), "to loot");
}
示例2: ExamineUnit
void Actor::ExamineUnit(ui::Gui &table, const Point &start, const Point &range) const
{
Point nameplate = start.Moved(Point(1, 0));
Point hp = start.Moved(Point(1, 2));
Point mp = start.Moved(Point(1, 4));
Point effect_position = start.Moved(Point(1, 6));
// name
Name name = GetName();
if (name.length() > 0)
{
table.SetTextColor(Color(1, 1, 1));
table.Write(nameplate, name);
}
// bars
int bar_length = range.X - 2;
int current_health = GetCurrentHealth();
int max_health = GetMaximumHealth();
int current_energy = GetCurrentEnergy();
int max_energy = GetMaximumEnergy();
max_health = (max_health == 0) ? 1 : max_health;
max_energy = (max_energy == 0) ? 1 : max_energy;
int green = bar_length * current_health / max_health;
green = (green == 0 && current_health > 0) ? 1 : green;
green = (green < 0) ? 0 : green;
int blue = bar_length * current_energy / max_energy;
blue = (blue == 0 && current_energy > 0) ? 1 : blue;
blue = (blue < 0) ? 0 : blue;
table.Rectangle(hp, Point(green, 1), 0x085200);
table.Rectangle(hp.Moved(Point(green, 0)), Point(bar_length - green, 1), 0x642800);
table.Rectangle(mp, Point(blue, 1), 0x6b839c);
table.Rectangle(mp.Moved(Point(blue, 0)), Point(bar_length - blue, 1), 0xf0bf9f);
table.SetTextColor(0x1f0c00);
table.WriteInteger(hp.Moved(Point(bar_length - 1, 0)), current_health);
table.WriteInteger(mp.Moved(Point(bar_length - 1, 0)), current_energy);
table.Write(hp.Moved(Point(1, 0)), "HP");
table.Write(mp.Moved(Point(1, 0)), "EP");
// effects
table.SetTextColor(Color(1, 1, 1));
for (auto i = _effects.cbegin(); i != _effects.cend(); ++i)
{
table.Write(effect_position, i->GetName());
effect_position.Y += 2;
}
}