本文整理汇总了C++中playMusic函数的典型用法代码示例。如果您正苦于以下问题:C++ playMusic函数的具体用法?C++ playMusic怎么用?C++ playMusic使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了playMusic函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
}
开发者ID:AngryPants,项目名称:The_Mummy,代码行数:33,代码来源:keys.cpp
示例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);
}
}
}
开发者ID:kazuya-watanabe,项目名称:noiz2sa,代码行数:25,代码来源:noiz2sa.c
示例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;
}
开发者ID:marcosvalter,项目名称:ArduinoTetris,代码行数:32,代码来源:Tetris.cpp
示例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;
}
开发者ID:Harrypoppins,项目名称:grim_mouse,代码行数:33,代码来源:imuse_music.cpp
示例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);
}
}
开发者ID:jslack-smith,项目名称:Universian,代码行数:53,代码来源:GUI.c
示例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);
}
开发者ID:havlenapetr,项目名称:Scummvm,代码行数:51,代码来源:part_04.cpp
示例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;
}
}
}
开发者ID:tramboi,项目名称:scummvm-test,代码行数:18,代码来源:sound.cpp
示例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()));
}
}
开发者ID:Dramac,项目名称:GM-Assistant,代码行数:25,代码来源:MainWindow.cpp
示例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
}
}
开发者ID:jslack-smith,项目名称:Universian,代码行数:35,代码来源:GUI.c
示例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;
}
开发者ID:Templier,项目名称:residual,代码行数:26,代码来源:imuse_music.cpp
示例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;
}
开发者ID:mdtrooper,项目名称:scummvm,代码行数:30,代码来源:music.cpp
示例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));
}
开发者ID:Jonas777,项目名称:Haunted-Space-Blast-Off,代码行数:31,代码来源:GameStart.cpp
示例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);
}
}
开发者ID:peres,项目名称:scummvm,代码行数:28,代码来源:sound_ns.cpp
示例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 );
}
开发者ID:BackupTheBerlios,项目名称:lincity-ng-svn,代码行数:25,代码来源:Sound.cpp
示例15: playMusic
void Audio::stopSpecial() {
if (!specialId) return;
int tmp = musiqueId;
musiqueId = 0;
specialId = 0;
playMusic(tmp);
}
开发者ID:eduardok,项目名称:Zelda3T,代码行数:7,代码来源:Audio.cpp
示例16: ppLogInfo
void CSong::loadSong(const QString & filename)
{
CNote::setChannelHands(-2, -2); // -2 for not set -1 for none
m_songTitle = filename;
int index = m_songTitle.lastIndexOf("/");
if (index >= 0)
m_songTitle = m_songTitle.right( m_songTitle.length() - index - 1);
QString fn = filename;
#ifdef _WIN32
fn = fn.replace('/','\\');
#endif
m_midiFile->setLogLevel(3);
m_midiFile->openMidiFile(string(fn.toLatin1()));
ppLogInfo("Opening song %s", string(fn.toLatin1()).c_str());
transpose(0);
midiFileInfo();
m_midiFile->setLogLevel(99);
playMusic(false);
rewind();
setPlayFromBar(0.0);
setLoopingBars(0.0);
setEventBits(EVENT_BITS_playingStopped);
if (!m_midiFile->getSongTitle().isEmpty())
m_songTitle = m_midiFile->getSongTitle();
}
开发者ID:inniyah,项目名称:pianobooster,代码行数:28,代码来源:Song.cpp
示例17: onEnter
void MainMenuState::onEnter(){
if (!playMusic("audio/main_menu_audio.wav.ogg")){
std::cout << "main menu background music can't be loaded\n";
}
}
开发者ID:anthonybjturner,项目名称:YasuosQuests,代码行数:7,代码来源:MainMenuState.cpp
示例18: if
void AudioMixer::fadeToTrack(string newTrackName, float crossfadeLength, float newMaxVolume, bool loop)
{
if(m_audioLoader->getMusic(newTrackName) == nullptr || m_currentTrack == nullptr)
{return;}
else if(m_currentTrack->getStatus() == sf::Sound::Stopped)
{
playMusic(newTrackName, crossfadeLength, 0.0f, 100.0f, loop);
return;
}
float timeLeft = m_currentTrack->getDuration().asSeconds() - m_currentTrack->getPlayingOffset().asSeconds();
if(timeLeft < crossfadeLength)
{
crossfadeLength = timeLeft;
}
m_crossfadeInfo.isCrossfading = true;
m_crossfadeInfo.crossfadePosition = 0.0f;
/*if(!SettingsManager::getGlobalSettings()->SOUND_MUSIC)
{_crossfadeInfo.maxVolume = 0.0f;}
else{}*/
m_crossfadeInfo.maxVolume = newMaxVolume;
m_crossfadeInfo.shouldLoop = loop;
m_crossfadeInfo.crossfadeLength = crossfadeLength;
m_nextTrackName = newTrackName;
m_crossfadeClock.restart();
m_nextTrack = m_audioLoader->getMusic(newTrackName);
m_nextTrack->setVolume(0.0f);
m_nextTrack->play();
}
开发者ID:Axelrantila,项目名称:HeroFall,代码行数:35,代码来源:AudioMixer.cpp
示例19: loadWGP
void Game::displayTitleBitmap() {
loadWGP("..\\menu\\nointro.wgp");
playMusic("..\\midi\\title.mid");
_stub->setPalette(_bitmapBuffer0 + kOffsetBitmapPalette, 256);
_stub->copyRect(0, 0, kGameScreenWidth, kGameScreenHeight, _bitmapBuffer1.bits, _bitmapBuffer1.pitch);
_stub->copyRectWidescreen(kGameScreenWidth, kGameScreenHeight, _bitmapBuffer1.bits, _bitmapBuffer1.pitch);
}
开发者ID:raziel-,项目名称:bermuda,代码行数:7,代码来源:game.cpp
示例20: main
////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
// Play a sound
playSound();
// Play music from an ogg file
playMusic("orchestral.ogg");
// Play music from a flac file
playMusic("ding.flac");
// Wait until the user presses 'enter' key
std::cout << "Press enter to exit..." << std::endl;
std::cin.ignore(10000, '\n');
return EXIT_SUCCESS;
}
开发者ID:42bottles,项目名称:SFML,代码行数:23,代码来源:Sound.cpp
注:本文中的playMusic函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论