Use new Draw method

This commit is contained in:
Stephan Sundermann committed 2012-03-05 19:38:51 +01:00
1 parent 88ae7d86c8
commit f64f7640e3
3 files changed
+26 -5

No files matched your search

+5 -3
View File
@@ -8,6 +8,7 @@ using System.Diagnostics;
using Vocaluxe.Lib.Song; using Vocaluxe.Lib.Song;
using Vocaluxe.Lib.Draw; using Vocaluxe.Lib.Draw;
using System.Drawing; using System.Drawing;
using Vocaluxe.Menu;
namespace Vocaluxe.Base namespace Vocaluxe.Base
{ {
@@ -307,15 +308,16 @@ namespace Vocaluxe.Base
LoadVideo(); LoadVideo();
} }
public static STexture UploadNewFrame() public static bool UploadNewFrame(CStatic bounds)
{ {
if (_Video != -1) if (_Video != -1)
{ {
float vtime = 0f; float vtime = 0f;
CVideo.VdGetFrame(_Video, ref _CurrentVideoTexture, CSound.GetPosition(_CurrentMusicStream), ref vtime); 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() public static int GetSongNr()
+13
View File
@@ -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) public static void DrawTextureReflection(STexture Texture, SRectF rect, SColorF color, SRectF bounds, float space, float height)
{ {
lock (mutex) lock (mutex)
@@ -136,10 +136,16 @@ namespace Vocaluxe.Screens
Buttons[htButtons(ButtonPause)].Visible = CBackgroundMusic.IsPlaying(); Buttons[htButtons(ButtonPause)].Visible = CBackgroundMusic.IsPlaying();
Buttons[htButtons(ButtonPlay)].Visible = !CBackgroundMusic.IsPlaying(); Buttons[htButtons(ButtonPlay)].Visible = !CBackgroundMusic.IsPlaying();
Texts[htTexts(TextCurrentSong)].Text = CBackgroundMusic.GetSongArtistAndTitle(); Texts[htTexts(TextCurrentSong)].Text = CBackgroundMusic.GetSongArtistAndTitle();
if(CBackgroundMusic.IsVideoEnabled() && CBackgroundMusic.HasVideo()) if (CBackgroundMusic.IsVideoEnabled() && CBackgroundMusic.HasVideo())
Statics[htStatics(StaticCover)].Texture = CBackgroundMusic.UploadNewFrame(); {
CBackgroundMusic.UploadNewFrame(Statics[htStatics(StaticCover)]);
Statics[htStatics(StaticCover)].Visible = true;
}
else else
{
Statics[htStatics(StaticCover)].Visible = true;
Statics[htStatics(StaticCover)].Texture = CBackgroundMusic.GetCover(); Statics[htStatics(StaticCover)].Texture = CBackgroundMusic.GetCover();
}
return true; return true;
} }