ÕâÆª½Ì³ÌC++ soundº¯Êý´úÂëʾÀýдµÃºÜʵÓã¬Ï£ÍûÄܰﵽÄú¡£
±¾ÎÄÕûÀí»ã×ÜÁËC++ÖÐsoundº¯ÊýµÄµäÐÍÓ÷¨´úÂëʾÀý¡£Èç¹ûÄúÕý¿àÓÚÒÔÏÂÎÊÌ⣺C++ soundº¯ÊýµÄ¾ßÌåÓ÷¨£¿C++ soundÔõôÓã¿C++ soundʹÓõÄÀý×Ó£¿ÄÇô¹§Ï²Äú, ÕâÀᆱѡµÄº¯Êý´úÂëʾÀý»òÐí¿ÉÒÔΪÄúÌṩ°ïÖú¡£ ÔÚÏÂÎÄÖÐÒ»¹²Õ¹Ê¾ÁËsoundº¯ÊýµÄ30¸ö´úÂëʾÀý£¬ÕâЩÀý×ÓĬÈϸù¾ÝÊÜ»¶Ó³Ì¶ÈÅÅÐò¡£Äú¿ÉÒÔΪϲ»¶»òÕ߸оõÓÐÓõĴúÂëµãÔÞ£¬ÄúµÄÆÀ¼Û½«ÓÐÖúÓÚÎÒÃǵÄÏµÍ³ÍÆ¼ö³ö¸ü°ôµÄC++´úÂëʾÀý¡£ ʾÀý1: twall/** * Tunnel through wall. Assumes valid location. * * Note that it is impossible to "extend" rooms past their * outer walls (which are actually part of the room). * * Attempting to do so will produce floor grids which are not part * of the room, and whose "illumination" status do not change with * the rest of the room. */static bool twall(int y, int x){ /* Paranoia -- Require a wall or door or some such */ if (!(square_isdiggable(cave, y, x) || square_iscloseddoor(cave, y, x))) return (false); /* Sound */ sound(MSG_DIG); /* Forget the wall */ square_forget(cave, y, x); /* Remove the feature */ square_tunnel_wall(cave, y, x); /* Update the visuals */ player->upkeep->update |= (PU_UPDATE_VIEW | PU_MONSTERS); /* Fully update the flow */ player->upkeep->update |= (PU_FORGET_FLOW | PU_UPDATE_FLOW); /* Result */ return (true);}
¿ª·¢ÕßID:Chillbon£¬ÏîÄ¿Ãû³Æ:angband£¬´úÂëÐÐÊý:34£¬
ʾÀý2: mainvoid main(){node*root,*root1;clrscr();gotoxy(1,25);cout<<"enter the tree";root=new node;gettree(root,40,1);cout<<"the tree loaded";sound(200);delay(1000);nosound();getch();getch();clrscr();showtree(root,40,10);getch();root1=new node;createig(root,root1);clrscr();showtree(root1,40,10);getch();}
¿ª·¢ÕßID:akreddysoft£¬ÏîÄ¿Ãû³Æ:CollegeCode£¬´úÂëÐÐÊý:24£¬
ʾÀý3: run_bute_defeatedstatic bool run_bute_defeated(Object *o, int hp){ if (o->hp <= (1000 - hp)) { if (o->type == OBJ_MESA) { o->ChangeType(OBJ_MESA_DYING); } else { o->x -= (4 << CSF); o->y -= (4 << CSF); o->ChangeType(OBJ_BUTE_DYING); sound(SND_ENEMY_SQUEAK); XMOVE(-0x100); } ai_bute_dying(o); return 1; } return 0;}
¿ª·¢ÕßID:Angluca£¬ÏîÄ¿Ãû³Æ:nxengine-libretro£¬´úÂëÐÐÊý:24£¬
ʾÀý4: r_touchvoid r_touch(){//gedict_t* stemp;//float best; if ( strneq( other->s.v.classname, "player" ) ) return; if ( other->s.v.health <= 0 ) return; self->mdl = self->s.v.model; sound( other, CHAN_VOICE, self->s.v.noise, 1, ATTN_NORM ); stuffcmd( other, "bf/n" ); self->s.v.solid = SOLID_NOT; other->s.v.items = ( ( int ) other->s.v.items ) | IT_INVISIBILITY; self->s.v.model = "";// do the apropriate action other->invisible_time = 1; other->invisible_finished = self->cnt; G_bprint( PRINT_LOW, "%s recovered a Ring with %d seconds remaining!/n", other->s.v.netname, ( int ) ( other->invisible_finished - g_globalvars.time ) ); /*s=ftos(rint(other->invisible_finished - time)); trap_BPrint (PRINT_LOW, other->s.v.netname); trap_BPrint (PRINT_LOW, " recovered a Ring with "); trap_BPrint (PRINT_LOW, s); trap_BPrint (PRINT_LOW, " seconds remaining!/n"); */ activator = other; SUB_UseTargets(); // fire all targets / killtargets}
¿ª·¢ÕßID:angeld29£¬ÏîÄ¿Ãû³Æ:qwprogs-qvm£¬´úÂëÐÐÊý:36£¬
ʾÀý5: android_mainvoid android_main(android_app *app) { app_dummy(); flatbuffers::FlatBufferBuilder builder; auto name = builder.CreateString("Dog"); auto sound = builder.CreateString("Bark"); auto animal_buffer = sample::CreateAnimal(builder, name, sound); builder.Finish(animal_buffer); // We now have a FlatBuffer that can be stored on disk or sent over a network. // ...Code to store on disk or send over a network goes here... // Instead, we're going to access it immediately, as if we just recieved this. auto animal = sample::GetAnimal(builder.GetBufferPointer()); assert(animal->name()->str() == "Dog"); assert(animal->sound()->str() == "Bark"); (void)animal; // To silence "Unused Variable" warnings. __android_log_print(ANDROID_LOG_INFO, "FlatBufferSample", "FlatBuffer successfully created and verified.");}
¿ª·¢ÕßID:007gzs£¬ÏîÄ¿Ãû³Æ:flatbuffers£¬´úÂëÐÐÊý:24£¬
ʾÀý6: beepvoid QGCAudioWorker::noticeTips(int noticeType, int severity){ if (!muted) { // Prepend high priority text with alert beep /*if (severity < GAudioOutput::AUDIO_SEVERITY_CRITICAL) { beep(); }*/ QString soundPath = ""; getSoundFromType(noticeType,soundPath); if ("" == soundPath)return; QSound sound(QString(":res/")+soundPath); sound.play(); // Wait for the last sound to finish while (!sound.isFinished()) { QGC::SLEEP::msleep(100); } }}
¿ª·¢ÕßID:hangzhouzhikuntech£¬ÏîÄ¿Ãû³Æ:zhikunground£¬´úÂëÐÐÊý:24£¬
ʾÀý7: switchvoid OmegaBoss::Run(void){ Object *&o = game.stageboss.object; if (omg.defeated) return; switch(o->state) { case 0: break; // waiting for trigger by script case OMG_WAIT: // waits for a moment then go to omg.nextstate { o->state++; omg.timer = 0; } case OMG_WAIT+1: { if (++omg.timer >= OMEGA_WAIT_TIME) { omg.timer = 0; o->state = omg.nextstate; } } break; case OMG_APPEAR: { omg.timer = 0; o->frame = 0; o->state = OMG_MOVE; omg.movedir = -OMEGA_SPEED; o->flags |= FLAG_SOLID_MUSHY; } case OMG_MOVE: // rising up/going back into ground { o->frame = 0; o->y += omg.movedir; game.quaketime = 2; omg.timer++; if ((omg.timer & 3) == 0) sound(SND_QUAKE); if (omg.timer >= omg.movetime) { if (omg.movedir < 0) { // was rising out of ground omg.nextstate = OMG_JAWS_OPEN; o->state = OMG_WAIT; } else { // was going back into ground omg.timer = 0; o->state = OMG_UNDERGROUND; o->flags &= ~(FLAG_SOLID_MUSHY | FLAG_SOLID_BRICK); } } } break; case OMG_JAWS_OPEN: // jaws opening { o->state++; omg.animtimer = 0; sound(SND_JAWS); o->sprite = SPR_OMG_OPENED; // select "open" bounding box } case OMG_JAWS_OPEN+1: { omg.animtimer++; if (omg.animtimer > 2) { omg.animtimer = 0; o->frame++; if (o->frame==3) { o->state = OMG_FIRE; omg.firecounter = 0; o->flags |= FLAG_SHOOTABLE; } } } break; case OMG_FIRE: // throwing out red stuff { omg.firecounter++; if (omg.firecounter > omg.startfiring && omg.firecounter < omg.stopfiring) { if ((omg.firecounter % omg.firefreq)==0) { Object *shot; sound(SND_EM_FIRE); shot = SpawnObjectAtActionPoint(o, OBJ_OMEGA_SHOT); shot->xinertia = random(-omg.shotxspd, omg.shotxspd); shot->yinertia = -0x333;//.........ÕâÀﲿ·Ö´úÂëÊ¡ÂÔ.........
¿ª·¢ÕßID:Fordi£¬ÏîÄ¿Ãû³Æ:nxengine-evo£¬´úÂëÐÐÊý:101£¬
ʾÀý8: soundvoid Buzzer::soundIfSilence(Buzzer::SoundType s){ if(sound_ == Off) sound(s);}
¿ª·¢ÕßID:89c2051£¬ÏîÄ¿Ãû³Æ:cheali-charger£¬´úÂëÐÐÊý:5£¬
ʾÀý9: Execute virtual void Execute(const DataObject &object) { wxASSERT(1 <= object.numItems()); wxInt32 thisTile, corner; boost::tie(thisTile, corner) = Utility::decodeSel(object.read<wxInt32>()); //determine other sides wxInt32 tile2, tile3; wxInt32 corner2, corner3; Utility::otherTiles(GetGame(), thisTile, corner, tile2, corner2, tile3, corner3); bool bPort = false; wxInt32 portTile = -1, port = -1; DataObject input(thisTile), output; RULE.Decide(shLogicTileIsPort, input, output); //check for a port tile if(true == output.read<bool>()) { portTile = thisTile; port = corner; } //check for a port tile input = DataObject(tile2); output.reset(); RULE.Decide(shLogicTileIsPort, input, output); if(true == output.read<bool>()) { portTile = tile2; port = corner2; } //check for a port tile input = DataObject(tile3); output.reset(); RULE.Decide(shLogicTileIsPort, input, output); if(true == output.read<bool>()) { portTile = tile3; port = corner3; } //see if they have built on a port if( (-1 < portTile) && ( (port == tile<wxInt32>(shPort1, portTile)) || (port == tile<wxInt32>(shPort2, portTile)) ) ) { bPort = true; } DataObject sound( bPort ? SOUND_PLACE_SETTLEMENT_ON_PORT : SOUND_PLACE_SETTLEMENT); RULE.Execute(shRulePlaySound, sound); }
¿ª·¢ÕßID:Dangr8£¬ÏîÄ¿Ãû³Æ:Cities3D£¬´úÂëÐÐÊý:61£¬
ʾÀý10: inven_drop/** * Drop (some of) a non-cursed inventory/equipment item "near" the current * location * * There are two cases here - a single object or entire stack is being dropped, * or part of a stack is being split off and dropped */void inven_drop(struct object *obj, int amt){ int py = player->py; int px = player->px; struct object *dropped; bool none_left = false; bool quiver = false; char name[80]; char label; /* Error check */ if (amt <= 0) return; /* Check it is still held, in case there were two drop commands queued * for this item. This is in theory not ideal, but in practice should * be safe. */ if (!object_is_carried(player, obj)) return; /* Get where the object is now */ label = gear_to_label(obj); /* Is it in the quiver? */ if (object_is_in_quiver(player, obj)) quiver = true; /* Not too many */ if (amt > obj->number) amt = obj->number; /* Take off equipment, don't combine */ if (object_is_equipped(player->body, obj)) inven_takeoff(obj); /* Get the object */ dropped = gear_object_for_use(obj, amt, false, &none_left); /* Describe the dropped object */ object_desc(name, sizeof(name), dropped, ODESC_PREFIX | ODESC_FULL); /* Message */ msg("You drop %s (%c).", name, label); /* Describe what's left */ if (dropped->artifact) { object_desc(name, sizeof(name), dropped, ODESC_FULL | ODESC_SINGULAR); msg("You no longer have the %s (%c).", name, label); } else if (none_left) { /* Play silly games to get the right description */ int number = dropped->number; dropped->number = 0; object_desc(name, sizeof(name), dropped, ODESC_PREFIX | ODESC_FULL); msg("You have %s (%c).", name, label); dropped->number = number; } else { object_desc(name, sizeof(name), obj, ODESC_PREFIX | ODESC_FULL); msg("You have %s (%c).", name, label); } /* Drop it near the player */ drop_near(cave, &dropped, 0, py, px, false); /* Sound for quiver objects */ if (quiver) sound(MSG_QUIVER); event_signal(EVENT_INVENTORY); event_signal(EVENT_EQUIPMENT);}
¿ª·¢ÕßID:fe051£¬ÏîÄ¿Ãû³Æ:angband£¬´úÂëÐÐÊý:78£¬
ʾÀý11: setForm// ---void PacmanGame::ballEated (QGAMES::Tile* t){ t -> setForm (t -> form (), __BALLEATEDFRAME); // It is turned off to background... _points -> add (__POINTSBALLEATED); sound (__SOUNDCHOMP) -> play (-1);}
¿ª·¢ÕßID:Commnets£¬ÏîÄ¿Ãû³Æ:QGAMES£¬´úÂëÐÐÊý:7£¬
ʾÀý12: ProcessMySensorsMessage//.........ÕâÀﲿ·Ö´úÂëÊ¡ÂÔ......... goto mqttinvaliddata; std::string switchcmd = root["switchcmd"].asString(); if ((switchcmd != "On") && (switchcmd != "Off") && (switchcmd != "Toggle") && (switchcmd != "Set Level")) goto mqttinvaliddata; int level = 0; if (!root["level"].empty()) { if (root["level"].isString()) level = atoi(root["level"].asString().c_str()); else level = root["level"].asInt(); } if (!m_mainworker.SwitchLight(idx, switchcmd, level, -1, false, 0) == true) { _log.Log(LOG_ERROR, "MQTT: Error sending switch command!"); } return; } else if (szCommand == "switchscene") { if (root["switchcmd"].empty()) goto mqttinvaliddata; if (!root["switchcmd"].isString()) goto mqttinvaliddata; std::string switchcmd = root["switchcmd"].asString(); if ((switchcmd != "On") && (switchcmd != "Off")) goto mqttinvaliddata; if (!m_mainworker.SwitchScene(idx, switchcmd) == true) { _log.Log(LOG_ERROR, "MQTT: Error sending scene command!"); } return; } else if (szCommand == "setuservariable") { if (root["value"].empty()) goto mqttinvaliddata; if (!root["value"].isString()) goto mqttinvaliddata; std::string varvalue = root["value"].asString(); m_sql.SetUserVariable(idx, varvalue, true); return; } else if (szCommand == "addlogmessage") { if (root["message"].empty()) goto mqttinvaliddata; if (!root["message"].isString()) goto mqttinvaliddata; std::string msg = root["message"].asString(); _log.Log(LOG_STATUS, "MQTT MSG: %s", msg.c_str()); return; } else if (szCommand == "sendnotification") { std::string subject(""), body(""), sound(""); int priority = 0; if (!root["subject"].empty()) { if (!root["subject"].isString()) goto mqttinvaliddata; subject = root["subject"].asString(); } if (!root["body"].empty()) { if (!root["body"].isString()) goto mqttinvaliddata; body = root["body"].asString(); } if (!root["priority"].empty()) { if (!root["priority"].isInt()) goto mqttinvaliddata; priority = root["priority"].asInt(); } if (!root["sound"].empty()) { if (!root["sound"].isString()) goto mqttinvaliddata; sound = root["sound"].asString(); } m_notifications.SendMessageEx(NOTIFYALL, subject, body, "", priority, sound, true); std::string varvalue = root["value"].asString(); m_sql.SetUserVariable(idx, varvalue, true); return; } else if (szCommand == "getdeviceinfo") { int HardwareID = atoi(result[0][0].c_str()); SendDeviceInfo(HardwareID, idx, "request device", NULL); return; } else { _log.Log(LOG_ERROR, "MQTT: Unknown command received: %s", szCommand.c_str()); return; }mqttinvaliddata: _log.Log(LOG_ERROR, "MQTT: Invalid data received!");}
¿ª·¢ÕßID:interxis£¬ÏîÄ¿Ãû³Æ:domoticz£¬´úÂëÐÐÊý:101£¬
ʾÀý13: effect_do//.........ÕâÀﲿ·Ö´úÂëÊ¡ÂÔ......... return TRUE; } case EF_REMOVE_CURSE: { if (remove_curse()) { if (!p_ptr->timed[TMD_BLIND]) msg("The air around your body glows blue for a moment..."); else msg("You feel as if someone is watching over you."); *ident = TRUE; } return TRUE; } case EF_REMOVE_CURSE2: { remove_all_curse(); *ident = TRUE; return TRUE; } case EF_LIGHT: { if (light_area(damroll(2, 8), 2)) *ident = TRUE; return TRUE; } case EF_SUMMON_MON: { int i; sound(MSG_SUM_MONSTER); for (i = 0; i < randint1(3); i++) { if (summon_specific(py, px, p_ptr->depth, 0, 1)) *ident = TRUE; } return TRUE; } case EF_SUMMON_UNDEAD: { int i; sound(MSG_SUM_UNDEAD); for (i = 0; i < randint1(3); i++) { if (summon_specific(py, px, p_ptr->depth, S_UNDEAD, 1)) *ident = TRUE; } return TRUE; } case EF_TELE_PHASE: { teleport_player(10); *ident = TRUE; return TRUE; } case EF_TELE_LONG: {
¿ª·¢ÕßID:konijn£¬ÏîÄ¿Ãû³Æ:angband£¬´úÂëÐÐÊý:67£¬
ʾÀý14: auto_allocint running_machine::run(bool firstrun){ int error = MAMERR_NONE; // use try/catch for deep error recovery try { // move to the init phase m_current_phase = MACHINE_PHASE_INIT; // if we have a logfile, set up the callback if (options().log()) { m_logfile = auto_alloc(*this, emu_file(OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS)); file_error filerr = m_logfile->open("error.log"); assert_always(filerr == FILERR_NONE, "unable to open log file"); add_logerror_callback(logfile_callback); } // then finish setting up our local machine start(); // load the configuration settings and NVRAM bool settingsloaded = config_load_settings(*this); nvram_load(*this); sound().ui_mute(false); // display the startup screens ui_display_startup_screens(*this, firstrun, !settingsloaded); // perform a soft reset -- this takes us to the running phase soft_reset(); // run the CPUs until a reset or exit m_hard_reset_pending = false; while ((!m_hard_reset_pending && !m_exit_pending) || m_saveload_schedule != SLS_NONE) { g_profiler.start(PROFILER_EXTRA); // execute CPUs if not paused if (!m_paused) m_scheduler.timeslice(); // otherwise, just pump video updates through else m_video->frame_update(); // handle save/load if (m_saveload_schedule != SLS_NONE) handle_saveload(); g_profiler.stop(); } // and out via the exit phase m_current_phase = MACHINE_PHASE_EXIT; // save the NVRAM and configuration sound().ui_mute(true); nvram_save(*this); config_save_settings(*this); } catch (emu_fatalerror &fatal) { mame_printf_error("%s/n", fatal.string()); error = MAMERR_FATALERROR; if (fatal.exitcode() != 0) error = fatal.exitcode(); } catch (emu_exception &) { mame_printf_error("Caught unhandled emulator exception/n"); error = MAMERR_FATALERROR; } catch (std::bad_alloc &) { mame_printf_error("Out of memory!/n"); error = MAMERR_FATALERROR; } // call all exit callbacks registered call_notifiers(MACHINE_NOTIFY_EXIT); zip_file_cache_clear(); // close the logfile auto_free(*this, m_logfile); return error;}
¿ª·¢ÕßID:bdidier£¬ÏîÄ¿Ãû³Æ:MAME-OS-X£¬´úÂëÐÐÊý:88£¬
ʾÀý15: cplay//Continous play without stopping previous soundvoid cplay(int tone, int del){ sound(tone); delay(del);}
¿ª·¢ÕßID:iamareebjamal£¬ÏîÄ¿Ãû³Æ:CompLab_amu£¬´úÂëÐÐÊý:5£¬
ʾÀý16: GrappleAnchorvoid GrappleAnchor(){ gedict_t *owner = PROG_TO_EDICT( self->s.v.owner ); if (other == owner) return; // DO NOT allow the grapple to hook to any projectiles, no matter WHAT! // if you create new types of projectiles, make sure you use one of the // classnames below or write code to exclude your new classname so // grapples will not stick to them. if ( streq(other->s.v.classname, "rocket") || streq(other->s.v.classname, "grenade") || streq(other->s.v.classname, "spike" ) || streq(other->s.v.classname, "hook" )) return; if ( other->ct == ctPlayer ) { // grappling players in prewar is annoying if ( match_in_progress != 2 || (tp_num() == 4 && streq(getteam(other), getteam(owner))) ) { GrappleReset( self ); return; } sound ( self, CHAN_WEAPON, "player/axhit1.wav", 1, ATTN_NORM ); // previously 10 damage per hit, but at close range that could be exploited other->deathtype = dtHOOK; T_Damage ( other, self, owner, 1 ); // make hook invisible since we will be pulling directly // towards the player the hook hit. Quakeworld makes it // too quirky to try to match hook's velocity with that of // the client that it hit. setmodel ( self, "" ); } else { sound ( self, CHAN_WEAPON, "player/axhit2.wav", 1, ATTN_NORM ); // One point of damage inflicted upon impact. Subsequent // damage will only be done to PLAYERS... this way secret // doors and triggers will only be damaged once. if ( other->s.v.takedamage ) { other->deathtype = dtHOOK; T_Damage ( other, self, owner, 1 ); } SetVector( self->s.v.velocity , 0, 0, 0 ); SetVector( self->s.v.avelocity, 0, 0, 0 ); } // conveniently clears the sound channel of the CHAIN1 sound, // which is a looping sample and would continue to play. Tink1 is // the least offensive choice, as NULL.WAV loops and clogs the // channel with silence sound ( owner, CHAN_NO_PHS_ADD + CHAN_WEAPON, "weapons/tink1.wav", 1, ATTN_NORM ); if ( !owner->s.v.button0 ) { GrappleReset( self ); return; } if ( (int)owner->s.v.flags & FL_ONGROUND ) owner->s.v.flags -= FL_ONGROUND; owner->on_hook = true; sound ( owner, CHAN_WEAPON, "weapons/chain2.wav", 1, ATTN_NORM ); owner->ctf_sound = true; self->s.v.enemy = EDICT_TO_PROG( other ); self->s.v.think = (func_t) GrappleTrack; self->s.v.nextthink = g_globalvars.time; self->s.v.solid = SOLID_NOT; self->s.v.touch = (func_t) SUB_Null;}
¿ª·¢ÕßID:JosephPecoraro£¬ÏîÄ¿Ãû³Æ:ktx£¬´úÂëÐÐÊý:80£¬
ʾÀý17: soundvoid sounds::ambient_sound( const tripoint &p, int vol, std::string description ){ sound( p, vol, description, true );}
¿ª·¢ÕßID:Guuo£¬ÏîÄ¿Ãû³Æ:Cataclysm-DDA£¬´úÂëÐÐÊý:4£¬
ʾÀý18: layervoid World::buildScene(){ // Initialize layers for(std::size_t i = 0; i < LayerCount; ++i) { Category::Type type = (i == (int)Entities) ? Category::EntityLayer : Category::None; SceneNode::Ptr layer(new SceneNode(type)); mSceneLayers[i] = layer.get(); mSceneGraph.attachChild(std::move(layer)); } // Background std::unique_ptr<SpriteNode> background(new SpriteNode(mTextures.get(Textures::Background))); background->setScale(sf::Vector2f(2.f, 2.f)); mSceneLayers[Background]->attachChild(std::move(background)); // Tilemap for(int i = 0; i < 8; ++i) { for(int j = 0; j < 8; ++j) { std::unique_ptr<SpriteNode> tile(new SpriteNode(mTextures.get(Textures::Tile))); tile->setPosition(toIsoCoord(j, i)); mSceneLayers[Tilemap]->attachChild(std::move(tile)); } } // Camera std::unique_ptr<CameraNode> camera(new CameraNode(mWorldView)); mSceneGraph.attachChild(std::move(camera)); // Sounds std::unique_ptr<SoundNode> sound(new SoundNode(mSounds)); mSceneLayers[Decorations]->attachChild(std::move(sound)); // Help std::unique_ptr<HelpNode> help(new HelpNode(mTextures)); mSceneGraph.attachChild(std::move(help)); // Add the Traplist Node, that handle trap creation std::unique_ptr<TraplistNode> traplist(new TraplistNode(mTextures, mFonts)); mSceneLayers[Entities]->attachChild(std::move(traplist)); Command cmd; cmd.action = derivedAction<TraplistNode>([](TraplistNode& node, sf::Time dt) { node.generateTraps(5); }); cmd.category = Category::Traplist; mCommandQueue.push(cmd); // Player std::unique_ptr<PlayerEntity> player(new PlayerEntity(mTextures)); player->setPosition(toIsoCoord(1, 1)); player->setGridPosition(sf::Vector2i(1, 1)); mPlayer = player.get(); std::unique_ptr<BubbleNode> bubble(new BubbleNode(mTextures, mFonts)); mPlayer->setBubble(bubble.get()); bubble->setString("KILL KIDS! EXTEMINATE!"); player->attachChild(std::move(bubble)); mSceneLayers[Entities]->attachChild(std::move(player)); // Ennemies /*std::unique_ptr<BasicKidNode> kid(new BasicKidNode(mTextures)); kid->setPosition(toIsoCoord(0, 0)); kid->setGridPosition(sf::Vector2i(0, 0)); mSceneLayers[Entities]->attachChild(std::move(kid)); kid.reset(new BasicKidNode(mTextures)); kid->setPosition(toIsoCoord(0, 2)); kid->setGridPosition(sf::Vector2i(0, 2)); mSceneLayers[Entities]->attachChild(std::move(kid));*/ // Waves & Points std::unique_ptr<WaveGenerator> waves(new WaveGenerator(mTextures, mFonts, mMusic)); waves->nextWave(); mSceneLayers[Entities]->attachChild(std::move(waves));}
¿ª·¢ÕßID:Lo-X£¬ÏîÄ¿Ãû³Æ:ludumdare31£¬´úÂëÐÐÊý:87£¬
ʾÀý19: mainint main() { // GLFW¤Î³õÆÚ»¯ if (!glfwInit()) return -1; // GLFW Widnow¤òÓÃÒâ GLFWwindow* window = glfwCreateWindow(640, 480, "Play WAV fie", nullptr, nullptr); // Windows¤òÉú³É¤Ç¤¤Ê¤±¤ì¤Ð C++ soundLockº¯Êý´úÂëʾÀý C++ sorterº¯Êý´úÂëʾÀý
|