本文整理汇总了C++中playMusic函数的典型用法代码示例。如果您正苦于以下问题:C++ playMusic函数的具体用法?C++ playMusic怎么用?C++ playMusic使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了playMusic函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: detectKeys
void detectKeys()
{
unsigned int *playerBottom[3] = {&g_worldGrid[charLocation.X][charLocation.Y],&g_worldGrid[charLocation.X - 1][charLocation.Y],&g_worldGrid[charLocation.X + 1][charLocation.Y]};
for( unsigned int w =0 ; w<3 ; ++w)
{
if(*playerBottom[w]== '4')
{
if (inventoryManagement("Red Key", 1)) {
*playerBottom[w] = ' ';
printMessages("You have picked up a Red Key!");
}
playMusic(2);
}
else if(*playerBottom[w] == '5')
{
if (inventoryManagement("Blue Key", 1)) {
*playerBottom[w] = ' ';
printMessages("You have picked up a Blue Key!");
}
playMusic(2);
}
else if(*playerBottom[w] == '6')
{
if (inventoryManagement("Green Key", 1)) {
*playerBottom[w] = ' ';
printMessages("You have picked up a Green Key!");
}
playMusic(2);
}
}
}
示例2: initGame
void initGame(int stg) {
status = IN_GAME;
initShip();
initShots();
initFoes();
initFrags();
initBonuses();
initBackground();
initBarrages(stagePrm[stg][0], stagePrm[stg][1], stagePrm[stg][2]);
initGameState(stg);
if ( stg < STAGE_NUM ) {
setStageBackground(stg%5+1);
playMusic(stg%5+1);
} else {
if ( !insane ) {
setStageBackground(0);
playMusic(0);
} else {
setStageBackground(6);
playMusic(6);
}
}
}
示例3: startLevel
/*
* Just starts a new level
*/
void startLevel() {
pieceCount = 0x00;
gamePaused = 0x01;
// annimation beetween levels
// there is two annimations to show:
// - a simple shift of the last image to left
// - a shift to left with a men pushing
if (level % 4 == 0 && level != 0) {
playMusic(2);
pushLeftAll(displayField);
rollNumber('l', level, 10, 1000);
rollNumber('p', score, 10, 1000);
} else {
shiftLeftAll(displayField);
}
playMusic(0);
delay(1900);
playMusic(3);
generateField(); // new field
generatePiece(); // new piece
addPiece(); // adds the new piece to fild
updateDisplayField(); // updates the display field
limit = 0x11; // sets the checkLines limit to default
gamePaused = 0x00;
}
示例4: assert
int Imuse::setMusicSequence(int seqId) {
int l, num = -1;
if (seqId == -1)
return _seqMusicTable[_curMusicSeq].soundId;
if (seqId == 0)
seqId = 2000;
for (l = 0; _seqMusicTable[l].soundId != -1; l++) {
if (_seqMusicTable[l].soundId == seqId) {
num = l;
break;
}
}
assert(num != -1);
Debug::debug(Debug::Imuse, "Imuse::setMusicSequence(): SoundId %d, filename: %s", _seqMusicTable[l].soundId, _seqMusicTable[l].filename);
if (_curMusicSeq == num)
return _seqMusicTable[_curMusicSeq].soundId;
if (num) {
playMusic(&_seqMusicTable[num], 0, true);
} else {
playMusic(&_stateMusicTable[_curMusicState], _curMusicState, true);
num = 0;
}
_curMusicSeq = num;
return _seqMusicTable[_curMusicSeq].soundId;
}
示例5: lvlIntro
void lvlIntro(Game *game, Level *level) {
char levelNumber[50];
int row,col,xPos, j = 0;
sprintf(levelNumber, "LEVEL %d", game->levelNum);
playMusic(intro, FALSE);
// Draw stars, increasing length (speeding up)
for ( j = 0; j < 30; j++ ) {
lcd_fillScreen(BLACK);
for (row = level->stars.y; row < DISPLAY_HEIGHT; row += STAR_SPACING_HEIGHT) {
for (col = level->stars.x; col < DISPLAY_WIDTH; col++) {
if (xPos%STAR_SPACING_WIDTH == 0) {
vLine(col,row, row + j, WHITE);
}
xPos++;
}
}
xPos=0; // reset xPos
lcd_putString(100, 50, (unsigned char *)levelNumber);
drawShip(level->player.currPos.x, -3*j + INIT_SHIP_POS_Y, level->player.type);
memcpy((char*)LCD_FRAME_BUFFER,(char*)LCD_TEMP_BUFFER, 153600); // write temp buffer to fram buffer
}
lcd_fillScreen(WHITE);
playMusic(RainPizz,FALSE);
memcpy((char*)LCD_FRAME_BUFFER,(char*)LCD_TEMP_BUFFER, 153600); // write temp buffer to fram buffer
mdelay(150);
// Draw stars, decreasing length (slowing down)
for ( j = 15; j > 0; j-- ) {
lcd_fillScreen(BLACK);
for (row = level->stars.y; row < DISPLAY_HEIGHT; row += STAR_SPACING_HEIGHT) {
for (col = level->stars.x; col < DISPLAY_WIDTH; col++) {
if (xPos%STAR_SPACING_WIDTH == /*(row%2)*/ 0) {
vLine(col,row, row + j, WHITE);
}
xPos++;
}
}
xPos=0; // reset xPos
lcd_putString(100, 50, (unsigned char *)levelNumber);
drawShip(level->player.currPos.x, level->player.currPos.y - j*j, level->player.type);
memcpy((char*)LCD_FRAME_BUFFER,(char*)LCD_TEMP_BUFFER, 153600); // write temp buffer to fram buffer
mdelay(100);
}
}
示例6: playMusic
void IgorEngine::PART_04() {
if (_objectsState[106] == 1) {
_currentPart = 730;
playMusic(1);
return;
}
if (_objectsState[107] == 1) {
_objectsState[107] = 0;
_currentPart = 750;
playMusic(1);
return;
}
_gameState.enableLight = 1;
loadRoomData(PAL_Map, IMG_Map, BOX_Map, MSK_Map, TXT_Map);
loadActionData(DAT_Map);
_roomDataOffsets = PART_04_ROOM_DATA_OFFSETS;
SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_04_EXEC_ACTION);
PART_04_CLEAR_OBJECT_STATE_84(255);
memcpy(_screenVGA, _screenLayer1, 46080);
fadeInPalette(768);
_currentAction.verb = kVerbWalk;
if (_gameState.musicNum != 2) {
playMusic(2);
}
_walkData[0].x = 160;
_walkData[0].y = 133;
_walkData[0].scaleWidth = 49;
_walkData[0].scaleHeight = 49;
_walkDataLastIndex = 1;
_walkDataCurrentIndex = 1;
enterPartLoop();
while (_currentPart == 40) {
handleRoomInput();
if (compareGameTick(19, 32)) {
handleRoomDialogue();
}
if (compareGameTick(4, 8)) {
handleRoomInventoryScroll();
}
scrollPalette(200, 207);
setPaletteRange(200, 207);
if (compareGameTick(1)) {
handleRoomLight();
}
scrollPalette(184, 199);
setPaletteRange(184, 199);
waitForTimer();
}
leavePartLoop();
fadeOutPalette(624);
}
示例7: playMusic
/**
* Check if music is still playing.
* If not, select the next track in the playlist and play it
*/
void SoundHandler::checkMusic() {
if (_midiPlayer->isPlaying())
return;
for (int i = 0; _vm->_defltTunes[i] != -1; i++) {
if (_vm->_defltTunes[i] == _vm->getGameStatus().song) {
if (_vm->_defltTunes[i + 1] != -1)
playMusic(_vm->_defltTunes[i + 1]);
else
playMusic(_vm->_defltTunes[0]);
break;
}
}
}
示例8: playMusic
void MainWindow::onTimer_timeout()
{
if (!soundEngine.isPlayingMusic())
{
if (checkRepeat->isChecked())
{
playMusic(sCurrentMusic,dDuration);
}
else
{
sliderMusic->setValue(sliderMusic->maximum());
labelPosition->setText(QApplication::translate("mainWindow","0:00/0:00",0));
buttonMusic->setText(QApplication::translate("mainWindow","&Play",0));
timer->stop();
}
}
// calculate the percentage of the music played
iTimerCount++;
if (!sliderMusic->isSliderDown())
{
// we move the slider only if the user is not moving it manually
double dPosition = (double)iTimerCount/TICK;
sliderMusic->setValue(floor(dPosition/dDuration*sliderMusic->maximum()));
}
}
示例9: lvlOutro
void lvlOutro(Game *game, Level *level, Controller *userInput) {
char title[50];
char score[50];
char livesLeft[50];
char hitRatioPercent[50];
char print = FALSE;
float hitRatio = (float)level->hits/(float)level->numberOfFires;
playMusic(theme2,TRUE);
game->score *= hitRatio;
sprintf(title, "LEVEL %d PERFORMANCE", game->levelNum);
sprintf(score, "Score: %d", game->score);
sprintf(livesLeft, "Remaining lives: %d", level->player.lives);
sprintf(hitRatioPercent, "Hit and Miss Ratio: %.2lf%%", hitRatio*100);
while(!userInput->start) {
// wait for start button
lcd_fillScreen(BLACK);
lcd_putString( 50, 50, (unsigned char *)title );
lcd_putString(50, 100, (unsigned char *)score);
lcd_putString(50, 110, (unsigned char *)livesLeft);
lcd_putString(50, 120, (unsigned char *)hitRatioPercent);
if(game->seed%10 == 0) {
print = !print;
}
if(print) {
lcd_putString(50, 300, "Press START to continue...");
}
game->seed++;
pollController(userInput);
memcpy((char*)LCD_FRAME_BUFFER,(char*)LCD_TEMP_BUFFER, 153600); // write temp buffer to fram buffer
}
}
示例10: assert
void Imuse::setMusicState(int stateId) {
int l, num = -1;
if (stateId == 0)
stateId = 1000;
for (l = 0; _stateMusicTable[l].soundId != -1; l++) {
if (_stateMusicTable[l].soundId == stateId) {
num = l;
break;
}
}
assert(num != -1);
if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_ALL)
printf("Imuse::setMusicState(): SoundId %d, filename: %s\n", _stateMusicTable[l].soundId, _stateMusicTable[l].filename);
if (_curMusicState == num)
return;
if (!_curMusicSeq) {
playMusic(&_stateMusicTable[num], num, false);
}
_curMusicState = num;
}
示例11: debugC
bool Music::loadSong(int songNumber) {
debugC(kDebugLevelMusic, "Music: loadSong()");
if(songNumber == 100)
songNumber = 55;
else if(songNumber == 70)
songNumber = 54;
if((songNumber > 60) || (songNumber < 1))
return false;
songNumber = ROOM_SONG[songNumber];
if(songNumber == 0)
songNumber = 12;
if((songNumber > NUM_SONGS) || (songNumber < 1))
return false;
Common::String songName = Common::String(SONG_NAMES[songNumber - 1]);
freeSong(); // free any song that is currently loaded
stopMusic();
if (!playMusic(songName))
return false;
startSong();
return true;
}
示例12: setType
GameStart::GameStart(){
setType("GameStart");
//dragonfly managers needed for this
df::ResourceManager &resource_manager = df::ResourceManager::getInstance();
//setup GameOversprite
df::Sprite *p_temp_sprite = resource_manager.getSprite("gamestart");
if (!p_temp_sprite){
df::LogManager &log_manager = df::LogManager::getInstance();
log_manager.writeLog("GameStart::GameStart(): Warning! Sprite '%s' not found", "gamestart");
}
else{
setSprite(p_temp_sprite);
setSpriteSlowdown(30);
setTransparency('#');
}
//put in center of window
setLocation(df::CENTER_CENTER);
//register interest
registerInterest(df::KEYBOARD_EVENT);
//play start music
p_music = df::ResourceManager::getInstance().getMusic("start music");
playMusic();
df::WorldManager &world_manager = df::WorldManager::getInstance();
world_manager.setBoundary(df::Box(df::Position(), 250, 250));
}
示例13: warning
void DosSoundMan_ns::playCharacterMusic(const char *character) {
if (!character || locationHasOwnSoftMusic(_vm->_location._name)) {
return;
}
char *name = const_cast<char*>(character);
const char *newMusicFile = 0;
if (!scumm_stricmp(name, _dinoName)) {
newMusicFile = "dino";
} else
if (!scumm_stricmp(name, _donnaName)) {
newMusicFile = "donna";
} else
if (!scumm_stricmp(name, _doughName)) {
newMusicFile = "nuts";
} else {
warning("unknown character '%s' in DosSoundMan_ns_ns::playCharacterMusic", character);
return;
}
if (!_playing || (newMusicFile && scumm_stricmp(newMusicFile, _musicFile))) {
// avoid restarting the same piece
setMusicFile(newMusicFile);
playMusic();
debugC(2, kDebugExec, "changeLocation: started character specific music (%s)", newMusicFile);
}
}
示例14: currentMusic
Sound::Sound()
: currentMusic(0)
{
assert( soundPtr == 0);
soundPtr = this;
loaderThread = 0;
//Load Sound
audioOpen = false;
/* Open the audio device */
if (Mix_OpenAudio( MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, 2, 2048) < 0) {
fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
return;
} else {
audioOpen = true;
loaderThread = SDL_CreateThread(soundThread, this);
}
setMusicVolume(getConfig()->musicVolume);
setSoundVolume(getConfig()->soundVolume);
// for now...
//playMusic("01 - pronobozo - lincity.ogg");
playMusic( getConfig()->playSongName );
}
示例15: playMusic
void Audio::stopSpecial() {
if (!specialId) return;
int tmp = musiqueId;
musiqueId = 0;
specialId = 0;
playMusic(tmp);
}