示例#1
0
	void initVideos()
	{
		
		bool video_enabled = GameOptionManager::getInstance()->getOptionByName( "menu_video_enabled" )? GameOptionManager::getInstance()->getOptionByName( "menu_video_enabled" )->getBooleanValue() : true;

		if( video_enabled && game->inCombat && videoDisabledDuringGame )
			video_enabled = false;

		sfx::SoundMixer *mixer = game->gameUI->getSoundMixer();
		IStorm3D_StreamBuilder *builder = 0;
		if(mixer)
			builder = mixer->getStreamBuilder();

		if( video_enabled )
			backgroundVideo = ogui->LoadOguiVideo( getLocaleGuiString( "gui_menu_video_video" ), builder );
		
		if( backgroundVideo == NULL )
		{
			// background->setBackgroundImage( );
			backgroundVideo = ogui->LoadOguiImage( getLocaleGuiString( "gui_menu_video_image" ) );
		}

		videoButton->SetDisabledImage( backgroundVideo );

		{
			bool playLogoVideo = GameOptionManager::getInstance()->getOptionByName( "menu_logo_video_enabled" )? GameOptionManager::getInstance()->getOptionByName( "menu_logo_video_enabled" )->getBooleanValue() : true;
			OguiButton* button;
			button = ogui->CreateSimpleImageButton( foreground, 
													getLocaleGuiInt( "gui_menu_logo_x", 0 ), 
													getLocaleGuiInt( "gui_menu_logo_y", 0 ),
													getLocaleGuiInt( "gui_menu_logo_w", 1 ),
													getLocaleGuiInt( "gui_menu_logo_h", 1 ), 
													NULL, NULL, NULL, NULL );

			if( ( video_enabled || playLogoVideoAlways ) && playLogoVideo )
				logoVideo = ogui->LoadOguiVideo( getLocaleGuiString( "gui_menu_logo_video" ), builder );
			
			if( logoVideo == NULL ) 
				logoVideo = ogui->LoadOguiImage( getLocaleGuiString( "gui_menu_logo_img" ) );
			

			button->SetDisabled( true );
			button->SetDisabledImage( logoVideo );

			logoButton = button;
		}
	}
