本文整理汇总了C++中Train::GetNextArticulatedPart方法的典型用法代码示例。如果您正苦于以下问题:C++ Train::GetNextArticulatedPart方法的具体用法?C++ Train::GetNextArticulatedPart怎么用?C++ Train::GetNextArticulatedPart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Train
的用法示例。
在下文中一共展示了Train::GetNextArticulatedPart方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HighlightDragPosition
/**
* Highlight the position where a rail vehicle is dragged over by drawing a light gray background.
* @param px The current x position to draw from.
* @param max_width The maximum space available to draw.
* @param selection Selected vehicle that is dragged.
* @param chain Whether a whole chain is dragged.
* @return The width of the highlight mark.
*/
static int HighlightDragPosition(int px, int max_width, VehicleID selection, bool chain)
{
bool rtl = _current_text_dir == TD_RTL;
assert(selection != INVALID_VEHICLE);
int dragged_width = WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
for (Train *t = Train::Get(selection); t != NULL; t = chain ? t->Next() : (t->HasArticulatedPart() ? t->GetNextArticulatedPart() : NULL)) {
dragged_width += t->GetDisplayImageWidth(NULL);
}
int drag_hlight_left = rtl ? max(px -dragged_width, 0) : px;
int drag_hlight_right = rtl ? px : min(px + dragged_width, max_width);
int drag_hlight_width = max(drag_hlight_right - drag_hlight_left, 0);
if (drag_hlight_width > 0) {
GfxFillRect(drag_hlight_left + WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP + 1,
drag_hlight_right - WD_FRAMERECT_RIGHT, ScaleGUITrad(13) - WD_FRAMERECT_BOTTOM, _colour_gradient[COLOUR_GREY][7]);
}
return drag_hlight_width;
}