本文整理汇总了C++中Sound::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ Sound::Init方法的具体用法?C++ Sound::Init怎么用?C++ Sound::Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sound
的用法示例。
在下文中一共展示了Sound::Init方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defined
Sound * Sound::CreateMusic(const String & fileName, eType type, int32 priority /*= 0*/)
{
if(TYPE_STATIC != type && TYPE_STREAMED != type && TYPE_MANAGED != type)
return 0;
#if defined(__DAVAENGINE_IPHONE__)
Sound * sound = new MusicIos(fileName);
if(!sound->Init())
{
SafeRelease(sound);
}
else
{
SoundSystem::Instance()->GroupMusic()->AddSound(sound);
}
return sound;
#else
Sound * sound = new Sound(fileName, type, priority);
if(!sound->Init())
{
SafeRelease(sound);
}
else
{
SoundSystem::Instance()->GroupMusic()->AddSound(sound);
}
return sound;
#endif //#if defined(__DAVAENGINE_IPHONE__)
}
示例2: Sound
Sound * Sound::CreateFX(const String & fileName, eType type, int32 priority /*= 0*/)
{
Sound * sound = new Sound(fileName, type, priority);
SoundSystem::Instance()->GroupFX()->AddSound(sound);
sound->Init();
return sound;
}
示例3: Create
Sound* SoundManager::Create(const String& pSoundFileName, Bool pIs3DSound)
{
// Ask the sound subsystem to create a sound for us.
Sound* sound = Cast<Sound>(SoundSubsystem::Instance()->Create(Sound::StaticClass()));
std::map<String, SoundData*>::iterator itFind = mLoadedSounds.find(pSoundFileName);
if(itFind != mLoadedSounds.end())
{
itFind->second->AddRef();
sound->Create(itFind->second, pIs3DSound);
}
else
{
ResourceImporter* importer = ResourceManager::Instance()->GetImporterForFile(pSoundFileName, SoundData::StaticClass());
GD_ASSERT(importer);
SoundData* soundData = Cast<SoundData>(importer->Import(pSoundFileName));
mLoadedSounds[pSoundFileName] = soundData;
sound->Create(soundData, pIs3DSound);
sound->AddRef();
}
sound->Init();
return sound;
}
示例4: Sound
Sound * Sound::Create(const String & fileName, eType type, int32 priority)
{
if(TYPE_STATIC != type && TYPE_STREAMED != type && TYPE_MANAGED != type)
return 0;
Sound * sound = new Sound(fileName, type, priority);
if(!sound->Init())
{
SafeRelease(sound);
}
return sound;
}
示例5: defined
Sound * Sound::CreateMusic(const String & fileName, eType type, int32 priority /*= 0*/)
{
#if defined(__DAVAENGINE_IPHONE__)
Sound * sound = new MusicIos(fileName);
SoundSystem::Instance()->GroupMusic()->AddSound(sound);
return sound;
#else
Sound * sound = new Sound(fileName, type, priority);
SoundSystem::Instance()->GroupMusic()->AddSound(sound);
sound->Init();
return sound;
#endif //#if defined(__DAVAENGINE_IPHONE__)
}
示例6: main
int main(int argc, char** argv){
//ShowWindow(GetForegroundWindow(), SW_HIDE);
Display display(WIDTH, HEIGHT, "OpenGL");
if (Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 2048) < 0){ std::cout << "ERROR: MixOpenAudio: " << Mix_GetError() << std::endl; }
World world; Shader* shader = world.GetShader();
Brush br(24, 6, 24, &world, "./res/tex/pxl_cuboid.jpg"); br.Move(-2, 0, -2);
Brush c1(1, 0.5, 3, &world, "./res/tex/pxl_cuboid.jpg"); c1.Move(2, 0, 2);
Brush c2(1, 1.0, 3, &world, "./res/tex/pxl_cuboid.jpg"); c2.Move(3, 0, 2);
Brush c3(1, 0.2, 1.5, &world, "./res/tex/pxl_cuboid.jpg"); c3.Move(6, 0.9, 2);
Brush c4(1, 0.2, 1.5, &world, "./res/tex/pxl_cuboid.jpg"); c4.Move(6, 1.1, 3.5);
Brush box(1, 1, 1, &world, "./res/tex/pxl_cuboid.jpg"); box.Move(6, 0.5, 6);
Player player(shader); display.SetPlayer(player);
Camera cammy; cammy.Init(glm::vec3(0, 0, 0), 70.0f, 1600 / 900, 0.01f, 1000.0f);
Ambient amb1; shader->AddAmbient(&amb1); amb1.m_range = 3; amb1.m_intensity = 0.2;
Ambient amb2; shader->AddAmbient(&amb2); amb2.SetPosition(1, 1, 1);
Ambient amb3; shader->AddAmbient(&amb3); amb3.SetPosition(15, 1, 10); amb3.SetColor(0.2, 0.5, 0.7);
Prop prop(world.GetMesh("./res/models/cucco.obj"), world.GetTexture("./res/models/cucco.jpg"), shader); world.AddProp(&prop);
Prop stone(world.GetMesh("./res/models/salesman.obj"), world.GetTexture("./res/models/salesman.jpg"), shader); world.AddProp(&stone); stone.Scale(0.01); stone.Teleport(0, -10, 0);
Sound laugh; laugh.Init("./res/sounds/sale_laugh.wav", 0.7); laugh.Load();
player.SetListener(Player_OnClick, OnClick);
float count = 0.0f;
while (!display.IsClosed()){
display.Clear(0.1f, 0.3f, 0.8f, 1.0f);
world.Draw(&player.GetCamera());
player.DrawHUD();
display.Update();
laugh.Update(player.GetCamera().GetPos());
if (count >= 2 * PI){ count = 0; }
count += 0.05f;
c4.Rotate(0, 1, 0);
if (glm::distance(prop.position, player.GetCamera().GetPos()) >= 2){
prop.velocity = (player.GetCamera().GetPos() - prop.position) / 64.0f;
prop.velocity.y = 0;
prop.SetRotate(0, PI / 2 - GetAngleRad(glm::vec2(0, 0), GetXZ(prop.velocity)), 0);
}
else{
prop.velocity *= 0;
}
prop.Rotate(0, sin(count) * PI / 360, 0);
amb1.m_position = player.GetCamera().GetPos();
if (player.mouse_buttons[0]){//Left Clicking
player.mouse_buttons[0] = false;
stone.Teleport(world.GetAimPoint(&player));
stone.SetRotate(0, PI / 2 - GetAngleRad(glm::vec2(0, 0), GetXZ(player.GetCamera().GetPos() - stone.position)), 0);
laugh.pos = stone.position;
laugh.Emit(player.GetCamera().GetPos());
}
world.Update();
player.Update();
world.IsCollide(&player);
player.CommenceVelocity();
}
Mix_CloseAudio();
Mix_Quit();
return 0;
}