本文整理汇总了C++中MapLine::getLength方法的典型用法代码示例。如果您正苦于以下问题:C++ MapLine::getLength方法的具体用法?C++ MapLine::getLength怎么用?C++ MapLine::getLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapLine
的用法示例。
在下文中一共展示了MapLine::getLength方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
/* InfoOverlay3D::update
* Updates the info text for the object of [item_type] at [item_index]
* in [map]
*******************************************************************/
void InfoOverlay3D::update(int item_index, int item_type, SLADEMap* map)
{
// Clear current info
info.clear();
info2.clear();
// Setup variables
current_type = item_type;
texname = "";
texture = NULL;
thing_icon = false;
int map_format = theMapEditor->currentMapDesc().format;
// Wall
if (item_type == MapEditor::SEL_SIDE_BOTTOM || item_type == MapEditor::SEL_SIDE_MIDDLE || item_type == MapEditor::SEL_SIDE_TOP)
{
// Get line and side
MapSide* side = map->getSide(item_index);
if (!side) return;
MapLine* line = side->getParentLine();
if (!line) return;
object = side;
// --- Line/side info ---
info.push_back(S_FMT("Line #%d", line->getIndex()));
if (side == line->s1())
info.push_back(S_FMT("Front Side #%d", side->getIndex()));
else
info.push_back(S_FMT("Back Side #%d", side->getIndex()));
// Relevant flags
string flags = "";
if (theGameConfiguration->lineBasicFlagSet("dontpegtop", line, map_format))
flags += "Upper Unpegged, ";
if (theGameConfiguration->lineBasicFlagSet("dontpegbottom", line, map_format))
flags += "Lower Unpegged, ";
if (theGameConfiguration->lineBasicFlagSet("blocking", line, map_format))
flags += "Blocking, ";
if (!flags.IsEmpty())
flags.RemoveLast(2);
info.push_back(flags);
info.push_back(S_FMT("Length: %d", (int)line->getLength()));
// Other potential info: special, sector#
// --- Wall part info ---
// Part
if (item_type == MapEditor::SEL_SIDE_BOTTOM)
info2.push_back("Lower Texture");
else if (item_type == MapEditor::SEL_SIDE_MIDDLE)
info2.push_back("Middle Texture");
else
info2.push_back("Upper Texture");
// Offsets
if (theGameConfiguration->udmfNamespace() == "zdoom")
{
// Get x offset info
int xoff = side->intProperty("offsetx");
double xoff_part = 0;
if (item_type == MapEditor::SEL_SIDE_BOTTOM)
xoff_part = side->floatProperty("offsetx_bottom");
else if (item_type == MapEditor::SEL_SIDE_MIDDLE)
xoff_part = side->floatProperty("offsetx_mid");
else
xoff_part = side->floatProperty("offsetx_top");
// Add x offset string
string xoff_info;
if (xoff_part == 0)
xoff_info = S_FMT("%d", xoff);
else if (xoff_part > 0)
xoff_info = S_FMT("%1.2f (%d+%1.2f)", (double)xoff+xoff_part, xoff, xoff_part);
else
xoff_info = S_FMT("%1.2f (%d-%1.2f)", (double)xoff+xoff_part, xoff, -xoff_part);
// Get y offset info
int yoff = side->intProperty("offsety");
double yoff_part = 0;
if (item_type == MapEditor::SEL_SIDE_BOTTOM)
yoff_part = side->floatProperty("offsety_bottom");
else if (item_type == MapEditor::SEL_SIDE_MIDDLE)
yoff_part = side->floatProperty("offsety_mid");
else
yoff_part = side->floatProperty("offsety_top");
// Add y offset string
string yoff_info;
if (yoff_part == 0)
yoff_info = S_FMT("%d", yoff);
else if (yoff_part > 0)
yoff_info = S_FMT("%1.2f (%d+%1.2f)", (double)yoff+yoff_part, yoff, yoff_part);
else
//.........这里部分代码省略.........