Move non-drawing stuff out of Draw methods
This commit is contained in:
1 parent
432ff4f4f3
commit
4c7013836b
7 files changed
+21
-39
No files matched your search
@@ -1,8 +1,6 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Vocaluxe.Base.ThemeSystem;
|
using Vocaluxe.Base.ThemeSystem;
|
||||||
using Vocaluxe.Lib.Video;
|
|
||||||
using VocaluxeLib;
|
using VocaluxeLib;
|
||||||
using VocaluxeLib.Draw;
|
|
||||||
|
|
||||||
namespace Vocaluxe.Base
|
namespace Vocaluxe.Base
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -178,25 +178,19 @@ namespace Vocaluxe.Screens
|
|||||||
|
|
||||||
public override bool UpdateGame()
|
public override bool UpdateGame()
|
||||||
{
|
{
|
||||||
|
if (CBackgroundMusic.VideoEnabled && _VideoPreview && CBackgroundMusic.SongHasVideo)
|
||||||
|
_Statics[_StaticCover].Texture = CBackgroundMusic.GetVideoTexture();
|
||||||
|
else
|
||||||
|
_Statics[_StaticCover].Texture = CBackgroundMusic.Cover;
|
||||||
_Statics[_StaticCover].Visible = !_VideoPreviewInt || !CBackgroundMusic.SongHasVideo;
|
_Statics[_StaticCover].Visible = !_VideoPreviewInt || !CBackgroundMusic.SongHasVideo;
|
||||||
_Buttons[_ButtonToBackgroundVideo].Pressed = _VideoBackground;
|
_Buttons[_ButtonToBackgroundVideo].Pressed = _VideoBackground;
|
||||||
_Buttons[_ButtonShowVideo].Pressed = _VideoPreviewInt;
|
_Buttons[_ButtonShowVideo].Pressed = _VideoPreviewInt;
|
||||||
_Buttons[_ButtonRepeat].Pressed = CBackgroundMusic.RepeatSong;
|
_Buttons[_ButtonRepeat].Pressed = CBackgroundMusic.RepeatSong;
|
||||||
_Buttons[_ButtonSing].Visible = CBackgroundMusic.CanSing && CParty.CurrentPartyModeID == -1;
|
_Buttons[_ButtonSing].Visible = CBackgroundMusic.CanSing && CParty.CurrentPartyModeID == -1;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Draw()
|
|
||||||
{
|
|
||||||
if (!_Active)
|
|
||||||
return;
|
|
||||||
base.Draw();
|
|
||||||
_Statics[_StaticCover].Texture = CBackgroundMusic.Cover;
|
|
||||||
if (CBackgroundMusic.VideoEnabled && _VideoPreview && CBackgroundMusic.SongHasVideo)
|
|
||||||
CDraw.DrawTexture(CBackgroundMusic.GetVideoTexture(), _Statics[_StaticCover].Rect, EAspect.Crop);
|
|
||||||
_Buttons[_ButtonPause].Visible = CBackgroundMusic.IsPlaying;
|
_Buttons[_ButtonPause].Visible = CBackgroundMusic.IsPlaying;
|
||||||
_Buttons[_ButtonPlay].Visible = !CBackgroundMusic.IsPlaying;
|
_Buttons[_ButtonPlay].Visible = !CBackgroundMusic.IsPlaying;
|
||||||
_Texts[_TextCurrentSong].Text = CBackgroundMusic.ArtistAndTitle;
|
_Texts[_TextCurrentSong].Text = CBackgroundMusic.ArtistAndTitle;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _StartSong(int songNr)
|
private void _StartSong(int songNr)
|
||||||
|
|||||||
@@ -101,12 +101,6 @@ namespace Vocaluxe.Screens
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Draw()
|
|
||||||
{
|
|
||||||
if (_Active)
|
|
||||||
base.Draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void _GenerateQRs()
|
private void _GenerateQRs()
|
||||||
{
|
{
|
||||||
QRCodeGenerator qr = new QRCodeGenerator();
|
QRCodeGenerator qr = new QRCodeGenerator();
|
||||||
|
|||||||
@@ -100,12 +100,6 @@ namespace Vocaluxe.Screens
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Draw()
|
|
||||||
{
|
|
||||||
if (_Active)
|
|
||||||
base.Draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void _SaveConfig()
|
private void _SaveConfig()
|
||||||
{
|
{
|
||||||
int volume = _SelectSlides[_SelectSlideVolume].Selection * 5;
|
int volume = _SelectSlides[_SelectSlideVolume].Selection * 5;
|
||||||
|
|||||||
@@ -666,7 +666,12 @@ namespace Vocaluxe.Screens
|
|||||||
public override bool UpdateGame()
|
public override bool UpdateGame()
|
||||||
{
|
{
|
||||||
if (_PlaylistActive)
|
if (_PlaylistActive)
|
||||||
_CheckPlaylist();
|
{
|
||||||
|
if (_Playlist.ActivePlaylistID == -1)
|
||||||
|
_ClosePlaylist();
|
||||||
|
else
|
||||||
|
_Playlist.UpdateGame();
|
||||||
|
}
|
||||||
|
|
||||||
_Texts[_TextCategory].Text = CSongs.GetCurrentCategoryName();
|
_Texts[_TextCategory].Text = CSongs.GetCurrentCategoryName();
|
||||||
|
|
||||||
@@ -1255,12 +1260,6 @@ namespace Vocaluxe.Screens
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region Playlist Actions
|
#region Playlist Actions
|
||||||
private void _CheckPlaylist()
|
|
||||||
{
|
|
||||||
if (_Playlist.ActivePlaylistID == -1 && _PlaylistActive)
|
|
||||||
_ClosePlaylist();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void _OpenPlaylist(int playlistID)
|
private void _OpenPlaylist(int playlistID)
|
||||||
{
|
{
|
||||||
if (_Playlist.LoadPlaylist(playlistID))
|
if (_Playlist.LoadPlaylist(playlistID))
|
||||||
|
|||||||
@@ -306,17 +306,19 @@ namespace VocaluxeLib.Menu
|
|||||||
#region Drawing
|
#region Drawing
|
||||||
public virtual void Draw()
|
public virtual void Draw()
|
||||||
{
|
{
|
||||||
|
if (!_Active)
|
||||||
|
return;
|
||||||
_DrawBG();
|
_DrawBG();
|
||||||
_DrawFG();
|
_DrawFG();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void _DrawBG()
|
private void _DrawBG()
|
||||||
{
|
{
|
||||||
foreach (CBackground bg in _Backgrounds)
|
foreach (CBackground bg in _Backgrounds)
|
||||||
bg.Draw();
|
bg.Draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void _DrawFG()
|
private void _DrawFG()
|
||||||
{
|
{
|
||||||
if (_Interactions.Count <= 0)
|
if (_Interactions.Count <= 0)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -331,14 +331,10 @@ namespace VocaluxeLib.Menu
|
|||||||
return _ThemeLoaded;
|
return _ThemeLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Draw()
|
public void UpdateGame()
|
||||||
{
|
{
|
||||||
if (_PlaylistElements.Count <= 0)
|
if (_PlaylistElements.Count <= 0)
|
||||||
LoadPlaylist(0);
|
LoadPlaylist(0);
|
||||||
if (!Visible && CBase.Settings.GetProgramState() != EProgramState.EditTheme)
|
|
||||||
return;
|
|
||||||
|
|
||||||
base.Draw();
|
|
||||||
for (int i = 0; i < _PlaylistElements.Count; i++)
|
for (int i = 0; i < _PlaylistElements.Count; i++)
|
||||||
{
|
{
|
||||||
if (i == _CurrentPlaylistElement && _Selected)
|
if (i == _CurrentPlaylistElement && _Selected)
|
||||||
@@ -352,6 +348,11 @@ namespace VocaluxeLib.Menu
|
|||||||
_PlaylistElements[i].Background.Color = _BackgroundColor;
|
_PlaylistElements[i].Background.Color = _BackgroundColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Draw()
|
||||||
|
{
|
||||||
|
base.Draw();
|
||||||
|
|
||||||
if (_ChangeOrderElement != null)
|
if (_ChangeOrderElement != null)
|
||||||
_ChangeOrderElement.Draw();
|
_ChangeOrderElement.Draw();
|
||||||
|
|||||||
Reference in new issue
Block a user