Added dynamic Glyph resizing

Show Program name on loading screen when videos disabled
This commit is contained in:
Flamefire committed 2013-05-02 00:32:24 +02:00
1 parent 9aafd6f82c
commit 507df651c0
5 files changed
+57 -39

No files matched your search

+31 -31
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<ScreenLoad> <ScreenLoad>
<ScreenVersion>1</ScreenVersion> <ScreenVersion>2</ScreenVersion>
<Background1> <Background1>
<!--<Type>: Background type: None, Color, Texture, Video--> <!--<Type>: Background type: None, Color, Texture, Video-->
<Type>Texture</Type> <Type>Texture</Type>
@@ -30,35 +30,6 @@
<!-- <Height>: Reflection Height--> <!-- <Height>: Reflection Height-->
</Static1> </Static1>
<Text1> <Text1>
<!--<X>, <Y>: Text position-->
<X>640</X>
<Y>300</Y>
<!--<Z>: Text position-->
<Z>0,00</Z>
<!--<H>: Text height-->
<H>120</H>
<!--<MaxW>: Maximum text width (if exists)-->
<!--<Color>: Text color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>Invisible</Color>
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>TextSColor</SColor>
<!--<Align>: Text align horizontal: Left, Center, Right-->
<Align>Center</Align>
<!--<HAlign>: Text align vertical (on downsizing): Top, Center, Bottom-->
<HAlign>Center</HAlign>
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
<Style>Bold</Style>
<!--<Font>: Text font name-->
<Font>Outline</Font>
<!--<Text>: Nothing or translation tag-->
<Text>TR_PROGRAM_NAME</Text>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</Text1>
<Text2>
<!--<X>, <Y>: Text position--> <!--<X>, <Y>: Text position-->
<X>60</X> <X>60</X>
<Y>653</Y> <Y>653</Y>
@@ -86,7 +57,36 @@
<!--<Reflection> If exists:--> <!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space--> <!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height--> <!-- <Height>: Reflection Height-->
</Text2> </Text1>
<TextProgramName>
<!--<X>, <Y>: Text position-->
<X>640</X>
<Y>300</Y>
<!--<Z>: Text position-->
<Z>0,00</Z>
<!--<H>: Text height-->
<H>120</H>
<!--<MaxW>: Maximum text width (if exists)-->
<!--<Color>: Text color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>TextSColor</SColor>
<!--<Align>: Text align horizontal: Left, Center, Right-->
<Align>Center</Align>
<!--<HAlign>: Text align vertical (on downsizing): Top, Center, Bottom-->
<HAlign>Center</HAlign>
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
<Style>Bold</Style>
<!--<Font>: Text font name-->
<Font>Outline</Font>
<!--<Text>: Nothing or translation tag-->
<Text>TR_PROGRAM_NAME</Text>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</TextProgramName>
<TextStatus> <TextStatus>
<!--<X>, <Y>: Text position--> <!--<X>, <Y>: Text position-->
<X>240</X> <X>240</X>
@@ -0,0 +1,7 @@
ScreenLoading
++++++++++
Version 2:
Rename:<Text1> -> <TextProgramName>
++++++++++
+7
View File
@@ -63,6 +63,7 @@ namespace Vocaluxe.Base.Fonts
_MaxGlyphHeight = 100f; _MaxGlyphHeight = 100f;
break; break;
} }
_MaxGlyphHeight = 50;
} }
public Font GetFont() public Font GetFont()
@@ -125,6 +126,12 @@ namespace Vocaluxe.Base.Fonts
glyph = new CGlyph(chr, _MaxGlyphHeight); glyph = new CGlyph(chr, _MaxGlyphHeight);
_Glyphs.Add(chr, glyph); _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; return glyph;
} }
+2
View File
@@ -32,6 +32,7 @@ namespace Vocaluxe.Base.Fonts
private STexture _Texture; private STexture _Texture;
private readonly SizeF _BoundingBox; private readonly SizeF _BoundingBox;
private readonly RectangleF _DrawBounding; private readonly RectangleF _DrawBounding;
public readonly float MaxHeight;
public float Width public float Width
{ {
@@ -45,6 +46,7 @@ namespace Vocaluxe.Base.Fonts
public CGlyph(char chr, float maxHeight) public CGlyph(char chr, float maxHeight)
{ {
MaxHeight = maxHeight;
float oldHeight = CFonts.Height; float oldHeight = CFonts.Height;
float outline = CFonts.Outline; float outline = CFonts.Outline;
float outlineSize = outline * maxHeight; float outlineSize = outline * maxHeight;
+10 -8
View File
@@ -30,10 +30,11 @@ namespace Vocaluxe.Screens
// Version number for theme files. Increment it, if you've changed something on the theme files! // Version number for theme files. Increment it, if you've changed something on the theme files!
protected override int _ScreenVersion protected override int _ScreenVersion
{ {
get { return 1; } get { return 2; }
} }
private const string _TextStatus = "TextStatus"; private const string _TextStatus = "TextStatus";
private const string _TextProgramName = "TextProgramName";
private readonly string[] _IntroVideo = new string[] {"IntroIn", "IntroMid", "IntroOut"}; private readonly string[] _IntroVideo = new string[] {"IntroIn", "IntroMid", "IntroOut"};
@@ -44,13 +45,13 @@ namespace Vocaluxe.Screens
private bool _IntroOutPlayed; private bool _IntroOutPlayed;
private CVideoPlayer[] _Intros; private CVideoPlayer[] _Intros;
private bool _BGMusicStartet; private bool _BGMusicStarted;
public override void Init() public override void Init()
{ {
base.Init(); base.Init();
_ThemeTexts = new string[] {_TextStatus}; _ThemeTexts = new string[] {_TextStatus, _TextProgramName};
_Intros = new CVideoPlayer[_IntroVideo.Length]; _Intros = new CVideoPlayer[_IntroVideo.Length];
for (int i = 0; i < _Intros.Length; i++) for (int i = 0; i < _Intros.Length; i++)
_Intros[i] = new CVideoPlayer(); _Intros[i] = new CVideoPlayer();
@@ -116,9 +117,10 @@ namespace Vocaluxe.Screens
{ {
for (int i = 0; i < _Intros.Length; i++) for (int i = 0; i < _Intros.Length; i++)
_Intros[i].Load(_IntroVideo[i]); _Intros[i].Load(_IntroVideo[i]);
_Texts[_TextProgramName].Visible = false;
} }
_BGMusicStartet = false; _BGMusicStarted = false;
} }
public override void OnShowFinish() public override void OnShowFinish()
@@ -137,14 +139,14 @@ namespace Vocaluxe.Screens
_Timer.Start(); _Timer.Start();
if (CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON && 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(); CBackgroundMusic.AddOwnMusic();
if (!CBackgroundMusic.IsPlaying) if (!CBackgroundMusic.IsPlaying)
CBackgroundMusic.Next(); CBackgroundMusic.Next();
_BGMusicStartet = true; _BGMusicStarted = true;
} }
CBackgroundMusic.CanSing = false; CBackgroundMusic.CanSing = false;
@@ -173,14 +175,14 @@ namespace Vocaluxe.Screens
CLanguage.Translate("TR_SCREENLOAD_LOADED") + ")"; CLanguage.Translate("TR_SCREENLOAD_LOADED") + ")";
if (CSongs.SongsLoaded && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON && 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(); CBackgroundMusic.AddOwnMusic();
if (!CBackgroundMusic.IsPlaying) if (!CBackgroundMusic.IsPlaying)
CBackgroundMusic.Next(); CBackgroundMusic.Next();
_BGMusicStartet = true; _BGMusicStarted = true;
} }
return true; return true;