Added the option to use the current backgroundmusic's video as background. Icon for that option is needed!

This commit is contained in:
Stephan Sundermann committed 2012-03-06 16:59:43 +01:00
1 parent d348313b16
commit edf0249951
4 files changed
+91 -9

No files matched your search

@@ -316,13 +316,60 @@
<!-- <Space>: Reflection Space of selected button-->
<!-- <Height>: Reflection Height of selected button-->
</ButtonShowVideo>
<ButtonToBackgroundVideo>
<!--<Skin>: Texture name-->
<Skin>VideoIcon</Skin>
<!--<SkinSelected>: Texture name for selected button-->
<SkinSelected>VideoIcon</SkinSelected>
<!--<X>, <Y>, <Z>, <W>, <H>: Button position, width and height-->
<X>480</X>
<Y>0</Y>
<Z>0,00</Z>
<W>50</W>
<H>50</H>
<!--<Color>: Button color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>ButtonColor</Color>
<!--<SColor>: Selected button color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>ButtonSColor</SColor>
<Text>
<!--<X>, <Y>: Text position-->
<X>315</X>
<Y>0</Y>
<!--<H>: Text height-->
<H>32</H>
<!--<MaxW>: Maximum text width (if exists)-->
<MaxW>142</MaxW>
<!--<Color>: Text color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>ButtonTextColor</Color>
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>ButtonTextSColor</SColor>
<!--<Align>: Text align: Left, Center, Right-->
<Align>Center</Align>
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
<Style>Bold</Style>
<!--<Font>: Text font name-->
<Font>Normal</Font>
<!--<Text>: Text or translation tag-->
<Text></Text>
</Text>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
<!--<SReflection> If exists:-->
<!-- <Space>: Reflection Space of selected button-->
<!-- <Height>: Reflection Height of selected button-->
</ButtonToBackgroundVideo>
<ButtonSing>
<!--<Skin>: Texture name-->
<Skin>DuetIcon</Skin>
<!--<SkinSelected>: Texture name for selected button-->
<SkinSelected>DuetIcon</SkinSelected>
<!--<X>, <Y>, <Z>, <W>, <H>: Button position, width and height-->
<X>480</X>
<X>555</X>
<Y>0</Y>
<Z>0,00</Z>
<W>50</W>
@@ -365,14 +412,14 @@
</ButtonSing>
<TextCurrentSong>
<!--<X>, <Y>: Text position-->
<X>555</X>
<X>630</X>
<Y>0</Y>
<!--<Z>: Text position-->
<Z>0,00</Z>
<!--<H>: Text height-->
<H>50</H>
<!--<MaxW>: Maximum text width (if exists)-->
<MaxW>725</MaxW>
<MaxW>650</MaxW>
<!--<Color>: Text color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
+15 -4
View File
@@ -28,6 +28,7 @@ namespace Vocaluxe.Base
private static bool _BackgroundMusicAdded;
private static bool _Playing;
private static bool _VideoEnabled;
private static bool _VideoToBackground;
private static int _Video = -1;
private static STexture _CurrentVideoTexture = new STexture(-1);
@@ -314,7 +315,7 @@ namespace Vocaluxe.Base
LoadVideo();
}
public static bool UploadNewFrame(CStatic bounds)
public static STexture GetVideoTexture()
{
if (_Video != -1)
{
@@ -329,10 +330,9 @@ namespace Vocaluxe.Base
_CurrentVideoTexture.color.A = 1f;
_FadeTimer.Stop();
}
CDraw.DrawTexture(bounds, _CurrentVideoTexture, EAspect.Crop);
return true;
return _CurrentVideoTexture;
}
return false;
return new STexture(-1);
}
public static int GetSongNr()
@@ -350,6 +350,11 @@ namespace Vocaluxe.Base
return _VideoEnabled;
}
public static bool VideoToBackgroundIsEnabled()
{
return _VideoToBackground;
}
public static bool HasVideo()
{
return File.Exists(_CurrentPlaylistElement.GetVideoFilePath());
@@ -376,6 +381,12 @@ namespace Vocaluxe.Base
_FadeTimer.Start();
}
}
public static void ToggleVideoToBackground()
{
ToggleVideo();
_VideoToBackground = !_VideoToBackground;
}
}
}
+18
View File
@@ -140,6 +140,9 @@ namespace Vocaluxe.Menu
if (_Theme.Type == EBackgroundTypes.Video && CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON)
ok = DrawVideo();
if (_Theme.Type == EBackgroundTypes.Video && CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON && CBackgroundMusic.VideoToBackgroundIsEnabled() && CBackgroundMusic.IsPlaying() && CBackgroundMusic.HasVideo())
ok = DrawBackgroundMusicVideo();
if (_Theme.TextureName != String.Empty &&
(_Theme.Type == EBackgroundTypes.Texture ||
(_Theme.Type == EBackgroundTypes.Video && (CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_OFF || !ok))))
@@ -206,6 +209,21 @@ namespace Vocaluxe.Menu
}
return false;
}
private bool DrawBackgroundMusicVideo()
{
STexture VideoTexture = CBackgroundMusic.GetVideoTexture();
if (VideoTexture.height > 0)
{
RectangleF bounds = new RectangleF(0f, 0f, CSettings.iRenderW, CSettings.iRenderH);
RectangleF rect = new RectangleF(0f, 0f, VideoTexture.width, VideoTexture.height);
CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop);
CDraw.DrawTexture(VideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CSettings.zFar / 4));
return true;
}
return false;
}
#endregion internal
#region ThemeEdit
@@ -26,6 +26,7 @@ namespace Vocaluxe.Screens
private const string ButtonRepeat = "ButtonRepeat";
private const string ButtonShowVideo = "ButtonShowVideo";
private const string ButtonSing = "ButtonSing";
private const string ButtonToBackgroundVideo = "ButtonToBackgroundVideo";
private const string TextCurrentSong = "TextCurrentSong";
@@ -52,6 +53,7 @@ namespace Vocaluxe.Screens
buttons.Add(ButtonRepeat);
buttons.Add(ButtonShowVideo);
buttons.Add(ButtonSing);
buttons.Add(ButtonToBackgroundVideo);
_ThemeButtons = buttons.ToArray();
}
@@ -93,6 +95,8 @@ namespace Vocaluxe.Screens
CBackgroundMusic.ToggleVideo();
if (Buttons[htButtons(ButtonSing)].Selected)
StartSong(CBackgroundMusic.GetSongNr(), CBackgroundMusic.IsDuet());
if (Buttons[htButtons(ButtonToBackgroundVideo)].Selected)
CBackgroundMusic.ToggleVideoToBackground();
break;
}
}
@@ -119,6 +123,8 @@ namespace Vocaluxe.Screens
CBackgroundMusic.ToggleVideo();
if (Buttons[htButtons(ButtonSing)].Selected)
StartSong(CBackgroundMusic.GetSongNr(), CBackgroundMusic.IsDuet());
if (Buttons[htButtons(ButtonToBackgroundVideo)].Selected)
CBackgroundMusic.ToggleVideoToBackground();
} else if (MouseEvent.LB)
{
CGraphics.HidePopup(EPopupScreens.PopupPlayerControl);
@@ -149,8 +155,8 @@ namespace Vocaluxe.Screens
if (CBackgroundMusic.IsVideoEnabled() && CBackgroundMusic.HasVideo())
{
Statics[htStatics(StaticCover)].Texture = CBackgroundMusic.GetCover();
CBackgroundMusic.UploadNewFrame(Statics[htStatics(StaticCover)]);
Statics[htStatics(StaticCover)].Visible = false;
Statics[htStatics(StaticCover)].Visible = true;
CDraw.DrawTexture(Statics[htStatics(StaticCover)], CBackgroundMusic.GetVideoTexture(), EAspect.Crop);
}
else
{