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


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

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


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

示例1: BMP

//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{

        PBMP bContext = new BMP();
        bContext->Width = ClientWidth;
        bContext->Height = ClientHeight;
        context = new FastBitmap(bContext);
        rm = new RenderManager();
        rm->setContext(context,Canvas,ClientWidth, ClientHeight, clWhite);
        DoubleBuffered=true;
        gm = new GameManager();
        gm->setRenderManager(rm);
        SpriteFabric *sf = SpriteFabric::getInstance();
        sc = 0;
        map = 0;
        SoundManager * sm = SoundManager::getInstance();
        sm->init(Button1);

        UserStats::getInstance()->loadFromFile("config/autoexec.txt");

}
开发者ID:SpaceWind,项目名称:elo2kbuilder,代码行数:22,代码来源:main.cpp

示例2: main

int main(int argc, char* argv[])
{
    PHYSFS_init(argv[0]);
    setupPHYSFS();
    
    SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);
    SDL_EnableUNICODE(1);
    atexit(SDL_Quit);
    srand(SDL_GetTicks());
    // Default is OpenGL and false
    // choose renderer
    RenderManager *rmanager = 0;
    SoundManager *smanager = 0;

    try
    {
        UserConfig gameConfig;
        gameConfig.loadFile("config.xml");
        
        TextManager::createTextManager(gameConfig.getString("language"));
        
        if(gameConfig.getString("device") == "SDL")
            rmanager = RenderManager::createRenderManagerSDL();
        else if (gameConfig.getString("device") == "GP2X")
            rmanager = RenderManager::createRenderManagerGP2X();
        else if (gameConfig.getString("device") == "OpenGL")
            rmanager = RenderManager::createRenderManagerGL2D();
        else
        {
            std::cerr << "Warning: Unknown renderer selected!";
            std::cerr << "Falling back to OpenGL" << std::endl;
            rmanager = RenderManager::createRenderManagerGL2D();
        }

        // fullscreen?
        if(gameConfig.getString("fullscreen") == "true")
            rmanager->init(800, 600, true);
        else
            rmanager->init(800, 600, false);

        if(gameConfig.getString("show_shadow") == "true")
            rmanager->showShadow(true);
        else
            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
//.........这里部分代码省略.........
开发者ID:angelonuffer,项目名称:blobby-volley-2,代码行数:101,代码来源:main.cpp

示例3: main

	int main(int argc, char* argv[])
#endif
{
	DEBUG_STATUS("started main");

	FileSystem filesys(argv[0]);
	setupPHYSFS();

	DEBUG_STATUS("physfs initialised");

	SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);

	DEBUG_STATUS("SDL initialised");

	atexit(SDL_Quit);
	srand(SDL_GetTicks());
	// Default is OpenGL and false
	// choose renderer
	RenderManager *rmanager = 0;
	SoundManager *smanager = 0;


	// Test Version Startup Warning
	#ifdef TEST_VERSION
	struct tm* ptm;
	time_t time = std::time(0);
	ptm = gmtime ( &time );

	if( ptm->tm_year > (2014-1900) || ptm->tm_mon >= 4 )
	{
		SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "TEST VERISON OUTDATED",
									(std::string("This is a test version of ") + AppTitle + " which expired on "
									"1.04.2014. Please visit blobby.sourceforge.net for a newer version").c_str(), 0);
		return -1;
	}

	SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "TEST VERISON WARNING",
								(std::string("This is a test version of ") + AppTitle + " for testing only.\n"
								"It might be unstable and/or incompatible to the current release. "
								"Use of this version is limited to 1.04.2014.\nUntil then, "
								"the final version will most likely be released and you should update to that one.\n"
								"Visit blobby.sourceforge.net for more information or bug reporting.").c_str(), 0);
	#endif

	try
	{
		UserConfig gameConfig;
		gameConfig.loadFile("config.xml");

		TextManager::createTextManager(gameConfig.getString("language"));

		if(gameConfig.getString("device") == "SDL")
			rmanager = RenderManager::createRenderManagerSDL();
		/*else if (gameConfig.getString("device") == "GP2X")
			rmanager = RenderManager::createRenderManagerGP2X();*/
#ifndef __ANDROID__
	#ifndef __APPLE__
		else if (gameConfig.getString("device") == "OpenGL")
			rmanager = RenderManager::createRenderManagerGL2D();
		else
		{
			std::cerr << "Warning: Unknown renderer selected!";
			std::cerr << "Falling back to OpenGL" << std::endl;
			rmanager = RenderManager::createRenderManagerGL2D();
		}
	#else
		#if MAC_OS_X
			else if (gameConfig.getString("device") == "OpenGL")
				rmanager = RenderManager::createRenderManagerGL2D();
			else
			{
				std::cerr << "Warning: Unknown renderer selected!";
				std::cerr << "Falling back to OpenGL" << std::endl;
				rmanager = RenderManager::createRenderManagerGL2D();
			}
		#endif
	#endif
#endif

		// fullscreen?
		if(gameConfig.getString("fullscreen") == "true")
			rmanager->init(BASE_RESOLUTION_X, BASE_RESOLUTION_Y, true);
		else
			rmanager->init(BASE_RESOLUTION_X, BASE_RESOLUTION_Y, false);

		if(gameConfig.getString("show_shadow") == "true")
			rmanager->showShadow(true);
		else
			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"));
		/// \todo play sound is misleading. what we actually want to do is load the sound
		smanager->playSound("sounds/bums.wav", 0.0);
//.........这里部分代码省略.........
开发者ID:EliasOenal,项目名称:blobby,代码行数:101,代码来源:main.cpp


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