Introduce RenderRect for easy access to the full screen rect
This commit is contained in:
1 parent
25653ee55f
commit
19f81943d6
11 files changed
+48
-56
No files matched your search
@@ -174,6 +174,11 @@ namespace Vocaluxe.Base
|
||||
return CSettings.RenderH;
|
||||
}
|
||||
|
||||
public SRectF GetRenderRect()
|
||||
{
|
||||
return CSettings.RenderRect;
|
||||
}
|
||||
|
||||
public bool IsTabNavigation()
|
||||
{
|
||||
return CSettings.TabNavigation;
|
||||
@@ -438,9 +443,9 @@ namespace Vocaluxe.Base
|
||||
CDraw.DrawTexture(textureRef, bounds, aspect, color);
|
||||
}
|
||||
|
||||
public void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, float reflectionSpace, float reflectionHeight)
|
||||
public void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, float reflectionSpace, float reflectionHeight)
|
||||
{
|
||||
CDraw.DrawTextureReflection(texture, rect, color, reflectionSpace, reflectionHeight);
|
||||
CDraw.DrawTextureReflection(texture, rect, color, bounds, reflectionSpace, reflectionHeight);
|
||||
}
|
||||
|
||||
public CTextureRef AddTexture(string fileName)
|
||||
|
||||
@@ -65,6 +65,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
public const int RenderW = 1280;
|
||||
public const int RenderH = 720;
|
||||
public static readonly SRectF RenderRect = new SRectF(0, 0, RenderW, RenderH, 0);
|
||||
|
||||
public const int ZNear = -100;
|
||||
public const int ZFar = 100;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using VocaluxeLib;
|
||||
using VocaluxeLib.Draw;
|
||||
|
||||
@@ -63,7 +62,7 @@ namespace Vocaluxe.Base
|
||||
if (_VideoTexture == null)
|
||||
return;
|
||||
|
||||
CDraw.DrawTexture(_VideoTexture, new SRectF(0, 0, CSettings.RenderW, CSettings.RenderH, CSettings.ZFar / 4), EAspect.Crop);
|
||||
CDraw.DrawTexture(_VideoTexture, CSettings.RenderRect, EAspect.Crop);
|
||||
}
|
||||
|
||||
public void PreLoad()
|
||||
|
||||
@@ -142,6 +142,8 @@ namespace Vocaluxe.Screens
|
||||
private CTextureRef _TexNamePantero;
|
||||
private CTextureRef _TexNamePinky007;
|
||||
|
||||
private static SColorF _BGColor = new SColorF(0, 0.18f, 0.474f, 1);
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
@@ -360,7 +362,7 @@ namespace Vocaluxe.Screens
|
||||
base.Draw();
|
||||
|
||||
//Draw background
|
||||
CDraw.DrawRect(new SColorF(0, 0.18f, 0.474f, 1), new SRectF(0, 0, CSettings.RenderW, CSettings.RenderH, 0));
|
||||
CDraw.DrawRect(_BGColor, CSettings.RenderRect);
|
||||
|
||||
//Draw stars
|
||||
_StarsBlue.Draw();
|
||||
|
||||
@@ -478,8 +478,9 @@ namespace Vocaluxe.Screens
|
||||
background = _Background;
|
||||
if (background != null)
|
||||
{
|
||||
var bounds = new SRectF(0, 0, CSettings.RenderW, CSettings.RenderH, 0);
|
||||
CDraw.DrawTexture(background, bounds, aspect, background.Color);
|
||||
SRectF bounds = CSettings.RenderRect;
|
||||
SRectF rect = CHelper.FitInBounds(bounds, background.OrigAspect, aspect);
|
||||
CDraw.DrawTexture(background, rect, background.Color, bounds);
|
||||
}
|
||||
else if (_SlideShow != null)
|
||||
_SlideShow.Draw();
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace VocaluxeLib
|
||||
/// <param name="bounds">Bounds to fit the rect in</param>
|
||||
/// <param name="aspectRatio">The original aspectRatio of the rect/image/...</param>
|
||||
/// <param name="aspect">
|
||||
/// Crop: Fit fully in bounds cutting off overhanging parts (same on both sides)<br />
|
||||
/// Crop: No empty space in bounds but has overhanging parts (same on both sides)<br />
|
||||
/// LetterBox: Fit the long side possibly leaving some space on the other (rect will be centered)<br />
|
||||
/// StretcH: Just fit the rect in the bounds (rect=bounds)
|
||||
/// </param>
|
||||
|
||||
@@ -70,6 +70,7 @@ namespace VocaluxeLib
|
||||
{
|
||||
int GetRenderW();
|
||||
int GetRenderH();
|
||||
SRectF GetRenderRect();
|
||||
bool IsTabNavigation();
|
||||
|
||||
float GetZFar();
|
||||
@@ -147,7 +148,7 @@ namespace VocaluxeLib
|
||||
void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false);
|
||||
void DrawTexture(CTextureRef textureRef, SRectF bounds, EAspect aspect);
|
||||
void DrawTexture(CTextureRef textureRef, SRectF bounds, EAspect aspect, SColorF color);
|
||||
void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, float reflectionSpace, float reflectionHeight);
|
||||
void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, float reflectionSpace, float reflectionHeight);
|
||||
|
||||
CTextureRef AddTexture(string fileName);
|
||||
void RemoveTexture(ref CTextureRef texture);
|
||||
|
||||
@@ -36,16 +36,11 @@ namespace VocaluxeLib.Menu
|
||||
[XmlType("Background")]
|
||||
public struct SThemeBackground
|
||||
{
|
||||
[XmlAttributeAttribute(AttributeName = "Name")]
|
||||
public string Name;
|
||||
[XmlElement("Type")]
|
||||
public EBackgroundTypes Type;
|
||||
[XmlArray]
|
||||
public List<string> SlideShowTextures;
|
||||
[XmlElement("Video")]
|
||||
public string VideoName;
|
||||
[XmlElement("Skin")]
|
||||
public string TextureName;
|
||||
[XmlAttribute(AttributeName = "Name")] public string Name;
|
||||
[XmlElement("Type")] public EBackgroundTypes Type;
|
||||
[XmlArray] public List<string> SlideShowTextures;
|
||||
[XmlElement("Video")] public string VideoName;
|
||||
[XmlElement("Skin")] public string TextureName;
|
||||
public SThemeColor Color;
|
||||
}
|
||||
|
||||
@@ -225,7 +220,9 @@ namespace VocaluxeLib.Menu
|
||||
#region internal
|
||||
private static SRectF _GetDrawRect()
|
||||
{
|
||||
return new SRectF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), CBase.Settings.GetZFar() / 4);
|
||||
SRectF rect = CBase.Settings.GetRenderRect();
|
||||
rect.Z = CBase.Settings.GetZFar() / 4;
|
||||
return rect;
|
||||
}
|
||||
|
||||
private void _DrawColor()
|
||||
|
||||
+18
-31
@@ -33,37 +33,24 @@ namespace VocaluxeLib.Menu
|
||||
public string ScreenName;
|
||||
public int ScreenVersion;
|
||||
}
|
||||
|
||||
[XmlType("Screen")]
|
||||
public struct STheme
|
||||
{
|
||||
[XmlElement("Informations")]
|
||||
public SScreenInformation ScreenInformation;
|
||||
[XmlArray("Backgrounds")]
|
||||
public List<SThemeBackground> Backgrounds;
|
||||
[XmlArray("Statics")]
|
||||
public List<SThemeStatic> Statics;
|
||||
[XmlArray("Texts")]
|
||||
public List<SThemeText> Texts;
|
||||
[XmlArray("Buttons")]
|
||||
public List<SThemeButton> Buttons;
|
||||
[XmlArray("SongMenus")]
|
||||
public List<SThemeSongMenu> SongMenus;
|
||||
[XmlArray("Lyrics")]
|
||||
public List<SThemeLyrics> Lyrics;
|
||||
[XmlArray("SelectSlides")]
|
||||
public List<SThemeSelectSlide> SelectSlides;
|
||||
[XmlArray("SingNotes")]
|
||||
public List<SThemeSingBar> SingNotes;
|
||||
[XmlArray("NameSelections")]
|
||||
public List<SThemeNameSelection> NameSelections;
|
||||
[XmlArray("Equalizers")]
|
||||
public List<SThemeEqualizer> Equalizers;
|
||||
[XmlArray("Playlists")]
|
||||
public List<SThemePlaylist> Playlists;
|
||||
[XmlArray("ParticleEffects")]
|
||||
public List<SThemeParticleEffect> ParticleEffects;
|
||||
[XmlArray("ScreenSettings")]
|
||||
public List<SScreenSetting> ScreenSettings;
|
||||
[XmlElement("Informations")] public SScreenInformation ScreenInformation;
|
||||
[XmlArray("Backgrounds")] public List<SThemeBackground> Backgrounds;
|
||||
[XmlArray("Statics")] public List<SThemeStatic> Statics;
|
||||
[XmlArray("Texts")] public List<SThemeText> Texts;
|
||||
[XmlArray("Buttons")] public List<SThemeButton> Buttons;
|
||||
[XmlArray("SongMenus")] public List<SThemeSongMenu> SongMenus;
|
||||
[XmlArray("Lyrics")] public List<SThemeLyrics> Lyrics;
|
||||
[XmlArray("SelectSlides")] public List<SThemeSelectSlide> SelectSlides;
|
||||
[XmlArray("SingNotes")] public List<SThemeSingBar> SingNotes;
|
||||
[XmlArray("NameSelections")] public List<SThemeNameSelection> NameSelections;
|
||||
[XmlArray("Equalizers")] public List<SThemeEqualizer> Equalizers;
|
||||
[XmlArray("Playlists")] public List<SThemePlaylist> Playlists;
|
||||
[XmlArray("ParticleEffects")] public List<SThemeParticleEffect> ParticleEffects;
|
||||
[XmlArray("ScreenSettings")] public List<SScreenSetting> ScreenSettings;
|
||||
}
|
||||
|
||||
struct SZSort
|
||||
@@ -157,7 +144,7 @@ namespace VocaluxeLib.Menu
|
||||
_MouseDY = 0;
|
||||
|
||||
_Active = false;
|
||||
_ScreenArea = new SRectF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), 0f);
|
||||
_ScreenArea = CBase.Settings.GetRenderRect();
|
||||
|
||||
_ThemeBackgrounds = null;
|
||||
_ThemeStatics = null;
|
||||
@@ -249,7 +236,7 @@ namespace VocaluxeLib.Menu
|
||||
foreach (SThemeParticleEffect pe in Theme.ParticleEffects)
|
||||
_AddParticleEffect(new CParticleEffect(pe, _PartyModeID), pe.Name);
|
||||
|
||||
foreach(SThemePlaylist pl in Theme.Playlists)
|
||||
foreach (SThemePlaylist pl in Theme.Playlists)
|
||||
_AddPlaylist(new CPlaylist(pl, _PartyModeID), pl.Name);
|
||||
|
||||
foreach (SScreenSetting ss in Theme.ScreenSettings)
|
||||
@@ -268,7 +255,7 @@ namespace VocaluxeLib.Menu
|
||||
_AddStatic(new CStatic(st, _PartyModeID), st.Name);
|
||||
|
||||
foreach (SThemeText te in Theme.Texts)
|
||||
_AddText(new CText(te, _PartyModeID), te.Name);
|
||||
_AddText(new CText(te, _PartyModeID), te.Name);
|
||||
}
|
||||
catch (InvalidOperationException e)
|
||||
{
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace VocaluxeLib.Menu
|
||||
_MouseDY = 0;
|
||||
|
||||
Active = false;
|
||||
_ScreenArea = new SRectF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), 0f);
|
||||
_ScreenArea = CBase.Settings.GetRenderRect();
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
|
||||
@@ -199,7 +199,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_Tiles.Add(tile);
|
||||
}
|
||||
}
|
||||
_ScrollRect = new SRectF(0, 0, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), Rect.Z);
|
||||
_ScrollRect = CBase.Settings.GetRenderRect();
|
||||
}
|
||||
|
||||
public override void Update(SScreenSongOptions songOptions)
|
||||
@@ -500,9 +500,8 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
if (vidtex.Color.A < 1)
|
||||
_CoverBig.Draw(EAspect.Crop);
|
||||
SRectF rect = CHelper.FitInBounds(_CoverBig.Rect, vidtex.OrigAspect, EAspect.Crop);
|
||||
|
||||
CBase.Drawing.DrawTexture(vidtex, rect);
|
||||
CBase.Drawing.DrawTextureReflection(vidtex, rect, vidtex.Color, _CoverBig.ReflectionSpace, _CoverBig.ReflectionHeight);
|
||||
CBase.Drawing.DrawTexture(vidtex, rect, vidtex.Color, _CoverBig.Rect);
|
||||
CBase.Drawing.DrawTextureReflection(vidtex, rect, vidtex.Color, _CoverBig.Rect, _CoverBig.ReflectionSpace, _CoverBig.ReflectionHeight);
|
||||
}
|
||||
else
|
||||
_CoverBig.Draw(EAspect.Crop);
|
||||
|
||||
Reference in new issue
Block a user