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; } }
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; } }