Use new Draw method
This commit is contained in:
1 parent
88ae7d86c8
commit
f64f7640e3
3 files changed
+26
-5
No files matched your search
@@ -8,6 +8,7 @@ using System.Diagnostics;
|
||||
using Vocaluxe.Lib.Song;
|
||||
using Vocaluxe.Lib.Draw;
|
||||
using System.Drawing;
|
||||
using Vocaluxe.Menu;
|
||||
|
||||
namespace Vocaluxe.Base
|
||||
{
|
||||
@@ -307,15 +308,16 @@ namespace Vocaluxe.Base
|
||||
LoadVideo();
|
||||
}
|
||||
|
||||
public static STexture UploadNewFrame()
|
||||
public static bool UploadNewFrame(CStatic bounds)
|
||||
{
|
||||
if (_Video != -1)
|
||||
{
|
||||
float vtime = 0f;
|
||||
CVideo.VdGetFrame(_Video, ref _CurrentVideoTexture, CSound.GetPosition(_CurrentMusicStream), ref vtime);
|
||||
return _CurrentVideoTexture;
|
||||
CDraw.DrawTexture(bounds, _CurrentVideoTexture, EAspect.Crop);
|
||||
return true;
|
||||
}
|
||||
return _CurrentVideoTexture;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int GetSongNr()
|
||||
|
||||
@@ -289,6 +289,19 @@ namespace Vocaluxe.Base
|
||||
}
|
||||
}
|
||||
|
||||
public static void DrawTexture(CStatic StaticBounds, STexture Texture, EAspect Aspect)
|
||||
{
|
||||
RectangleF bounds = new RectangleF(StaticBounds.Rect.X, StaticBounds.Rect.Y, StaticBounds.Rect.W, StaticBounds.Rect.H);
|
||||
RectangleF rect = new RectangleF(0f, 0f, Texture.width, Texture.height);
|
||||
|
||||
if (rect.Height <= 0f)
|
||||
return;
|
||||
|
||||
CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, Aspect);
|
||||
DrawTexture(Texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, StaticBounds.Rect.Z),
|
||||
Texture.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false);
|
||||
}
|
||||
|
||||
public static void DrawTextureReflection(STexture Texture, SRectF rect, SColorF color, SRectF bounds, float space, float height)
|
||||
{
|
||||
lock (mutex)
|
||||
|
||||
@@ -136,10 +136,16 @@ namespace Vocaluxe.Screens
|
||||
Buttons[htButtons(ButtonPause)].Visible = CBackgroundMusic.IsPlaying();
|
||||
Buttons[htButtons(ButtonPlay)].Visible = !CBackgroundMusic.IsPlaying();
|
||||
Texts[htTexts(TextCurrentSong)].Text = CBackgroundMusic.GetSongArtistAndTitle();
|
||||
if(CBackgroundMusic.IsVideoEnabled() && CBackgroundMusic.HasVideo())
|
||||
Statics[htStatics(StaticCover)].Texture = CBackgroundMusic.UploadNewFrame();
|
||||
if (CBackgroundMusic.IsVideoEnabled() && CBackgroundMusic.HasVideo())
|
||||
{
|
||||
CBackgroundMusic.UploadNewFrame(Statics[htStatics(StaticCover)]);
|
||||
Statics[htStatics(StaticCover)].Visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Statics[htStatics(StaticCover)].Visible = true;
|
||||
Statics[htStatics(StaticCover)].Texture = CBackgroundMusic.GetCover();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user