コード例 #1
0
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;
}
コード例 #2
0
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;
}
コード例 #3
0
ファイル: grey-common.cpp プロジェクト: jstopchick/greyhound
BBox BBox::getSe() const { return BBox(xMid(), yMin, xMax, yMid()); }
コード例 #4
0
ファイル: grey-common.cpp プロジェクト: jstopchick/greyhound
BBox BBox::getSw() const { return BBox(xMin, yMin, xMid(), yMid()); }
コード例 #5
0
ファイル: grey-common.cpp プロジェクト: jstopchick/greyhound
BBox BBox::getNe() const { return BBox(xMid(), yMid(), xMax, yMax); }
コード例 #6
0
ファイル: grey-common.cpp プロジェクト: jstopchick/greyhound
BBox BBox::getNw() const { return BBox(xMin, yMid(), xMid(), yMax); }
コード例 #7
0
ファイル: grey-common.cpp プロジェクト: jstopchick/greyhound
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;
}