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