static const T_choice *IFindChoiceDown(const T_choice *aChoiceList, const T_choice *aSelectedChoice, TUInt32 aSearchRange) { const T_choice *p; TUInt32 ySmallestDiff = UEZPlatform_LCDGetHeight(); TUInt32 xDiff, yDiff; const T_choice *p_nextChoice = aSelectedChoice; for (p = aChoiceList; p->iText; p++) { if(p != aSelectedChoice) { yDiff = yMid(p) - yMid(aSelectedChoice); xDiff = absDiff(xMid(aSelectedChoice), xMid(p)); if((yDiff < ySmallestDiff) && (xDiff<(yDiff/aSearchRange))) { ySmallestDiff = yDiff; p_nextChoice = p; } } } // If we didn't find a new, choice. Lets wrap around our search if(p_nextChoice == aSelectedChoice) { ySmallestDiff = UEZPlatform_LCDGetHeight(); for (p = aChoiceList; p->iText; p++) { if(p != aSelectedChoice) { yDiff = yMid(aSelectedChoice); xDiff = absDiff(xMid(aSelectedChoice), xMid(p)); if((yDiff < ySmallestDiff) && (xDiff<(yDiff/aSearchRange))) { ySmallestDiff = yDiff; p_nextChoice = p; } } } } return p_nextChoice; }
static const T_choice *IFindChoiceLeft(const T_choice *aChoiceList, const T_choice *aSelectedChoice, TUInt32 aSearchRange) { const T_choice *p; TUInt32 xSmallestDiff = UEZPlatform_LCDGetWidth(); TUInt32 xDiff, yDiff; const T_choice *p_nextChoice = aSelectedChoice; for (p = aChoiceList; p->iText; p++) { if(p != aSelectedChoice) { xDiff = xMid(aSelectedChoice) - xMid(p); yDiff = absDiff(yMid(aSelectedChoice), yMid(p)); if((xDiff < xSmallestDiff) && (yDiff<(xDiff/aSearchRange))) { xSmallestDiff = xDiff; p_nextChoice = p; } } } // If we didn't find a new, choice. Lets wrap around our search if(p_nextChoice == aSelectedChoice) { xSmallestDiff = UEZPlatform_LCDGetWidth(); for (p = aChoiceList; p->iText; p++) { if(p != aSelectedChoice) { xDiff = UEZPlatform_LCDGetWidth() - xMid(p); yDiff = absDiff(yMid(p), yMid(aSelectedChoice)); if((xDiff < xSmallestDiff) && (yDiff<(xDiff/aSearchRange))) { xSmallestDiff = xDiff; p_nextChoice = p; } } } } return p_nextChoice; }
BBox BBox::getSe() const { return BBox(xMid(), yMin, xMax, yMid()); }
BBox BBox::getSw() const { return BBox(xMin, yMin, xMid(), yMid()); }
BBox BBox::getNe() const { return BBox(xMid(), yMid(), xMax, yMax); }
BBox BBox::getNw() const { return BBox(xMin, yMid(), xMid(), yMax); }
bool BBox::overlaps(const BBox& other) const { return std::abs(xMid() - other.xMid()) < width() / 2 + other.width() / 2 && std::abs(yMid() - other.yMid()) < height() / 2 + other.height() / 2; }