本文整理汇总了C++中Sound::Loop方法的典型用法代码示例。如果您正苦于以下问题:C++ Sound::Loop方法的具体用法?C++ Sound::Loop怎么用?C++ Sound::Loop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sound
的用法示例。
在下文中一共展示了Sound::Loop方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void s3dge::loop_sound_callback(ga_Handle* handle, void* context)
{
Sound* sound = (Sound*)context;
sound->Loop();
ga_handle_destroy(handle);
}
示例2: loop_on_finish
void loop_on_finish(ga_Handle* in_handle, void* in_context)
{
Sound* sound = (Sound*) in_handle->sound;
sound->Loop();
ga_handle_destroy(in_handle);
}
示例3: main
int main(int argc, char *argv[]){
glutInit(&argc, argv);
GameDebugger* debugger = GameDebugger::GetInstance();
assert(debugger->OpenDebugFile());
debugger->WriteDebugMessageToConsole("Hello, World", 31);
debugger->WriteToDebugFile("Wrote to file", 32);
TaskQueue *taskManager = new TaskQueue(NUM_THREADS);
ConsoleCreateRoom();
GameRoom gr;
if (argc > 1){
string path = pathCat(GAME_DATA_ROOMS_FOLDER, argv[1]);
GameRoom::LoadRoom(path.c_str(), gr);
}
//For testing purposes. To make sure it reads debug.room
char debugName[1000];
strcpy(debugName, GAME_DATA_ROOMS_FOLDER);
strcat(debugName, "debug.room");
GameRoom debug;
assert(GameRoom::LoadRoom(debugName, debug));
vector<GameObject*> obs = debug.GetGameObjects();
//map<string, GameWorldObject>::iterator wobs = debug.GetRoomWorldObjectsIterator();
for(unsigned int w = 0; w<obs.size(); w++){
//load starting meshes
GameObject *gwo = obs[w];
cout<<gwo->GetName()<<endl;
MyMesh *tmp = new MyMesh();
if (gwo->GetMeshFile()){
string fname = pathCat(".", gwo->GetMeshFile());
if (! MyMeshIO::LoadMesh(*tmp, fname)){
cerr<<"couldn't load (" << gwo->GetMeshFile() << ") for " <<gwo -> GetName() <<endl;
gwo->SetMesh(NULL);
}else{
gwo->SetMesh(tmp);
NavShot::room = tmp;
}
}
}
ComputeBoundingBoxesAndPhysicsConstants(obs);
//cin.ignore(1);
///////////////////////////////////////////////////
//TODO: load from file
GameState *gs = GameState::GetInstance();
Vector3f pos(0.0f, 0, -10.0f);
Vector3f up(0, 1.0f, 0);
Vector3f dir(0.0f, 0, 1.0f);
float radius =0, n = 0.1, f = 600, fovy = 80, aspect = ((float)16.0/9.0);
Camera cam(pos, dir, up, radius, n, f, fovy, aspect);
gs->SetRoom(&debug);
gs->SetCamera(&cam);
Vector3f enemyPos(0.0f, 3.0f, 10.0f);
gs->AddActor(new MetaballEnemy(enemyPos, 2, 2.0f));
Render::gameState = gs;
Render::GlutInitialize();
SCollision::gameState = gs;
RegisterControls();
Controller::Initialize(taskManager, gs);
/////////////////////////////////////////////////
// TO DO:
// Pass GameRoom debug to Render module. Render the
// room.
/////////////////////////////////////////////////
glutTimerFunc(0, Controller::GlutSync, 0);
//glutMotionFunc(mouseMoveCB);
//glutMouseFunc(mouseFunc);
Sound::InitializeSounds();
Music *music = new Music("sounds/run2.ogg", 0.3f);
music->Loop();
Sound *backgroundNoise = new Sound("sounds/metallic_roar.wav", 0.2f);
backgroundNoise->Loop();
glutMainLoop(); //this should only be called once, and AT THE END of the initialization routine.
Sound::UninitializeSounds();
assert(debugger->CloseDebugFile());
return 0;
}