本文整理汇总了C++中CubeSet::mark方法的典型用法代码示例。如果您正苦于以下问题:C++ CubeSet::mark方法的具体用法?C++ CubeSet::mark怎么用?C++ CubeSet::mark使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CubeSet
的用法示例。
在下文中一共展示了CubeSet::mark方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
void main() {
blicketCubes.mark(blicket1);
blicketCubes.mark(blicket2);
nonBlicketCubes.mark(nonBlicket1);
nonBlicketCubes.mark(nonBlicket2);
// Initialize asset configuration and loader
config.append(gMainSlot, BootstrapAssets);
loader.init();
// Subscribe to events (See pubsub design pattern)
Events::cubeConnect.set(onCubeConnect);
Events::cubeDisconnect.set(onCubeDisconnect);
Events::cubeRefresh.set(onCubeRefresh);
Events::neighborAdd.set(onNeighborAdd);
Events::neighborRemove.set(onNeighborRemove);
// Events::cubeTouch.set(onCubeTouch);
Events::cubeTouch.set(onTouch);
// Initialize cubes
for(CubeID cid : CubeSet::connected()) {
vbuf[cid].attach(cid);
activateCube(cid);
}
// Run loop
for(;;) {
paintWrapper();
}
}
示例2: onCubeDisconnect
static void onCubeDisconnect(void* ctxt, unsigned cid) {
// mark as lost and clear from other cube sets
lostCubes.mark(cid);
newCubes.clear(cid);
reconnectedCubes.clear(cid);
dirtyCubes.clear(cid);
activeCubes.clear(cid);
}
示例3: 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);
}
示例4: activateCube
static void activateCube(CubeID cid) {
// mark cube as active and render its canvas
activeCubes.mark(cid);
String<128> str;
if (inRunMode) {
str << "I am cube #" << cid << "\n";
drawText(cid, str, 1, 1);
}
else {
str << "In set mode...\n";
drawText(cid, str, 1, 1);
}
}
示例5: activateCube
static void activateCube(CubeID cid, int task) {
// mark cube as active and render its canvas
activeCubes.mark(cid);
vbuf[cid].initMode(BG0_SPR_BG1);
//this is where the starting image is set (after a task is set and we exit the menu)
vbuf[cid].bg0.image(vec(0,0), TaskReds, task);
auto neighbors = vbuf[cid].physicalNeighbors();
for(int side=0; side<4; ++side) {
if (neighbors.hasNeighborAt(Side(side))) {
//showSideBar(cid, Side(side));
} else {
hideSideBar(cid, Side(side));
}
}
}
示例6: activateCube
static void activateCube(CubeID cid) {
// mark cube as active and render its canvas
activeCubes.mark(cid);
vbuf[cid].initMode(BG0_SPR_BG1);
vbuf[cid].bg0.image(vec(0,0), Backgrounds, currentBackgrounds[(int)cid]);
//Old sidebar code
//auto neighbors = vbuf[cid].physicalNeighbors();
// for(int side=0; side<4; ++side) {
// if (neighbors.hasNeighborAt(Side(side))) {
// showSideBar(cid, Side(side));
// } else {
// hideSideBar(cid, Side(side));
// }
// }
}
示例7: activateCube
static void activateCube(CubeID cid) {
// Mark cube as active and render its canvas
//
activeCubes.mark(cid);
vbuf[cid].initMode(BG0_SPR_BG1);
if (cid == 0) {
vbuf[cid].bg0.image(vec(0,0), Backgrounds, 0);
} else {
vbuf[cid].bg0.image(vec(0,0), cond.get_condition(), cid - 1);
}
auto neighbors = vbuf[cid].physicalNeighbors();
for(int side=0; side<4; ++side) {
if (neighbors.hasNeighborAt(Side(side))) {
showSideBar(cid, Side(side));
} else {
hideSideBar(cid, Side(side));
}
}
}
示例8: onCubeRefresh
static void onCubeRefresh(void* ctxt, unsigned cid) {
// mark this cube for a future repaint
dirtyCubes.mark(cid);
}
示例9: updateConnecting
void MainMenu::updateConnecting()
{
/*
* Cubes are in the 'connectingCubes' set between when they first connect
* and when they become usable for the menu. They go through three states:
*
* 1. Displaying the Sifteo logo. This starts in cubeConnect(), and runs on a timer.
*
* 2. Loading assets. We start the load itself in cubeConnect(). After the logo
* finishes, we switch to displaying a progress animation.
*
* 3. When loading finishes, we draw an idle screen on the cube and remove it
* form connectingCubes.
*/
SystemTime now = SystemTime::now();
/*
* Look for state transitions from (1) to (2)
*/
CubeSet beginLoadingAnim;
beginLoadingAnim.clear();
for (CubeID cube : connectingCubes & ~loadingCubes) {
if ((now - Shared::connectTime[cube]).milliseconds() >= kDisplayBlueLogoTimeMS) {
loadingCubes.mark(cube);
beginLoadingAnim.mark(cube);
}
}
if (!beginLoadingAnim.empty()) {
loadingAnimation.begin(beginLoadingAnim);
}
/*
* Let cubes participate in the loading animation until the whole load is done
*/
if (loadingCubes.empty()) {
// nothing to do
return;
}
if (!loader.isComplete()) {
// Still loading, update progress
loadingAnimation.paint(loadingCubes, loader.averageProgress(100));
return;
}
// Loading is done!
loadingAnimation.end(loadingCubes);
// Draw an idle screen on each cube, and remove it from connectingCubes
for (CubeID cube : loadingCubes) {
auto& vid = Shared::video[cube];
vid.initMode(BG0);
vid.bg0.erase(Menu_StripeTile);
vid.bg0.image(vec(0,0), Menu_IdleCube);
connectingCubes.clear(cube);
// Dispatch connected event to current applet now that the cube is ready
if (itemIndexCurrent >= 0) {
ASSERT(itemIndexCurrent < items.count());
MainMenuItem *item = items[itemIndexCurrent];
item->onCubeConnect(cube);
// If a game was waiting on a cube to launch, try again.
if (cubeRangeSavedIcon && areEnoughCubesConnected(itemIndexCurrent)) {
itemIndexChoice = itemIndexCurrent;
toggleCubeRangeAlert(); // remove the warning asking for more cubes
}
}
updateCubeRangeAlert();
}
loadingCubes.clear();
}
示例10: main
void main() {
// subscribe to events
Events::neighborAdd.set(onNeighborAdd);
Events::neighborRemove.set(onNeighborRemove);
Events::cubeTouch.set(onTouch);
Events::cubeAccelChange.set(onAccelChange);
for(CubeID cid : CubeSet::connected()) {
vbuf[cid].attach(cid);
motion[cid].attach(cid);
activateCube(cid);
}
AudioTracker::setVolume(0.2f * AudioChannel::MAX_VOLUME);
//if (inRunMode) LOG("run mode\n");
//else LOG("set mode\n");
// run loop
while(1) {
System::paint();
if (count > 1800 /*&& countDown*/) {
LOG("in count conditional \n");
SystemTime curTime = SystemTime::now();
TimeDelta timePast = curTime - startTime;
if (timePast > totalTime) {
if (!musicInitialized) {
musicInitialized = true;
AudioTracker::play(Music);
alarm = true;
//countDown = false;
}
}
convertedSec = timePast.seconds();
convertedMin = convertedSec / 60;
displayHour = convertedMin / 60;
displayMin = (int)convertedMin % (int)60;
displaySec = convertedSec - (convertedMin * 60);
count = 0;
}
//LOG_FLOAT(displaySec);
count++;
//if (inRunMode) LOG("run mode\n");
//else LOG("set mode\n");
for(CubeID cid : CubeSet::connected()) {
activeCubes.mark(cid);
String<128> str;
if (inRunMode) {
if (alarm) {
if (cid == 0) str << "0:\n";
else if (cid == 1) str << ":00\n";
drawText(cid, str, 1, 1);
}
else {
if (cid == 0) str << Fixed(hours-displayHour, 3) << ":\n";
else if (cid == 1) str << ":" << Fixed(minutes-displayMin, 3) << "\n";
drawText(cid, str, 1, 1) ;
}
}
else {
if (cid == 0) str << "Hours: " << Fixed(hours, 3) << "\n";
else if (cid == 1) str << "Minutes: " << Fixed(minutes, 3) << "\n";
drawText(cid, str, 1, 1) ;
}
}
}
}