From 579588c43487cc127526e8c9e5b38426a208da96 Mon Sep 17 00:00:00 2001 From: Stephan Sundermann Date: Sat, 8 Dec 2012 00:20:03 +0100 Subject: [PATCH 1/3] CStatic holds now its aspect ratio Avatars are not stretched in singscreen anymore --- Vocaluxe/Menu/CStatic.cs | 16 +++++++++------- Vocaluxe/Menu/SongMenu/CSongMenuTileBoard.cs | 10 +++++----- Vocaluxe/Screens/CScreenSing.cs | 6 ++++++ 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/Vocaluxe/Menu/CStatic.cs b/Vocaluxe/Menu/CStatic.cs index d9cddad7..02c695d4 100644 --- a/Vocaluxe/Menu/CStatic.cs +++ b/Vocaluxe/Menu/CStatic.cs @@ -53,6 +53,8 @@ namespace Vocaluxe.Menu public float Alpha; + public EAspect Aspect = EAspect.Stretch; + public CStatic() { _Theme = new SThemeStatic(); @@ -213,25 +215,25 @@ namespace Vocaluxe.Menu public void Draw() { - Draw(1f, Rect.Z, false, false); + Draw(1f, Rect.Z, Aspect, false); } - public void Draw(bool aspect) + public void Draw(EAspect aspect) { Draw(1f, Rect.Z, aspect, false); } - public void Draw(float scale, bool aspect) + public void Draw(float scale, EAspect aspect) { Draw(scale, Rect.Z, aspect, false); } public void ForceDraw() { - Draw(1f, Rect.Z, false, true); + Draw(1f, Rect.Z, Aspect, true); } - public void Draw(float scale, float z, bool aspect, bool ForceDraw) + public void Draw(float scale, float z, EAspect aspect, bool ForceDraw) { STexture texture; if (_Texture.index != -1) @@ -248,11 +250,11 @@ namespace Vocaluxe.Menu SRectF rect = bounds; - if (aspect) + if (aspect != EAspect.Stretch) { RectangleF bounds2 = new RectangleF(bounds.X, bounds.Y, bounds.W, bounds.H); RectangleF rect2 = new RectangleF(0f, 0f, texture.width, texture.height); - CHelper.SetRect(bounds2, ref rect2, texture.width / texture.height, EAspect.Crop); + CHelper.SetRect(bounds2, ref rect2, texture.width / texture.height, aspect); rect.X = rect2.X; rect.Y = rect2.Y; diff --git a/Vocaluxe/Menu/SongMenu/CSongMenuTileBoard.cs b/Vocaluxe/Menu/SongMenu/CSongMenuTileBoard.cs index 4d9336e1..b3e9bc2c 100644 --- a/Vocaluxe/Menu/SongMenu/CSongMenuTileBoard.cs +++ b/Vocaluxe/Menu/SongMenu/CSongMenuTileBoard.cs @@ -408,13 +408,13 @@ namespace Vocaluxe.Menu.SongMenu foreach (CStatic tile in _Tiles) { if (tile.Selected && _Active) - tile.Draw(1.2f, tile.Rect.Z - 0.1f, true, false); + tile.Draw(1.2f, tile.Rect.Z - 0.1f, EAspect.Crop, false); else { if (tile.Texture.index != _CoverTexture.index) - tile.Draw(1f, tile.Rect.Z, true, false); + tile.Draw(1f, tile.Rect.Z, EAspect.Crop, false); else - tile.Draw(1f, tile.Rect.Z, false, false); + tile.Draw(1f, tile.Rect.Z, EAspect.Stretch, false); } } @@ -465,9 +465,9 @@ namespace Vocaluxe.Menu.SongMenu } } - _CoverBig.Draw(1f, true); + _CoverBig.Draw(1f, EAspect.Crop); if (_vidtex.color.A < 1) - _CoverBig.Draw(1f, true); + _CoverBig.Draw(1f, EAspect.Crop); _TextBG.Draw(); if (_vidtex.index != -1 && _Video != -1) diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index 5b3b96c7..e1186a18 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -149,6 +149,7 @@ namespace Vocaluxe.Screens public override void LoadTheme() { base.LoadTheme(); + Statics[htStatics(StaticTimeLine)].Visible = false; Statics[htStatics(StaticTimeLineExpandedNormal)].Visible = false; Statics[htStatics(StaticTimeLineExpandedHighlighted)].Visible = false; @@ -413,6 +414,11 @@ namespace Vocaluxe.Screens { Lyrics[i].LyricStyle = CConfig.LyricStyle; } + + for (int p = 0; p < CGame.NumPlayer; p++) + { + Statics[htStatics(StaticAvatars[p, CGame.NumPlayer - 1])].Aspect = EAspect.Crop; + } SetVisuability(); UpdateAvatars(); From 274ee2bffaf485f17713801148f26026f78bed12 Mon Sep 17 00:00:00 2001 From: Stephan Sundermann Date: Sat, 8 Dec 2012 00:36:17 +0100 Subject: [PATCH 2/3] Backgroundmusic can now be controlled by media keys --- Vocaluxe/Menu/CMenu.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Vocaluxe/Menu/CMenu.cs b/Vocaluxe/Menu/CMenu.cs index 267e69ea..8d5f3ea8 100644 --- a/Vocaluxe/Menu/CMenu.cs +++ b/Vocaluxe/Menu/CMenu.cs @@ -928,6 +928,18 @@ namespace Vocaluxe.Menu CConfig.BackgroundMusicVolume = 0; CConfig.SaveConfig(); } + else if (KeyEvent.Key == Keys.MediaNextTrack) + CBackgroundMusic.Next(); + else if (KeyEvent.Key == Keys.MediaPreviousTrack) + CBackgroundMusic.Previous(); + else if (KeyEvent.Key == Keys.MediaPlayPause) + { + if (CBackgroundMusic.Playing) + CBackgroundMusic.Pause(); + else + CBackgroundMusic.Play(); + } + CBackgroundMusic.ApplyVolume(); } From 06c3ed6cc74137429d8e1be6604f5d271cd416f9 Mon Sep 17 00:00:00 2001 From: Alexander Eckart Date: Sun, 9 Dec 2012 12:56:40 +0100 Subject: [PATCH 3/3] unload theme fonts on theme change --- Vocaluxe/Base/CFont.cs | 35 +++++++++++++++++++++++++ Vocaluxe/Screens/CScreenOptionsTheme.cs | 2 ++ 2 files changed, 37 insertions(+) diff --git a/Vocaluxe/Base/CFont.cs b/Vocaluxe/Base/CFont.cs index 1349f672..0c3fa048 100644 --- a/Vocaluxe/Base/CFont.cs +++ b/Vocaluxe/Base/CFont.cs @@ -123,6 +123,11 @@ namespace Vocaluxe.Base fo.Dispose(); } + public void UnloadTexture() + { + CDraw.RemoveTexture(ref Texture); + } + private float GetFactor(char chr, TextFormatFlags flags) { if (CFonts.Style == EStyle.Normal) @@ -277,6 +282,15 @@ namespace Vocaluxe.Base _htGlyphs.Add(chr, _Glyphs.Count - 1); CFonts.Height = h; } + + public void UnloadAllGlyphs() + { + foreach (CGlyph glyph in _Glyphs) + { + glyph.UnloadTexture(); + } + _Glyphs.Clear(); + } } struct SFont @@ -854,6 +868,27 @@ namespace Vocaluxe.Base writer.WriteEndElement(); } + public static void UnloadThemeFonts(string ThemeName) + { + if (_Fonts.Count == 0) + return; + + int Index = 0; + while (Index < _Fonts.Count) + { + if (_Fonts[Index].IsThemeFont && _Fonts[Index].ThemeName == ThemeName) + { + _Fonts[Index].Normal.UnloadAllGlyphs(); + _Fonts[Index].Italic.UnloadAllGlyphs(); + _Fonts[Index].Bold.UnloadAllGlyphs(); + _Fonts[Index].BoldItalic.UnloadAllGlyphs(); + _Fonts.RemoveAt(Index); + } + else + Index++; + } + } + private static int GetFontIndex(string ThemeName, string FontName) { if (ThemeName == String.Empty || FontName == String.Empty) diff --git a/Vocaluxe/Screens/CScreenOptionsTheme.cs b/Vocaluxe/Screens/CScreenOptionsTheme.cs index 8f7369dc..7250b268 100644 --- a/Vocaluxe/Screens/CScreenOptionsTheme.cs +++ b/Vocaluxe/Screens/CScreenOptionsTheme.cs @@ -183,6 +183,7 @@ namespace Vocaluxe.Screens _OldTheme = SelectSlides[htSelectSlides(SelectSlideTheme)].Selection; CTheme.UnloadSkins(); + CFonts.UnloadThemeFonts(CConfig.Theme); CTheme.ListSkins(); CConfig.Skin = CTheme.SkinNames[0]; _OldSkin = 0; @@ -205,6 +206,7 @@ namespace Vocaluxe.Screens _OldTheme = SelectSlides[htSelectSlides(SelectSlideTheme)].Selection; CTheme.UnloadSkins(); + CFonts.UnloadThemeFonts(CConfig.Theme); CTheme.ListSkins(); CConfig.Skin = CTheme.SkinNames[0]; _OldSkin = 0;