From 507df651c08dba298129b2ba2fa2a86e133bb1a7 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Thu, 2 May 2013 00:32:24 +0200 Subject: [PATCH] Added dynamic Glyph resizing Show Program name on loading screen when videos disabled --- Output/Themes/Ambient/Screens/ScreenLoad.xml | 62 +++++++++---------- .../Changelog/Changelog_ScreenLoading.txt | 7 +++ Vocaluxe/Base/Fonts/CFont.cs | 7 +++ Vocaluxe/Base/Fonts/CGlyph.cs | 2 + Vocaluxe/Screens/CScreenLoad.cs | 18 +++--- 5 files changed, 57 insertions(+), 39 deletions(-) create mode 100644 Output/Themes/Changelog/Changelog_ScreenLoading.txt diff --git a/Output/Themes/Ambient/Screens/ScreenLoad.xml b/Output/Themes/Ambient/Screens/ScreenLoad.xml index 6f78787d..3c7de4b7 100644 --- a/Output/Themes/Ambient/Screens/ScreenLoad.xml +++ b/Output/Themes/Ambient/Screens/ScreenLoad.xml @@ -1,7 +1,7 @@  - 1 + 2 Texture @@ -30,35 +30,6 @@ - - 640 - 300 - - 0,00 - - 120 - - - - Invisible - - - TextSColor - - Center - - Center - - - - Outline - - TR_PROGRAM_NAME - - - - - 60 653 @@ -86,7 +57,36 @@ - + + + + 640 + 300 + + 0,00 + + 120 + + + + StaticColor + + + TextSColor + + Center + + Center + + + + Outline + + TR_PROGRAM_NAME + + + + 240 diff --git a/Output/Themes/Changelog/Changelog_ScreenLoading.txt b/Output/Themes/Changelog/Changelog_ScreenLoading.txt new file mode 100644 index 00000000..0bca1ed6 --- /dev/null +++ b/Output/Themes/Changelog/Changelog_ScreenLoading.txt @@ -0,0 +1,7 @@ +ScreenLoading + +++++++++++ +Version 2: + +Rename: -> +++++++++++ \ No newline at end of file diff --git a/Vocaluxe/Base/Fonts/CFont.cs b/Vocaluxe/Base/Fonts/CFont.cs index 0c5e57cf..5ac016df 100644 --- a/Vocaluxe/Base/Fonts/CFont.cs +++ b/Vocaluxe/Base/Fonts/CFont.cs @@ -63,6 +63,7 @@ namespace Vocaluxe.Base.Fonts _MaxGlyphHeight = 100f; break; } + _MaxGlyphHeight = 50; } public Font GetFont() @@ -125,6 +126,12 @@ namespace Vocaluxe.Base.Fonts glyph = new CGlyph(chr, _MaxGlyphHeight); _Glyphs.Add(chr, glyph); } + if (glyph.MaxHeight + 50 < CFonts.Height) + { + glyph.UnloadTexture(); + glyph = new CGlyph(chr, (float)Math.Round(CFonts.Height / 50) * 50); + _Glyphs[chr] = glyph; + } return glyph; } diff --git a/Vocaluxe/Base/Fonts/CGlyph.cs b/Vocaluxe/Base/Fonts/CGlyph.cs index a24551fa..2feee41a 100644 --- a/Vocaluxe/Base/Fonts/CGlyph.cs +++ b/Vocaluxe/Base/Fonts/CGlyph.cs @@ -32,6 +32,7 @@ namespace Vocaluxe.Base.Fonts private STexture _Texture; private readonly SizeF _BoundingBox; private readonly RectangleF _DrawBounding; + public readonly float MaxHeight; public float Width { @@ -45,6 +46,7 @@ namespace Vocaluxe.Base.Fonts public CGlyph(char chr, float maxHeight) { + MaxHeight = maxHeight; float oldHeight = CFonts.Height; float outline = CFonts.Outline; float outlineSize = outline * maxHeight; diff --git a/Vocaluxe/Screens/CScreenLoad.cs b/Vocaluxe/Screens/CScreenLoad.cs index 1f25f6d1..2304a428 100644 --- a/Vocaluxe/Screens/CScreenLoad.cs +++ b/Vocaluxe/Screens/CScreenLoad.cs @@ -30,10 +30,11 @@ namespace Vocaluxe.Screens // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion { - get { return 1; } + get { return 2; } } private const string _TextStatus = "TextStatus"; + private const string _TextProgramName = "TextProgramName"; private readonly string[] _IntroVideo = new string[] {"IntroIn", "IntroMid", "IntroOut"}; @@ -44,13 +45,13 @@ namespace Vocaluxe.Screens private bool _IntroOutPlayed; private CVideoPlayer[] _Intros; - private bool _BGMusicStartet; + private bool _BGMusicStarted; public override void Init() { base.Init(); - _ThemeTexts = new string[] {_TextStatus}; + _ThemeTexts = new string[] {_TextStatus, _TextProgramName}; _Intros = new CVideoPlayer[_IntroVideo.Length]; for (int i = 0; i < _Intros.Length; i++) _Intros[i] = new CVideoPlayer(); @@ -116,9 +117,10 @@ namespace Vocaluxe.Screens { for (int i = 0; i < _Intros.Length; i++) _Intros[i].Load(_IntroVideo[i]); + _Texts[_TextProgramName].Visible = false; } - _BGMusicStartet = false; + _BGMusicStarted = false; } public override void OnShowFinish() @@ -137,14 +139,14 @@ namespace Vocaluxe.Screens _Timer.Start(); if (CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON && - CConfig.BackgroundMusicSource == EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC && !_BGMusicStartet) + CConfig.BackgroundMusicSource == EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC && !_BGMusicStarted) { CBackgroundMusic.AddOwnMusic(); if (!CBackgroundMusic.IsPlaying) CBackgroundMusic.Next(); - _BGMusicStartet = true; + _BGMusicStarted = true; } CBackgroundMusic.CanSing = false; @@ -173,14 +175,14 @@ namespace Vocaluxe.Screens CLanguage.Translate("TR_SCREENLOAD_LOADED") + ")"; if (CSongs.SongsLoaded && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON && - CConfig.BackgroundMusicSource != EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC && !_BGMusicStartet) + CConfig.BackgroundMusicSource != EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC && !_BGMusicStarted) { CBackgroundMusic.AddOwnMusic(); if (!CBackgroundMusic.IsPlaying) CBackgroundMusic.Next(); - _BGMusicStartet = true; + _BGMusicStarted = true; } return true;