Move non-drawing stuff out of Draw methods

This commit is contained in:
Flamefire committed 2014-10-19 18:37:16 +02:00
1 parent 432ff4f4f3
commit 4c7013836b
7 files changed
+21 -39

No files matched your search

-2
View File
@@ -1,8 +1,6 @@
using System.Diagnostics;
using Vocaluxe.Base.ThemeSystem;
using Vocaluxe.Lib.Video;
using VocaluxeLib;
using VocaluxeLib.Draw;
namespace Vocaluxe.Base
{
+5 -11
View File
@@ -178,25 +178,19 @@ namespace Vocaluxe.Screens
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;
_Buttons[_ButtonToBackgroundVideo].Pressed = _VideoBackground;
_Buttons[_ButtonShowVideo].Pressed = _VideoPreviewInt;
_Buttons[_ButtonRepeat].Pressed = CBackgroundMusic.RepeatSong;
_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[_ButtonPlay].Visible = !CBackgroundMusic.IsPlaying;
_Texts[_TextCurrentSong].Text = CBackgroundMusic.ArtistAndTitle;
return true;
}
private void _StartSong(int songNr)
-6
View File
@@ -101,12 +101,6 @@ namespace Vocaluxe.Screens
return true;
}
public override void Draw()
{
if (_Active)
base.Draw();
}
private void _GenerateQRs()
{
QRCodeGenerator qr = new QRCodeGenerator();
@@ -100,12 +100,6 @@ namespace Vocaluxe.Screens
return true;
}
public override void Draw()
{
if (_Active)
base.Draw();
}
private void _SaveConfig()
{
int volume = _SelectSlides[_SelectSlideVolume].Selection * 5;
+6 -7
View File
@@ -666,7 +666,12 @@ namespace Vocaluxe.Screens
public override bool UpdateGame()
{
if (_PlaylistActive)
_CheckPlaylist();
{
if (_Playlist.ActivePlaylistID == -1)
_ClosePlaylist();
else
_Playlist.UpdateGame();
}
_Texts[_TextCategory].Text = CSongs.GetCurrentCategoryName();
@@ -1255,12 +1260,6 @@ namespace Vocaluxe.Screens
}
#region Playlist Actions
private void _CheckPlaylist()
{
if (_Playlist.ActivePlaylistID == -1 && _PlaylistActive)
_ClosePlaylist();
}
private void _OpenPlaylist(int playlistID)
{
if (_Playlist.LoadPlaylist(playlistID))
+4 -2
View File
@@ -306,17 +306,19 @@ namespace VocaluxeLib.Menu
#region Drawing
public virtual void Draw()
{
if (!_Active)
return;
_DrawBG();
_DrawFG();
}
protected void _DrawBG()
private void _DrawBG()
{
foreach (CBackground bg in _Backgrounds)
bg.Draw();
}
protected void _DrawFG()
private void _DrawFG()
{
if (_Interactions.Count <= 0)
return;
+6 -5
View File
@@ -331,14 +331,10 @@ namespace VocaluxeLib.Menu
return _ThemeLoaded;
}
public override void Draw()
public void UpdateGame()
{
if (_PlaylistElements.Count <= 0)
LoadPlaylist(0);
if (!Visible && CBase.Settings.GetProgramState() != EProgramState.EditTheme)
return;
base.Draw();
for (int i = 0; i < _PlaylistElements.Count; i++)
{
if (i == _CurrentPlaylistElement && _Selected)
@@ -352,6 +348,11 @@ namespace VocaluxeLib.Menu
_PlaylistElements[i].Background.Color = _BackgroundColor;
}
}
}
public override void Draw()
{
base.Draw();
if (_ChangeOrderElement != null)
_ChangeOrderElement.Draw();