From 67d081d1c14dc951c1f29dec1a38c3821f9d8690 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Wed, 22 Oct 2014 13:47:26 +0200 Subject: [PATCH] Draw background like all other elements Few fixes --- Vocaluxe/Screens/CScreenSing.cs | 27 ++++------------------ VocaluxeLib/CFont.cs | 1 - VocaluxeLib/Menu/CBackground.cs | 34 ++++++++++++++++++++-------- VocaluxeLib/Menu/CInteraction.cs | 21 ----------------- VocaluxeLib/Menu/CMenuElementBase.cs | 2 +- 5 files changed, 29 insertions(+), 56 deletions(-) diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index 6fdd7e18..672842ea 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -149,9 +149,7 @@ namespace Vocaluxe.Screens _BuildStaticStrings(ref statics); _ThemeStatics = statics.ToArray(); - var buttons = new List {_ButtonCancel, _ButtonContinue, _ButtonSkip}; - _ThemeButtons = buttons.ToArray(); - + _ThemeButtons = new string[] {_ButtonCancel, _ButtonContinue, _ButtonSkip}; _ThemeLyrics = new string[] {_LyricMain, _LyricSub, _LyricMainDuet, _LyricSubDuet, _LyricMainTop, _LyricSubTop}; _ThemeSingNotes = new string[] {_SingBars}; @@ -161,23 +159,6 @@ namespace Vocaluxe.Screens _TimerDuetText2 = new Stopwatch(); } - public override void LoadTheme(string xmlPath) - { - base.LoadTheme(xmlPath); - - _Statics[_StaticTimeLine].Visible = false; - _Statics[_StaticTimeLineExpandedNormal].Visible = false; - _Statics[_StaticTimeLineExpandedHighlighted].Visible = false; - _Statics[_StaticPauseBG].Visible = false; - _Texts[_TextPause].Visible = false; - - _Statics[_StaticPauseBG].Visible = false; - _Texts[_TextPause].Visible = false; - - _Buttons[_ButtonCancel].Visible = false; - _Buttons[_ButtonContinue].Visible = false; - } - public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -189,13 +170,13 @@ namespace Vocaluxe.Screens case Keys.Escape: _TogglePause(); if (_Pause) - _SetInteractionToButton(_Buttons[_ButtonCancel]); + _SelectElement(_Buttons[_ButtonCancel]); break; case Keys.P: _TogglePause(); if (_Pause) - _SetInteractionToButton(_Buttons[_ButtonContinue]); + _SelectElement(_Buttons[_ButtonContinue]); break; case Keys.T: @@ -297,7 +278,7 @@ namespace Vocaluxe.Screens { _TogglePause(); if (_Pause) - _SetInteractionToButton(_Buttons[_ButtonContinue]); + _SelectElement(_Buttons[_ButtonContinue]); } if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent) && _Pause) diff --git a/VocaluxeLib/CFont.cs b/VocaluxeLib/CFont.cs index 6ac3f1bf..88982ee5 100644 --- a/VocaluxeLib/CFont.cs +++ b/VocaluxeLib/CFont.cs @@ -17,7 +17,6 @@ using System; using System.Collections.Generic; -using System.Xml.Serialization; namespace VocaluxeLib { diff --git a/VocaluxeLib/Menu/CBackground.cs b/VocaluxeLib/Menu/CBackground.cs index 3c50b104..68154e89 100644 --- a/VocaluxeLib/Menu/CBackground.cs +++ b/VocaluxeLib/Menu/CBackground.cs @@ -231,16 +231,30 @@ namespace VocaluxeLib.Menu #endregion public #region internal - private static SRectF _GetDrawRect() + public override float X { - SRectF rect = CBase.Settings.GetRenderRect(); - rect.Z = CBase.Settings.GetZFar() / 4; - return rect; + get { return 0; } + } + public override float Y + { + get { return 0; } + } + public override float Z + { + get { return CBase.Settings.GetZFar() / 4; } + } + public override float W + { + get { return CBase.Settings.GetRenderW(); } + } + public override float H + { + get { return CBase.Settings.GetRenderH(); } } private void _DrawColor() { - CBase.Drawing.DrawRect(Color, _GetDrawRect()); + CBase.Drawing.DrawRect(Color, Rect); } private bool _DrawTexture() @@ -248,7 +262,7 @@ namespace VocaluxeLib.Menu CTextureRef texture = CBase.Themes.GetSkinTexture(_Theme.Skin, _PartyModeID); if (texture != null) { - CBase.Drawing.DrawTexture(texture, _GetDrawRect(), EAspect.Crop); + CBase.Drawing.DrawTexture(texture, Rect, EAspect.Crop); return true; } return false; @@ -278,7 +292,7 @@ namespace VocaluxeLib.Menu if (texture == null) return false; - CBase.Drawing.DrawTexture(texture, _GetDrawRect(), EAspect.Crop); + CBase.Drawing.DrawTexture(texture, Rect, EAspect.Crop); if (_SlideShowTimer.ElapsedMilliseconds >= CBase.Settings.GetSlideShowImageTime()) { @@ -293,7 +307,7 @@ namespace VocaluxeLib.Menu { SColorF color = texture.Color; color.A = (_SlideShowTimer.ElapsedMilliseconds - CBase.Settings.GetSlideShowImageTime()) / CBase.Settings.GetSlideShowFadeTime(); - CBase.Drawing.DrawTexture(texture, _GetDrawRect(), EAspect.Crop, color); + CBase.Drawing.DrawTexture(texture, Rect, EAspect.Crop, color); } } @@ -307,7 +321,7 @@ namespace VocaluxeLib.Menu CBase.Video.GetFrame(_VideoStream, _VideoStream.VideoTime); if (_VideoStream.Texture != null) { - CBase.Drawing.DrawTexture(_VideoStream.Texture, _GetDrawRect(), EAspect.Crop); + CBase.Drawing.DrawTexture(_VideoStream.Texture, Rect, EAspect.Crop); return true; } return false; @@ -318,7 +332,7 @@ namespace VocaluxeLib.Menu CTextureRef videoTexture = CBase.BackgroundMusic.GetVideoTexture(); if (videoTexture != null) { - CBase.Drawing.DrawTexture(videoTexture, _GetDrawRect(), EAspect.Crop); + CBase.Drawing.DrawTexture(videoTexture, Rect, EAspect.Crop); return true; } return false; diff --git a/VocaluxeLib/Menu/CInteraction.cs b/VocaluxeLib/Menu/CInteraction.cs index ecbbc1f2..6b9414d0 100644 --- a/VocaluxeLib/Menu/CInteraction.cs +++ b/VocaluxeLib/Menu/CInteraction.cs @@ -38,27 +38,6 @@ namespace VocaluxeLib.Menu public readonly int Num; public readonly EType Type; - public bool ThemeEditorOnly - { - get - { - return Type == EType.Background || - Type == EType.NameSelection || - Type == EType.Text || - Type == EType.Static || - Type == EType.SongMenu || - Type == EType.Lyric || - Type == EType.SingNote || - Type == EType.Equalizer || - Type == EType.Playlist; - } - } - - public bool DrawAsForeground - { - get { return Type != EType.Background && Type != EType.SingNote; } - } - public CInteraction(int num, EType type) { Num = num; diff --git a/VocaluxeLib/Menu/CMenuElementBase.cs b/VocaluxeLib/Menu/CMenuElementBase.cs index d295d3cf..c0d567c2 100644 --- a/VocaluxeLib/Menu/CMenuElementBase.cs +++ b/VocaluxeLib/Menu/CMenuElementBase.cs @@ -33,7 +33,7 @@ namespace VocaluxeLib.Menu public virtual float Y { get; set; } public virtual float Z { get; set; } public virtual float W { get; set; } - public float H { get; set; } + public virtual float H { get; set; } public virtual SRectF MaxRect {