当前位置: 首页>>代码示例>>C++>>正文


C++ SoundManager::deinit方法代码示例

本文整理汇总了C++中SoundManager::deinit方法的典型用法代码示例。如果您正苦于以下问题:C++ SoundManager::deinit方法的具体用法?C++ SoundManager::deinit怎么用?C++ SoundManager::deinit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SoundManager的用法示例。


在下文中一共展示了SoundManager::deinit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main


//.........这里部分代码省略.........
            rmanager->showShadow(false);

        SpeedController scontroller(gameConfig.getFloat("gamefps"));
        SpeedController::setMainInstance(&scontroller);
        scontroller.setDrawFPS(gameConfig.getBool("showfps"));

        smanager = SoundManager::createSoundManager();
        smanager->init();
        smanager->setVolume(gameConfig.getFloat("global_volume"));
        smanager->setMute(gameConfig.getBool("mute"));
        smanager->playSound("sounds/bums.wav", 0.0);
        smanager->playSound("sounds/pfiff.wav", 0.0);

        std::string bg = std::string("backgrounds/") + gameConfig.getString("background");
        if (PHYSFS_exists(bg.c_str()))
            rmanager->setBackground(bg);

        InputManager* inputmgr = InputManager::createInputManager();

        if (argc == 3)
        {
            if (strstr(argv[1], ".lua"))
            {
                gameConfig.setString("left_player_human", "false");
                gameConfig.setString("left_script_name", argv[1]);
            }
            else
            {
                gameConfig.setString("left_player_human", "true");
                gameConfig.setString("left_player_name", argv[1]);
            }
            if (strstr(argv[2], ".lua"))
            {
                gameConfig.setString("right_player_human", "false");
                gameConfig.setString("right_script_name", argv[2]);
            }
            else
            {
                gameConfig.setString("right_player_human", "true");
                gameConfig.setString("right_player_name", argv[2]);
            }
            gameConfig.saveFile("config.xml");
            State::setCurrentState(new LocalGameState(), true);
        }

        int running = 1;
        while (running)
        {
            inputmgr->updateInput();
            running = inputmgr->running();

            // This is true by default for compatibility, GUI states may
            // disable it if necessary
            rmanager->drawGame(true);
            IMGUI::getSingleton().begin();
                State::getCurrentState()->step();
            rmanager = &RenderManager::getSingleton(); //RenderManager may change
            //draw FPS:
            if (scontroller.getDrawFPS())
            {
                // We need to ensure that the title bar is only set
                // when the framerate changed, because setting the
                // title can ne quite resource intensive on some
                // windows manager, like for example metacity.
                static int lastfps = 0;
                int newfps = scontroller.getFPS();
                if (newfps != lastfps)
                {
                    std::stringstream tmp;
                    tmp << AppTitle << "    FPS: " << newfps;
                    rmanager->setTitle(tmp.str());
                }
                lastfps = newfps;
            }

            if (!scontroller.doFramedrop())
            {
                rmanager->draw();
                IMGUI::getSingleton().end();
                BloodManager::getSingleton().step();
                rmanager->refresh();
            }
            scontroller.update();
        }
    }
    catch (std::exception& e)
    {
        std::cerr << e.what() << std::endl;
        if (rmanager)
            rmanager->deinit();
        if (smanager)
            smanager->deinit();
        SDL_Quit();
        PHYSFS_deinit();
        exit (EXIT_FAILURE);
    }

    deinit();
    exit(EXIT_SUCCESS);
}
开发者ID:angelonuffer,项目名称:blobby-volley-2,代码行数:101,代码来源:main.cpp


注:本文中的SoundManager::deinit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。