本文整理汇总了C++中Neighborhood::cubeAt方法的典型用法代码示例。如果您正苦于以下问题:C++ Neighborhood::cubeAt方法的具体用法?C++ Neighborhood::cubeAt怎么用?C++ Neighborhood::cubeAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Neighborhood
的用法示例。
在下文中一共展示了Neighborhood::cubeAt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: leftmostNeighbor
/**
* Helper method to locate the leftmost cube
* in a series of neighboured cubes.
*/
unsigned Phonemic::leftmostNeighbor(unsigned id) {
// Find leftmost cube
Neighborhood hood = Neighborhood(id);
CubeID leftmostID = id;
while(hood.hasCubeAt(LEFT)) {
leftmostID = hood.cubeAt(LEFT);
hood = Neighborhood(leftmostID);
}
return leftmostID;
}
示例2: checkForWord
/**
* Helper method to decide if a series of cubes
* spells the current word.
*/
void Phonemic::checkForWord(unsigned id) {
// Find leftmost cube
CubeID nextID = leftmostNeighbor(id);
Neighborhood hood = Neighborhood(nextID);
// Find the sequence of symbols spelled by
// the sequence of cubes
int wordAttempt[MAX_WORD_SIZE];
wordAttempt[0] = cubes[nextID].symbol;
int i = 1;
while(hood.hasCubeAt(RIGHT)) {
nextID = hood.cubeAt(RIGHT);
hood = Neighborhood(nextID);
wordAttempt[i] = cubes[nextID].symbol;
i++;
}
wordAttempt[i] = -1;
// Check for a match
bool match = true;
for(int i = 0; i < /*MAX_WORD_SIZE*/ length; i++) {
if(/*order[i]*/ wordFamilies[level].phonemes[word][i] != wordAttempt[i])
{
match = false;
break;
}
//if(wordFamilies[level].phonemes[word][i] == -1) break;
}
// Recognize match
if(match) {
//sounding.play(SfxChime);
//sounding.play(SfxCat);
sounding.play(/*SfxChime*/ *wordFamilies[level].words[word].sound);
allSmiles();
System::paint();
state = WORD_FOUND;
}
}
示例3: soundOut
/**
* Helper method to sounds out the sequence of cubes.
*/
void Phonemic::soundOut(unsigned id) {
// Wait for audio channel to be clear
if(sounding.isPlaying()) return;
// Highlight the current cube
cubes[id].vid.bg0.image(vec(0,0), *cubes[id].images[1]);
System::paint();
System::finish();
// Play the current cube's sound
sounding.play(*cubes[id].sound);
while(sounding.isPlaying()) {
System::yield();
}
// Return the cube to its normal appearance
cubes[id].vid.bg0.image(vec(0,0), *cubes[id].images[0]);
// Play any cube connected to the right
Neighborhood hood = Neighborhood(id);
if(hood.hasCubeAt(RIGHT)) soundOut(hood.cubeAt(RIGHT));
}