示例#2
0
	MenuCollectionImpl( MenuCollection* self, Ogui* ogui, Game* game, int player ) :
	  self( self ),
	  ogui( ogui ),
	  game( game ),
	  activeMenu( NULL ),
	  backgroundVideo( NULL ),
	  backgroundButton( NULL ),
	  backgroundButtonData( NULL ),
	  logoButton( NULL ),
	  logoVideo( NULL ),
	  videoButton( NULL ),
	  background( NULL ),
	  foreground( NULL ),
	  transparency( 100 ),
	  fadeIn( true ),
		backgroundAlternativeFader( NULL ),
		backgroundAlternativeButton( NULL )
	{
		background = ogui->CreateSimpleWindow(	getLocaleGuiInt( "gui_menu_background_x", 0 ), 
												getLocaleGuiInt( "gui_menu_background_y", 0 ), 
												getLocaleGuiInt( "gui_menu_background_w", 1 ), 
												getLocaleGuiInt( "gui_menu_background_h", 1 ), 
												getLocaleGuiString( "gui_menu_background_img" ) );

		const char *alternatives_str = NULL;
		if(DHLocaleManager::getInstance()->getString(DHLocaleManager::BANK_GUI, "gui_menu_background_alternatives", &alternatives_str))
		{
			int alternatives = atoi(alternatives_str);
			if(alternatives > 0)
			{
				backgroundAlternativeButton = ogui->CreateSimpleImageButton(background,
					getLocaleGuiInt("gui_menu_background_alternatives_x", 0), getLocaleGuiInt("gui_menu_background_alternatives_y", 0),
					getLocaleGuiInt("gui_menu_background_alternatives_w", 0), getLocaleGuiInt("gui_menu_background_alternatives_h", 0),
					NULL, NULL, NULL, NULL, 0, NULL, false);
				backgroundAlternativeButton->SetDisabled(true);

				backgroundAlternativeFader = ogui->CreateSimpleImageButton(background,
					getLocaleGuiInt("gui_menu_background_alternatives_x", 0), getLocaleGuiInt("gui_menu_background_alternatives_y", 0),
					getLocaleGuiInt("gui_menu_background_alternatives_w", 0), getLocaleGuiInt("gui_menu_background_alternatives_h", 0),
					NULL, NULL, NULL, NULL, 0, NULL, false);
				backgroundAlternativeFader->SetDisabled(true);

				backgroundAlternatives.resize(alternatives);
				for(int i = 0; i < alternatives; i++)
				{
					std::string prefix = "gui_menu_background_alt" + boost::lexical_cast<std::string>(i);
					backgroundAlternatives[i].img = ogui->LoadOguiImage( getLocaleGuiString( (prefix+"_img").c_str() ) );
					backgroundAlternatives[i].time = getLocaleGuiInt( (prefix+"_time").c_str() , 0 );
					backgroundAlternatives[i].fade = getLocaleGuiInt( (prefix+"_fade").c_str() , 0 );
				}

				backgroundAlternativeButton->SetDisabledImage(backgroundAlternatives[0].img);
				currentBackgroundAlternative = 0;
				previousBackgroundAlternative = 0;
				lastBackgroundAlternativeSwitch = Timer::getTime();
			}
		}
	
		foreground = ogui->CreateSimpleWindow(	getLocaleGuiInt( "gui_menu_foreground_x", 0 ), 
												getLocaleGuiInt( "gui_menu_foreground_y", 0 ), 
												getLocaleGuiInt( "gui_menu_foreground_w", 1 ), 
												getLocaleGuiInt( "gui_menu_foreground_h", 1 ), 
												getLocaleGuiString( "gui_menu_foreground_img" ) );
		foreground->SetReactMask( 0 );
		
		


		videoButton = ogui->CreateSimpleImageButton( background, 
							getLocaleGuiInt( "gui_menu_video_x", 0 ), getLocaleGuiInt( "gui_menu_video_y", 0 ),
							getLocaleGuiInt( "gui_menu_video_w", 1024 ), getLocaleGuiInt( "gui_menu_video_h", 768 ), NULL, NULL, NULL );
		videoButton->SetDisabled( true );

		backgroundButton = ogui->CreateSimpleImageButton( background, 0, 0, 1024, 768, NULL, NULL, NULL );
		backgroundButton->SetDisabled( true );

		background->Hide();
		foreground->Hide();
		background->SetUnmovable();
		foreground->SetUnmovable();

		ogui->SetCursorImageState( 0, DH_CURSOR_ARROW );

		fonts.big.normal =			ogui->LoadFont( getLocaleGuiString( "gui_menu_font_big" ) );
		fonts.medium.normal =		ogui->LoadFont( getLocaleGuiString( "gui_menu_font_medium" ) );
		fonts.medium.highlighted =	ogui->LoadFont( getLocaleGuiString( "gui_menu_font_medium_high" ) );
		fonts.little.normal =		ogui->LoadFont( getLocaleGuiString( "gui_menu_font_little" ) );
		fonts.little.highlighted =	ogui->LoadFont( getLocaleGuiString( "gui_menu_font_little_high" ) );

		

		background->StartEffect( OGUI_WINDOW_EFFECT_FADEIN, 3000 );
		foreground->StartEffect( OGUI_WINDOW_EFFECT_FADEIN, 3000 );

		if( game->inCombat == false )
			transparencyFadeSpeed = 50.0f;
		else transparencyFadeSpeed = 20.0f;
		
		const int menu_to_be_opened = MenuCollection::MENU_TYPE_MAINMENU;
		openMenu( menu_to_be_opened );
	}
