From 4c7013836bc564558f6cd9cc79e89fba3760eb78 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Sun, 19 Oct 2014 18:37:16 +0200 Subject: [PATCH] Move non-drawing stuff out of Draw methods --- Vocaluxe/Base/CVideoPlayer.cs | 2 -- Vocaluxe/Screens/CPopupScreenPlayerControl.cs | 16 +++++----------- Vocaluxe/Screens/CPopupScreenServerQR.cs | 6 ------ Vocaluxe/Screens/CPopupScreenVolumeControl.cs | 6 ------ Vocaluxe/Screens/CScreenSong.cs | 13 ++++++------- VocaluxeLib/Menu/CObjectInteractions.cs | 6 ++++-- VocaluxeLib/Menu/CPlaylist.cs | 11 ++++++----- 7 files changed, 21 insertions(+), 39 deletions(-) diff --git a/Vocaluxe/Base/CVideoPlayer.cs b/Vocaluxe/Base/CVideoPlayer.cs index 0790191f..48316638 100644 --- a/Vocaluxe/Base/CVideoPlayer.cs +++ b/Vocaluxe/Base/CVideoPlayer.cs @@ -1,8 +1,6 @@ using System.Diagnostics; using Vocaluxe.Base.ThemeSystem; -using Vocaluxe.Lib.Video; using VocaluxeLib; -using VocaluxeLib.Draw; namespace Vocaluxe.Base { diff --git a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs index 48c39a27..c67156dd 100644 --- a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs +++ b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs @@ -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) diff --git a/Vocaluxe/Screens/CPopupScreenServerQR.cs b/Vocaluxe/Screens/CPopupScreenServerQR.cs index a53f1752..fce4ed96 100644 --- a/Vocaluxe/Screens/CPopupScreenServerQR.cs +++ b/Vocaluxe/Screens/CPopupScreenServerQR.cs @@ -101,12 +101,6 @@ namespace Vocaluxe.Screens return true; } - public override void Draw() - { - if (_Active) - base.Draw(); - } - private void _GenerateQRs() { QRCodeGenerator qr = new QRCodeGenerator(); diff --git a/Vocaluxe/Screens/CPopupScreenVolumeControl.cs b/Vocaluxe/Screens/CPopupScreenVolumeControl.cs index a6f50630..2158d825 100644 --- a/Vocaluxe/Screens/CPopupScreenVolumeControl.cs +++ b/Vocaluxe/Screens/CPopupScreenVolumeControl.cs @@ -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; diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index 627362b0..2b11c721 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -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)) diff --git a/VocaluxeLib/Menu/CObjectInteractions.cs b/VocaluxeLib/Menu/CObjectInteractions.cs index 552fb20f..a09e4482 100644 --- a/VocaluxeLib/Menu/CObjectInteractions.cs +++ b/VocaluxeLib/Menu/CObjectInteractions.cs @@ -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; diff --git a/VocaluxeLib/Menu/CPlaylist.cs b/VocaluxeLib/Menu/CPlaylist.cs index 4aab03b8..a6df6bd8 100644 --- a/VocaluxeLib/Menu/CPlaylist.cs +++ b/VocaluxeLib/Menu/CPlaylist.cs @@ -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();