本文整理汇总了C++中Being::getCollisionRadius方法的典型用法代码示例。如果您正苦于以下问题:C++ Being::getCollisionRadius方法的具体用法?C++ Being::getCollisionRadius怎么用?C++ Being::getCollisionRadius使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Being
的用法示例。
在下文中一共展示了Being::getCollisionRadius方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _drawDebugPath
void Viewport::_drawDebugPath(Graphics *graphics)
{
if (mDebugFlags & Map::MAP_MOUSE_PATH)
{
// Get the current mouse position
SDL_GetMouseState(&mMouseX, &mMouseY);
// Prepare the walkmask corresponding to the protocol
unsigned char walkMask;
switch (Net::getNetworkType())
{
case ServerInfo::TMWATHENA:
walkMask = Map::BLOCKMASK_WALL | Map::BLOCKMASK_CHARACTER;
break;
case ServerInfo::MANASERV:
default:
walkMask = Map::BLOCKMASK_WALL;
break;
}
static Path debugPath;
static Vector lastMouseDestination = Vector(0.0f, 0.0f);
Vector mouseDestination(mMouseX + (int) mPixelViewX,
mMouseY + (int) mPixelViewY);
if (mouseDestination.x != lastMouseDestination.x
|| mouseDestination.y != lastMouseDestination.y)
{
const Vector &playerPos = player_node->getPosition();
// Adapt the path finding to the precision requested
if (Net::getPlayerHandler()->usePixelPrecision())
{
debugPath = mMap->findPixelPath((int) playerPos.x,
(int) playerPos.y,
mouseDestination.x,
mouseDestination.y,
player_node->getCollisionRadius(),
walkMask);
}
else
{
debugPath = mMap->findTilePath((int) playerPos.x,
(int) playerPos.y,
mouseDestination.x,
mouseDestination.y,
walkMask);
}
lastMouseDestination = mouseDestination;
}
_drawPath(graphics, debugPath, gcn::Color(128, 0, 128, 150));
}
// Draw the path debug information for every beings.
ActorSpritesConstIterator it, it_end;
const ActorSprites &actors = actorSpriteManager->getAll();
for (it = actors.begin(), it_end = actors.end() ; it != it_end; it++)
{
Being *being = dynamic_cast<Being*>(*it);
if (!being)
continue;
const Vector &beingPos = being->getPosition();
graphics->setColor(gcn::Color(128, 128, 0, 150));
if (mDebugFlags & Map::MAP_BEING_COLLISION_RADIUS)
{
const int radius = being->getCollisionRadius();
graphics->fillRectangle(gcn::Rectangle(
(int) beingPos.x
- (int) mPixelViewX - radius,
(int) beingPos.y - (int) mPixelViewY
- radius,
radius * 2, radius * 2));
}
if (mDebugFlags & Map::MAP_BEING_PATH)
_drawPath(graphics, being->getPath(), gcn::Color(0, 0, 255, 150));
if (mDebugFlags & Map::MAP_BEING_POSITION)
{
// Draw the absolute x, y position using a cross.
graphics->setColor(gcn::Color(0, 0, 255, 255));
graphics->drawLine((int) beingPos.x - (int) mPixelViewX - 4,
(int) beingPos.y - (int) mPixelViewY - 4,
(int) beingPos.x - (int) mPixelViewX + 4,
(int) beingPos.y - (int) mPixelViewY + 4);
graphics->drawLine((int) beingPos.x - (int) mPixelViewX + 4,
(int) beingPos.y - (int) mPixelViewY - 4,
(int) beingPos.x - (int) mPixelViewX - 4,
(int) beingPos.y - (int) mPixelViewY + 4);
}
}
}