本文整理汇总了C++中Door::GetOpenedWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ Door::GetOpenedWidth方法的具体用法?C++ Door::GetOpenedWidth怎么用?C++ Door::GetOpenedWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Door
的用法示例。
在下文中一共展示了Door::GetOpenedWidth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CastThroughIntersections
//.........这里部分代码省略.........
fx = ABS(fx);
dx = ABS(dx);
if(LEFT(angle))
{
dx = -dx;
fx = -fx;
}
fx = posX + fx;
fy = posY + fy;
break;
case ID_VERTICAL:
if(LEFT(angle))
{
fx = -(posX - (int)posX);
dx = -1;
}
else
{
fx = (int)posX + 1 - posX;
dx = 1;
}
fy = (float)(TAN(angle)) * (float)(ABS(fx));
dy = (float)(TAN(angle)) * (float)(ABS(dx));
fy = ABS(fy);
dy = ABS(dy);
if(UP(angle))
{
fy = -fy;
dy = -dy;
}
fx = posX + fx;
fy = posY + fy;
break;
}
while(true)
{
mapY = (int)fy;
mapX = (int)fx;
if(dy == -1 && dir == ID_HORIZONTAL)
mapY -= 1;
else if(dx == -1 && dir == ID_VERTICAL)
mapX -= 1;
if(mapX < 0 || mapY < 0 || mapX >= mapW || mapY >= mapH)
break;
else if(map[mapY][mapX] > 0 && map[mapY][mapX] != DOOR_INDEX && map[mapY][mapX] != LOCKED_DOOR_INDEX)
{
hit:
if(dir == ID_HORIZONTAL)
*texelX = fx - (float)mapX;
else
*texelX = fy - (float)mapY;
*texIndex = map[mapY][mapX] - 1;
break;
}
else if(map[mapY][mapX] == DOOR_INDEX || map[mapY][mapX] == LOCKED_DOOR_INDEX)
{
Door *door = GetDoorAt(mapX, mapY);
if(door->GetOpening() || door->GetClosing())
{
float xval;
if(dir == ID_HORIZONTAL)
xval = fx - (float)mapX;
else
xval = fy - (float)mapY;
if(door->GetOpenedWidth() < xval)
goto hit;
}
else if(!door->IsOpen())
goto hit;
}
fx += dx;
fy += dy;
}
a = ABS((fy - posY));
b = ABS((fx - posX));
distance = sqrt(a*a+b*b);
return distance;
}