示例#3
0
	void initVideos()
	{
		
		bool video_enabled = GameOptionManager::getInstance()->getOptionByName( "menu_video_enabled" )? GameOptionManager::getInstance()->getOptionByName( "menu_video_enabled" )->getBooleanValue() : true;

		if( video_enabled && game->inCombat && videoDisabledDuringGame )
			video_enabled = false;

		sfx::SoundMixer *mixer = game->gameUI->getSoundMixer();
		IStorm3D_StreamBuilder *builder = 0;
		if(mixer)
			builder = mixer->getStreamBuilder();

		if( video_enabled )
			backgroundVideo = ogui->LoadOguiVideo( getLocaleGuiString( "gui_menu_video_video" ), builder );
		
		if( backgroundVideo == NULL )
		{
			// background->setBackgroundImage( );
			backgroundVideo = ogui->LoadOguiImage( getLocaleGuiString( "gui_menu_video_image" ) );
		}

#ifdef PROJECT_SHADOWGROUNDS
		float normal_aspect = (background->GetSizeX() * ogui->GetScaleX()) / (float)(background->GetSizeY() * ogui->GetScaleY());

		float video_aspect = (float)atof( getLocaleGuiString("gui_menu_video_video_aspect") );

		float texcoord_multiplier = (video_aspect / normal_aspect);
		float texcoord_offset = (1.0f - texcoord_multiplier) * 0.5f;

		float xm = 0.0f, ym = 0.0f;
		OguiStormImage* bv = (OguiStormImage*)backgroundVideo;
		if (bv->video != NULL)
		{
			bv->video->getTextureCoords(xm, ym);
			if(texcoord_multiplier > 1.0f)
			{
				videoButton->SetRepeat(xm, texcoord_multiplier * ym);
				videoButton->SetScroll(0.0f, texcoord_offset);
			}
		}
#endif

		videoButton->SetDisabledImage( backgroundVideo );

		{
			bool playLogoVideo = GameOptionManager::getInstance()->getOptionByName( "menu_logo_video_enabled" )? GameOptionManager::getInstance()->getOptionByName( "menu_logo_video_enabled" )->getBooleanValue() : true;
			OguiButton* button;
			button = ogui->CreateSimpleImageButton( foreground, 
													getLocaleGuiInt( "gui_menu_logo_x", 0 ), 
													getLocaleGuiInt( "gui_menu_logo_y", 0 ),
													getLocaleGuiInt( "gui_menu_logo_w", 1 ),
													getLocaleGuiInt( "gui_menu_logo_h", 1 ), 
													NULL, NULL, NULL, 0 );

			if( ( video_enabled || playLogoVideoAlways ) && playLogoVideo )
				logoVideo = ogui->LoadOguiVideo( getLocaleGuiString( "gui_menu_logo_video" ), builder );
			
			if( logoVideo == NULL ) 
				logoVideo = ogui->LoadOguiImage( getLocaleGuiString( "gui_menu_logo_img" ) );

#ifdef PROJECT_SHADOWGROUNDS
			normal_aspect = (button->GetSizeX() * ogui->GetScaleX()) / (float)(button->GetSizeY() * ogui->GetScaleY());
			video_aspect = (float)atof( getLocaleGuiString("gui_menu_logo_video_aspect") );

			texcoord_multiplier = (video_aspect / normal_aspect);
			texcoord_offset = (1.0f - texcoord_multiplier) * 0.5f;

			OguiStormImage* lv = (OguiStormImage*)logoVideo;
			if (lv->video != NULL)
			{
				lv->video->getTextureCoords(xm, ym);
				if(texcoord_multiplier > 1.0f)
				{
					button->SetRepeat(xm, texcoord_multiplier * ym);
					button->SetScroll(0.0f, texcoord_offset);
				}
			}
#endif

			button->SetDisabled( true );
			button->SetDisabledImage( logoVideo );

			logoButton = button;
		}
	}