当前位置: 首页>>代码示例>>C++>>正文


C++ CubeSet::test方法代码示例

本文整理汇总了C++中CubeSet::test方法的典型用法代码示例。如果您正苦于以下问题:C++ CubeSet::test方法的具体用法?C++ CubeSet::test怎么用?C++ CubeSet::test使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CubeSet的用法示例。


在下文中一共展示了CubeSet::test方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onNeighborAdd

static void onNeighborAdd(void* ctxt, unsigned cube0, unsigned side0, unsigned cube1, unsigned side1) {
    // Update art on active cubes (not loading cubes or base)
    bool sfx = false;
    if (isActive(cube0) && cube0 == blicketDetector && blicketCubes.test(cube1)) {
        sfx |= showSideBar(cube1, Side(side1));
        sfx |= showSideBar(cube0, Side(side0));
    }
    if (isActive(cube1) && cube1 == blicketDetector && blicketCubes.test(cube0)) {
        sfx |= showSideBar(cube0, Side(side0));
        sfx |= showSideBar(cube1, Side(side1));
    }
    if (sfx) { playSfx(SfxSong); }
}
开发者ID:NYUCCL,项目名称:SifteoBlickets,代码行数:13,代码来源:main.cpp

示例2: showSideBar

static bool showSideBar(CubeID cid, CubeID nb, Side s) {
    // if cid is not showing a bar on side s, show it
    int stat1 = taskCubes[cid].status;
    int stat2 = taskCubes[nb].status;

    //To-Do: add logic for different colored bars based on the statuses of the cubes.
    ASSERT(activeCubes.test(cid));
    if (vbuf[cid].sprites[s].isHidden()) {
        switch (stat1 + stat2) {
            case 0: vbuf[cid].sprites[s].setImage(RedBars[s]); break; //2 red -> red
            case 1: vbuf[cid].sprites[s].setImage(OrangeBars[s]); break; //1 red, 1 yellow -> orange
            case 2:
                if (stat1 == 0 || stat1 == 2) { //1 red, 1 blue -> purple
                    vbuf[cid].sprites[s].setImage(PurpleBars[s]);
                    break;
                } else {
                    vbuf[cid].sprites[s].setImage(YellowBars[s]); //2 yellow -> yellow
                    break; 
                }
            case 3: vbuf[cid].sprites[s].setImage(GreenBars[s]); break; //1 yellow, 1 blue -> green
            case 4: vbuf[cid].sprites[s].setImage(BlueBars[s]); break; //2 blue -> blue
        }
        vbuf[cid].sprites[s].move(getRestPosition(s));
        return true;
    } else {
        return false;
    }
}
开发者ID:polinadotio,项目名称:sifteocubes,代码行数:28,代码来源:main.cpp

示例3: hideSideBar

static bool hideSideBar(CubeID cid, Side s) {
    // if cid is showing a bar on side s, hide it
    ASSERT(activeCubes.test(cid));
    if (!vbuf[cid].sprites[s].isHidden()) {
        vbuf[cid].sprites[s].hide();
        return true;
    } else {
        return false;
    }
}
开发者ID:polinadotio,项目名称:sifteocubes,代码行数:10,代码来源:main.cpp

示例4: barSpriteCount

static int barSpriteCount(CubeID cid) {
    // how many bars are showing on this cube?
    ASSERT(activeCubes.test(cid));
    int result = 0;
    for(int i=0; i<4; ++i) {
        if (!vbuf[cid].sprites[i].isHidden()) {
            result++;
        }
    }
    return result;
}
开发者ID:polinadotio,项目名称:sifteocubes,代码行数:11,代码来源:main.cpp

示例5: hideSideBar

static bool hideSideBar(CubeID cid, Side s) {
    // If cid is showing a bar on side s, hide it and check if the
    // blicket detector should turn off.
    ASSERT(activeCubes.test(cid));
    if (!vbuf[cid].sprites[s].isHidden()) {
        vbuf[cid].sprites[s].hide();
        if (barSpriteCount(cid) == 0 && cid == 0) {
            vbuf[cid].bg0.image(vec(0,0), Backgrounds, 0);
        }
        else {
            vbuf[cid].bg0.image(vec(0,0), cond.get_condition(), cid - 1);
        }
        return true;
    } else {
        return false;
    }
}
开发者ID:NYUCCL,项目名称:SifteoBlickets,代码行数:17,代码来源:main.cpp

示例6: showSideBar

static bool showSideBar(CubeID cid, Side s) {
    // If cid is not showing a bar on side s, show it and check if the
    // blicket detector shold go off.
    ASSERT(activeCubes.test(cid));
    if (vbuf[cid].sprites[s].isHidden()) {
        vbuf[cid].sprites[s].setImage(Bars[s]);
        vbuf[cid].sprites[s].move(getRestPosition(s));
        if (barSpriteCount(cid) == 1 && cid == 0) {
            vbuf[cid].bg0.image(vec(0,0), Backgrounds, 1);
        }
        else {
            vbuf[cid].bg0.image(vec(0,0), cond.get_condition(), cid - 1);
        }
        return true;
    } else {
        return false;
    }
}
开发者ID:NYUCCL,项目名称:SifteoBlickets,代码行数:18,代码来源:main.cpp

示例7: onCubeConnect

static void onCubeConnect(void* ctxt, unsigned cid) {
    // this cube is either new or reconnected
    if (lostCubes.test(cid)) {
        // this is a reconnected cube since it was already lost this paint()
        lostCubes.clear(cid);
        reconnectedCubes.mark(cid);
    } else {
        // this is a brand-spanking new cube
        newCubes.mark(cid);
    }
    // begin showing some loading art (have to use BG0ROM since we don't have assets)
    dirtyCubes.mark(cid);
    auto& g = vbuf[cid];
    g.attach(cid);
    g.initMode(BG0_ROM);
    g.bg0rom.fill(vec(0,0), vec(16,16), BG0ROMDrawable::SOLID_BG);
    g.bg0rom.text(vec(1,1), "Hold on!", BG0ROMDrawable::BLUE);
    g.bg0rom.text(vec(1,14), "Adding Cube...", BG0ROMDrawable::BLUE);
}
开发者ID:polinadotio,项目名称:sifteocubes,代码行数:19,代码来源:main.cpp

示例8: isActive

static bool isActive(NeighborID nid) {
    // Does this nid indicate an active cube?
    return nid.isCube() && activeCubes.test(nid);
}
开发者ID:polinadotio,项目名称:sifteocubes,代码行数:4,代码来源:main.cpp


注:本文中的CubeSet::test方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。