本文整理汇总了C++中V2::getY方法的典型用法代码示例。如果您正苦于以下问题:C++ V2::getY方法的具体用法?C++ V2::getY怎么用?C++ V2::getY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类V2
的用法示例。
在下文中一共展示了V2::getY方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
/**
* Move direct to the destination.
* @param field destination field
* @return whether a move was made
*/
bool
MouseControl::moveHardTo(const V2 &field) const
{
bool moved = false;
const Unit *unit = m_controls->getActive();
if (unit) {
V2 loc = unit->getLoc();
if (field.getX() < loc.getX()) {
moved = m_controls->makeMove(unit->myOrder(Dir::DIR_LEFT));
}
else if (loc.getX() + unit->getW() <= field.getX()) {
moved = m_controls->makeMove(unit->myOrder(Dir::DIR_RIGHT));
}
else if (field.getY() < loc.getY()) {
moved = m_controls->makeMove(unit->myOrder(Dir::DIR_UP));
}
else if (loc.getY() + unit->getH() <= field.getY()) {
moved = m_controls->makeMove(unit->myOrder(Dir::DIR_DOWN));
}
}
return moved;
}
示例2: getScreenPos
/**
* Draw model.
* Care about model shift during move.
*/
void
View::drawModel(Cube *model)
{
if (!model->isLost()) {
V2 screenPos = getScreenPos(model);
Anim::eSide side = Anim::SIDE_LEFT;
if (!model->isLeft()) {
side = Anim::SIDE_RIGHT;
}
model->anim()->drawAt(m_screen,
screenPos.getX(), screenPos.getY(), side);
}
}