本文整理汇总了C++中play_music函数的典型用法代码示例。如果您正苦于以下问题:C++ play_music函数的具体用法?C++ play_music怎么用?C++ play_music使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了play_music函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Prop
void WindowPlanes::addProp()
{
QPointer<Prop> prop=new Prop(this);//0代表是子弱代表炸弹
time=QTime::currentTime();
qsrand(time.msec()*100000+time.second()*10000);
int temp=qrand()%2;
if(temp==0)
{
prop->mytype=0;
prop->pixmap=&pixmap_prop0;
}
else
{
prop->mytype=1;
prop->pixmap=&pixmap_prop1;
}
prop->setNumber(getNumber());
prop->setSize(prop->pixmap->size());
prop->setY(-prop->height());
time=QTime::currentTime();
qsrand(time.msec()*100000+time.second()*10000);
prop->setX(qrand()%(int)(width()-prop->width()));
prop->go();
emit play_music("out_porp");
//qDebug()<<"add double bullet ok";
}
示例2: game_over_init
void game_over_init(void)
{
winsys_set_display_func( main_loop );
winsys_set_idle_func( main_loop );
winsys_set_reshape_func( reshape );
winsys_set_mouse_func( mouse_cb );
winsys_set_motion_func( ui_event_motion_func );
winsys_set_passive_motion_func( ui_event_motion_func );
remove_all_bonuses();
halt_sound( "flying_sound" );
halt_sound( "rock_sound" );
halt_sound( "ice_sound" );
halt_sound( "snow_sound" );
play_music( "game_over" );
aborted = g_game.race_aborted;
if ( !aborted ) {
update_player_score( get_player_data( local_player() ) );
}
if ( (!g_game.practicing &&!aborted) || (!g_game.practicing && aborted && !game_abort_is_for_tutorial())) {
race_won = was_current_race_won();
init_starting_tutorial_step(-100);
}
g_game.needs_save_or_display_rankings=false;
g_game.rankings_displayed=false;
}
示例3: play_music_once
void play_music_once(const std::string &file)
{
// Clear list so it's not replayed.
current_track_list.clear();
current_track = music_track(file);
play_music();
}
示例4: launch_sdl
int launch_sdl(t_sdl *sdl)
{
TTF_Font *font288;
TTF_Font *font200;
SDL_Event event;
sdl->screen = NULL;
sdl->music = NULL;
if ((sdl->screen = init_sdl(sdl->screen)) == NULL)
return (EXIT_FAILURE);
if ((font288 = TTF_OpenFont("game_over.ttf", FONT_SIZE1)) == NULL)
abort();
if ((font200 = TTF_OpenFont("game_over.ttf", 100)) == NULL)
abort();
intro_corewar(font288, "CoreWar", sdl->screen, 0);
intro_corewar(font200, "An original game by Victor A. Vyssotsky, Robert " \
"Morris Sr. & M. Douglas McIlroy", sdl->screen, 100);
intro_corewar(font200, "Coded by Le Gang de la Toundra", sdl->screen, 200);
intro_corewar(font200, "(Insert coin to play)", sdl->screen, 400);
SDL_Flip(sdl->screen);
while (1)
{
SDL_WaitEvent(&event);
if (event.type == SDL_KEYUP)
break;
}
sdl->music = play_music(sdl->music);
return (EXIT_SUCCESS);
}
示例5: Enemy
void WindowPlanes::addenemy3_3()
{
QPointer<Enemy> enemy=new Enemy(this);
enemy->setNumber(getNumber());
enemy->mytype=3;
#ifdef Q_OS_SYMBIAN_V5//判断qt的版朊 enemy->speed=6300;
#else
//enemy->speed=6300;
enemy->speed=3800;
#endif
enemy->pixmap=&pixmap_enemy3_1;
enemy->setSize(enemy->pixmap->size());
enemy->blast1=&pixmap_enemy3_1;
enemy->blast2=&pixmap_enemy3_2;
enemy->blast3=&pixmap_enemy3_3;
enemy->blast4=&pixmap_enemy3_4;
enemy->blast5=&pixmap_enemy3_5;
enemy->blast6=&pixmap_enemy3_6;
enemy->blast7=&pixmap_enemy3_7;
enemy->blast8=&pixmap_enemy3_8;
enemy->blast9=&pixmap_enemy3_9;
enemy->HP=15;
enemy->score=30000;
enemy->setY(-enemy->height());
time=QTime::currentTime();
qsrand(time.msec()*100000+time.second()*10000);
//qDebug()<<"qrand():"<<qrand()<<time.msec()+time.second()*1000;
enemy->setX(qrand()%(int)(width()-enemy->width()));
enemy->go();
emit play_music("flying");
}
示例6: schedule_behaviour
void schedule_behaviour() {
// called at 100 Hz / 10ms
if (behaviour == BEHAVIOUR_CALIB){
return;
}
if (!get_input_bit(IO_INPUT_1)) {
play_music();
}
copro_update();
update_ori();
uint8_t new_behaviour = behaviour;
switch (behaviour) {
case BEHAVIOUR_LINE: new_behaviour = behaviour_follow_line(); break;
case BEHAVIOUR_OBSTACLE: new_behaviour = behaviour_obstacle_avoidance(); break;
}
if (new_behaviour != behaviour) {
behaviour=new_behaviour;
switch (behaviour) {
case BEHAVIOUR_LINE: behaviour_follow_line_start(); break;
case BEHAVIOUR_OBSTACLE: behaviour_obstacle_avoidance_start(); break;
}
}
}
示例7: play_music
void AudioManager::play_audio(AudioClip *inClip)
{
if (_init && inClip)
{
if (inClip->type == TEXENG_AUDIO_FX) play_fx(inClip);
else play_music(inClip);
}
}
示例8: show_text
void sceneShow::show_scene(int n)
{
if (n < 0) {
return;
}
if (scene_list.size() <= n) {
std::cout << "ERROR: Scene List[" << n << "] invalid. List size is " << image_scenes.size() << "." << std::endl;
return;
}
CURRENT_FILE_FORMAT::file_scene_list scene = scene_list.at(n);
input.clean();
for (int i=0; i<SCENE_OBJECTS_N; i++) {
input.read_input();
int scene_seek_n = scene.objects[i].seek_n;
//std::cout << ">> sceneShow::show_scene - i: " << i << ", scene_seek_n: " << scene_seek_n << std::endl;
if (_interrupt_scene == true || input.p1_input[BTN_START] == 1) {
scene_seek_n = -1;
break;
}
if (scene_seek_n != -1) {
int scene_type = scene.objects[i].type;
//std::cout << "### scene_type[" << scene_type << "]" << std::endl;
if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_SHOW_TEXT) {
show_text(scene_seek_n);
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_CLEAR_AREA) {
clear_area(scene_seek_n);
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_CLEAR_SCREEN) {
graphLib.clear_area(0 ,0, RES_W, RES_H, 0, 0, 0);
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_MOVE_IMAGE) {
show_image(scene_seek_n);
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_MOVE_VIEWPOINT) {
show_viewpoint(scene_seek_n);
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_PLAY_MUSIC) {
play_music(scene_seek_n);
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_PLAY_SFX) {
play_sfx(scene_seek_n);
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_SHOW_ANIMATION) {
show_animation(scene_seek_n, scene.objects[i].repeat_value, scene.objects[i].repeat_type);
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_STOP_MUSIC) {
soundManager.stop_music();
} else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_SUBSCENE) {
show_scene(scene_seek_n);
} else {
std::cout << ">> sceneShow::show_scene - unknown scene_type[" << scene_type << "]" << std::endl;
}
std::cout << "show_scene::DELAY[" << i << "][" << scene.objects[i].delay_after << "]" << std::endl;
if (input.waitScapeTime(scene.objects[i].delay_after) == 1) {
_interrupt_scene = true;
}
} else {
break;
}
}
std::cout << "show_scene::DONE" << std::endl;
}
示例9: play_music_config
void play_music_config(const config &music_node)
{
music_track track( music_node );
if (!track.valid() && !track.id().empty()) {
ERR_AUDIO << "cannot open track '" << track.id() << "'; disabled in this playlist." << std::endl;
}
// If they say play once, we don't alter playlist.
if (track.play_once()) {
current_track = track;
play_music();
return;
}
// Clear play list unless they specify append.
if (!track.append()) {
current_track_list.clear();
}
if(track.valid()) {
// Avoid 2 tracks with the same name, since that can cause an infinite loop
// in choose_track(), 2 tracks with the same name will always return the
// current track and track_ok() doesn't allow that.
std::vector<music_track>::const_iterator itor = current_track_list.begin();
while(itor != current_track_list.end()) {
if(track == *itor) break;
++itor;
}
if(itor == current_track_list.end()) {
current_track_list.push_back(track);
} else {
ERR_AUDIO << "tried to add duplicate track '" << track.file_path() << "'" << std::endl;
}
}
// They can tell us to start playing this list immediately.
if (track.immediate()) {
current_track = track;
play_music();
} else if (!track.append()) { // Make sure the current track is finished
current_track.set_play_once(true);
}
}
示例10: racing_init
void racing_init(void)
{
player_data_t *plyr = get_player_data( local_player() );
winsys_set_display_func( main_loop );
winsys_set_idle_func( main_loop );
winsys_set_reshape_func( reshape );
winsys_set_mouse_func( NULL );
winsys_set_motion_func( NULL );
winsys_set_passive_motion_func( NULL );
winsys_set_mouse_func( NULL );
/* Initialize view */
if ( getparam_view_mode() < 0 ||
getparam_view_mode() >= NUM_VIEW_MODES )
{
setparam_view_mode( ABOVE );
}
set_view_mode( plyr, (view_mode_t)getparam_view_mode() );
/* We need to reset controls here since callbacks won't have been
called in paused mode. This results in duplication between this
code and init_physical_simulation. Oh well. */
left_turn = right_turn = paddling = False;
trick_modifier = False;
charging = False;
plyr->control.turn_fact = 0.0;
plyr->control.turn_animation = 0.0;
plyr->control.is_braking = False;
plyr->control.is_paddling = False;
plyr->control.jumping = False;
plyr->control.jump_charging = False;
#ifdef __APPLE__
plyr->control.is_flying=False;
plyr->control.fly_total_time=0;
#endif
/* Set last_terrain to a value not used below */
last_terrain = 0;
if ( g_game.prev_mode != PAUSED ) {
init_physical_simulation();
}
last_terrain = 0;
g_game.race_aborted = False;
#ifdef __APPLE__
g_game.race_time_over = False;
#endif
play_music( "racing" );
/* play_sound( "start_race", 0 ); */
}
示例11: play_music
void WindowPlanes::bulletToDouble()
{
time_double_bullet_begin.start();//记录双子弹状态是从什么时候开始的
save_timer_bullet_to_single = 15000;
pixmap_bullet=&pixmap_bullet2;
bullet_type=2;
emit play_music("double_saler");
timer_bullet_to_single.start(15000);
}
示例12: draw
static void draw(void)
{
int x, y, offx, offy;
float c = 1;
static char logo_text1[] = "Allegro";
static char logo_text2[] = "";
/* XXX commented out because the font doesn't contain the characters for
* anything other than "Allegro 4.2"
*/
/* static char logo_text2[] = "5.0"; */
if (progress < 0.5f) {
c = progress / 0.5f;
al_clear_to_color(al_map_rgb_f(c, c, c));
} else {
if (!already_played_midi) {
play_music(DEMO_MIDI_INTRO, 0);
already_played_midi = 1;
}
c = 1;
al_clear_to_color(al_map_rgb_f(c, c, c));
x = screen_width / 2;
y = screen_height / 2 - 3 * al_get_font_line_height(demo_font_logo) / 2;
offx = 0;
if (progress < 1.0f) {
offx =
(int)(al_get_text_width(demo_font_logo, logo_text1) *
(1.0f - 2.0f * (progress - 0.5f)));
}
demo_textprintf_centre(demo_font_logo, x + 6 - offx,
y + 5, al_map_rgba_f(0.125, 0.125, 0.125, 0.25), logo_text1);
demo_textprintf_centre(demo_font_logo, x - offx, y,
al_map_rgba_f(1, 1, 1, 1), logo_text1);
if (progress >= 1.5f) {
y += 3 * al_get_font_line_height(demo_font_logo) / 2;
offy = 0;
if (progress < 2.0f) {
offy = (int)((screen_height - y) * (1.0f - 2.0f * (progress - 1.5f)));
}
demo_textprintf_centre(demo_font_logo, x + 6,
y + 5 + offy, al_map_rgba_f(0.125, 0.125, 0.125, 0.25),
logo_text2);
demo_textprintf_centre(demo_font_logo, x, y + offy,
al_map_rgba_f(1, 1, 1, 1), logo_text2);
}
}
}
示例13: credits_init
static void credits_init(void)
{
winsys_set_display_func( main_loop );
winsys_set_idle_func( main_loop );
winsys_set_reshape_func( reshape );
winsys_set_mouse_func( mouse_cb );
winsys_set_motion_func( ui_event_motion_func );
winsys_set_passive_motion_func( ui_event_motion_func );
y_offset = 0;
play_music( "credits_screen" );
}
示例14: play_music
void MusicMng::play_music(s32 pos)
{
if (pos >= 0 && pos < (s32)m_list.size())
{
#ifdef UNICODE
std::string str = Helper::Utf16ToACP(m_list[pos]);
const c8 * name = str.c_str();
#else
const c8 * name = m_list[pos].c_str();
#endif
play_music(name);
}
}
示例15: add_bonus
// --------------------------------------------------------------
// object which gives a temporary boost to luck
// --------------------------------------------------------------
void t_luck_object::activate_trigger( t_army* army, t_adv_map_point const& point,
t_direction direction, t_adventure_frame* frame )
{
int i;
bool any_award = false;
// loop through all heroes/creatures in the army and award temporary statistic based on subtype
t_creature_array& creatures = army->get_creatures();
for (i = 0; i < t_creature_array::k_size; i++)
{
if (creatures[i].get_number() == 0)
continue;
if (creatures[i].has_temporary_bonus( get_type() ))
continue;
add_bonus( creatures[i] );
any_award = true;
}
// determine what response to print
if (army->get_owner()->is_computer())
return;
t_basic_dialog* dialog;
std::string text;
dialog = new t_basic_dialog;
if (any_award)
{
text = get_text( "initial" );
add_icons( dialog );
}
else
{
text = get_text( "empty" );
}
dialog->set_text( text );
dialog->add_ok_button();
dialog->set_title( get_name() );
dialog->open( get_dialog_bottom( point ), true, k_align_bottom );
t_sound_cache music = get_music_playing();
stop_music();
get_dialog_sound( k_dialog_sound_luck )->play( get_sound_volume() );
dialog->run_modal();
// Update stats.
frame->update_army();
play_music( music );
}