Add Inital Multi-Monitor Support

Initial support for multimonitor setups.
Support for up to 6 monitors with 1-6 players on screen 1 and 0-6
players on screen 2-6.
Currently the max amount of players is unchanged and participating
players are spread across all available screens.

Screens are extended horizontally. For fullscreen use with multiple
physical monitors one will have to use some kind of
surround-configuration. (AMD Eyefinity/nVidia Surround/etc.)
This commit is contained in:
Jiiniasu committed 2016-12-18 18:51:51 +01:00
1 parent e888197cdc
commit bf5205b080
22 files changed
+7786 -291

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -1,5 +1,20 @@
ScreenSing ScreenSing
+++++++++
Version 8
Add:
Modified elements for 6 monitors support
S# = Screen
P# = Player
N# = Players on screen
<StaticAvatarS#P#N#>
<StaticScoreS#P#N#>
<TextNameS#P#N#>
<TextScoreS#P#N#>
+++++++++ +++++++++
Version 7 Version 7
+12
View File
@@ -83,6 +83,8 @@ namespace Vocaluxe.Base
[XmlRanged(32, 1024), DefaultValue(256)] [XmlRanged(32, 1024), DefaultValue(256)]
public int CoverSize; public int CoverSize;
[XmlRanged(1, 6), DefaultValue(1)]
public int NumScreens;
[DefaultValue(1024)] [DefaultValue(1024)]
public int ScreenW; public int ScreenW;
[DefaultValue(576)] [DefaultValue(576)]
@@ -417,6 +419,9 @@ namespace Vocaluxe.Base
Config.Game.NumPlayers = 2; Config.Game.NumPlayers = 2;
Array.Resize(ref Config.Game.Players, CSettings.MaxNumPlayer); Array.Resize(ref Config.Game.Players, CSettings.MaxNumPlayer);
if (!Config.Graphics.NumScreens.IsInRange(1, CSettings.MaxNumScreens))
Config.Graphics.NumScreens = 1;
bool langExists = CLanguage.SetLanguage(Config.Game.Language); bool langExists = CLanguage.SetLanguage(Config.Game.Language);
if (langExists == false) if (langExists == false)
@@ -464,6 +469,8 @@ namespace Vocaluxe.Base
return "TextureQuality: " + CHelper.ListStrings(Enum.GetNames(typeof(ETextureQuality))); return "TextureQuality: " + CHelper.ListStrings(Enum.GetNames(typeof(ETextureQuality)));
case "CoverSize": case "CoverSize":
return "CoverSize (pixels): 32, 64, 128, 256, 512, 1024 (default: 128)"; return "CoverSize (pixels): 32, 64, 128, 256, 512, 1024 (default: 128)";
case "NumScreens":
return "Number of screens to use. 1 - 6 (default: 1)";
case "ScreenW": case "ScreenW":
return "Screen width and height (pixels)"; return "Screen width and height (pixels)";
case "BorderLeft": case "BorderLeft":
@@ -626,6 +633,11 @@ namespace Vocaluxe.Base
return max; return max;
} }
public static int GetNumScreens()
{
return Config.Graphics.NumScreens;
}
/// <summary> /// <summary>
/// Try to assign automatically player 1 and 2 to usb-mics. /// Try to assign automatically player 1 and 2 to usb-mics.
/// </summary> /// </summary>
+15 -11
View File
@@ -285,9 +285,10 @@ namespace Vocaluxe.Base
/// </summary> /// </summary>
/// <param name="color"></param> /// <param name="color"></param>
/// <param name="rect"></param> /// <param name="rect"></param>
public static void DrawRect(SColorF color, SRectF rect) /// <param name="allMonitors">Render on all monitors</param>
public static void DrawRect(SColorF color, SRectF rect, bool allMonitors = true)
{ {
_Draw.DrawRect(color, rect); _Draw.DrawRect(color, rect, allMonitors);
} }
/// <summary> /// <summary>
@@ -328,9 +329,10 @@ namespace Vocaluxe.Base
/// <param name="rect"></param> /// <param name="rect"></param>
/// <param name="color"></param> /// <param name="color"></param>
/// <param name="mirrored">True to mirror the texture on the y axis</param> /// <param name="mirrored">True to mirror the texture on the y axis</param>
public static void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, bool mirrored = false) /// <param name="allMonitors">Render on all monitors</param>
public static void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, bool mirrored = false, bool allMonitors = true)
{ {
_Draw.DrawTexture(textureRef, rect, color, mirrored); _Draw.DrawTexture(textureRef, rect, color, mirrored, allMonitors);
} }
/// <summary> /// <summary>
@@ -341,9 +343,10 @@ namespace Vocaluxe.Base
/// <param name="color"></param> /// <param name="color"></param>
/// <param name="bounds">Bounds to draw the texture in (rest gets cropped off)</param> /// <param name="bounds">Bounds to draw the texture in (rest gets cropped off)</param>
/// <param name="mirrored">True to mirror the texture on the y axis</param> /// <param name="mirrored">True to mirror the texture on the y axis</param>
public static void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false) /// <param name="allMonitors">Render on all monitors</param>
public static void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false, bool allMonitors = true)
{ {
_Draw.DrawTexture(textureRef, rect, color, bounds, mirrored); _Draw.DrawTexture(textureRef, rect, color, bounds, mirrored, allMonitors);
} }
/// <summary> /// <summary>
@@ -354,9 +357,10 @@ namespace Vocaluxe.Base
/// <param name="color"></param> /// <param name="color"></param>
/// <param name="begin">Normalized start x-coordinate (0..1)</param> /// <param name="begin">Normalized start x-coordinate (0..1)</param>
/// <param name="end">Normalized end x-coordinate (0..1)</param> /// <param name="end">Normalized end x-coordinate (0..1)</param>
public static void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, float begin, float end) /// <param name="allMonitors">Render on all monitors</param>
public static void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, float begin, float end, bool allMonitors = true)
{ {
_Draw.DrawTexture(textureRef, rect, color, begin, end); _Draw.DrawTexture(textureRef, rect, color, begin, end, allMonitors);
} }
/// <summary> /// <summary>
@@ -383,7 +387,7 @@ namespace Vocaluxe.Base
return; return;
SRectF rect = CHelper.FitInBounds(bounds, textureRef.OrigAspect, aspect); SRectF rect = CHelper.FitInBounds(bounds, textureRef.OrigAspect, aspect);
DrawTexture(textureRef, rect, color); DrawTexture(textureRef, rect, color, bounds);
} }
/// <summary> /// <summary>
@@ -395,9 +399,9 @@ namespace Vocaluxe.Base
/// <param name="bounds"></param> /// <param name="bounds"></param>
/// <param name="space">Spacing between the rect and the reflection</param> /// <param name="space">Spacing between the rect and the reflection</param>
/// <param name="height">Height of the reflection</param> /// <param name="height">Height of the reflection</param>
public static void DrawTextureReflection(CTextureRef textureRef, SRectF rect, SColorF color, SRectF bounds, float space, float height) public static void DrawTextureReflection(CTextureRef textureRef, SRectF rect, SColorF color, SRectF bounds, float space, float height, bool allMonitors = true)
{ {
_Draw.DrawTextureReflection(textureRef, rect, color, bounds, space, height); _Draw.DrawTextureReflection(textureRef, rect, color, bounds, space, height, allMonitors);
} }
} }
} }
+20 -10
View File
@@ -170,6 +170,11 @@ namespace Vocaluxe.Base
{ {
CConfig.SongMenuChanged -= onSongMenuChanged; CConfig.SongMenuChanged -= onSongMenuChanged;
} }
public int GetNumScreens()
{
return CConfig.GetNumScreens();
}
} }
class CBsettings : ISettings class CBsettings : ISettings
@@ -229,6 +234,11 @@ namespace Vocaluxe.Base
return CSettings.MaxNumPlayer; return CSettings.MaxNumPlayer;
} }
public int GetMaxNumScreens()
{
return CSettings.MaxNumScreens;
}
public float GetDefaultMedleyFadeInTime() public float GetDefaultMedleyFadeInTime()
{ {
return CSettings.DefaultMedleyFadeInTime; return CSettings.DefaultMedleyFadeInTime;
@@ -398,14 +408,14 @@ namespace Vocaluxe.Base
CDraw.DrawTexture(texture, rect); CDraw.DrawTexture(texture, rect);
} }
public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color) public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, bool allMonitors = true)
{ {
CDraw.DrawTexture(texture, rect, color); CDraw.DrawTexture(texture, rect, color, false, allMonitors);
} }
public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false) public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false, bool allMonitors = true)
{ {
CDraw.DrawTexture(texture, rect, color, bounds, mirrored); CDraw.DrawTexture(texture, rect, color, bounds, mirrored, allMonitors);
} }
public void DrawTexture(CTextureRef textureRef, SRectF bounds, EAspect aspect) public void DrawTexture(CTextureRef textureRef, SRectF bounds, EAspect aspect)
@@ -418,9 +428,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, SRectF bounds, float reflectionSpace, float reflectionHeight) public void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, float reflectionSpace, float reflectionHeight, bool allMonitors = true)
{ {
CDraw.DrawTextureReflection(texture, rect, color, bounds, reflectionSpace, reflectionHeight); CDraw.DrawTextureReflection(texture, rect, color, bounds, reflectionSpace, reflectionHeight, allMonitors);
} }
public CTextureRef AddTexture(string fileName) public CTextureRef AddTexture(string fileName)
@@ -438,9 +448,9 @@ namespace Vocaluxe.Base
CDraw.RemoveTexture(ref texture); CDraw.RemoveTexture(ref texture);
} }
public void DrawRect(SColorF color, SRectF rect) public void DrawRect(SColorF color, SRectF rect, bool allMonitors = true)
{ {
CDraw.DrawRect(color, rect); CDraw.DrawRect(color, rect, allMonitors);
} }
public void DrawRectReflection(SColorF color, SRectF rect, float space, float height) public void DrawRectReflection(SColorF color, SRectF rect, float space, float height)
@@ -517,9 +527,9 @@ namespace Vocaluxe.Base
return CFonts.GetTextBounds(text); return CFonts.GetTextBounds(text);
} }
public void DrawText(string text, CFont font, float x, float y, float z, SColorF color) public void DrawText(string text, CFont font, float x, float y, float z, SColorF color, bool allMonitors = true)
{ {
CFonts.DrawText(text, font, x, y, z, color); CFonts.DrawText(text, font, x, y, z, color, allMonitors);
} }
public void DrawTextReflection(string text, CFont font, float x, float y, float z, SColorF color, float reflectionSpace, float reflectionHeight) public void DrawTextReflection(string text, CFont font, float x, float y, float z, SColorF color, float reflectionSpace, float reflectionHeight)
+2 -1
View File
@@ -97,6 +97,7 @@ namespace Vocaluxe.Base
public const int DatabaseCoverVersion = 1; public const int DatabaseCoverVersion = 1;
public const int DatabaseCreditsRessourcesVersion = 1; public const int DatabaseCreditsRessourcesVersion = 1;
public const int MaxNumScreens = 6;
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 static readonly SRectF RenderRect = new SRectF(0, 0, RenderW, RenderH, 0);
@@ -252,7 +253,7 @@ namespace Vocaluxe.Base
public static float GetRenderAspect() public static float GetRenderAspect()
{ {
return RenderW / (float)RenderH; return RenderW * CConfig.GetNumScreens() / (float)RenderH;
} }
public static void CreateFolders() public static void CreateFolders()
+3 -1
View File
@@ -225,7 +225,9 @@ namespace Vocaluxe.Base
private void _Add(int x, int y, bool lb, bool ld, bool rb, int wheel, bool lbh, bool rbh, bool mb, bool mbh) private void _Add(int x, int y, bool lb, bool ld, bool rb, int wheel, bool lbh, bool rbh, bool mb, bool mbh)
{ {
_CheckModifiers(); _CheckModifiers();
x = (int)(x * (float)CSettings.RenderW / CDraw.GetScreenWidth()); x = (int)(x * (float)CSettings.RenderW * CConfig.Config.Graphics.NumScreens / CDraw.GetScreenWidth());
while (x > CSettings.RenderW)
x -= CSettings.RenderW;
y = (int)(y * (float)CSettings.RenderH / CDraw.GetScreenHeight()); y = (int)(y * (float)CSettings.RenderH / CDraw.GetScreenHeight());
var pool = new SMouseEvent(ESender.Mouse, _Mod, x, y, lb, ld, rb, -wheel / 120, lbh, rbh, mb, mbh); var pool = new SMouseEvent(ESender.Mouse, _Mod, x, y, lb, ld, rb, -wheel / 120, lbh, rbh, mb, mbh);
+2 -2
View File
@@ -99,12 +99,12 @@ namespace Vocaluxe.Base.Fonts
return new Font(_Family, height, _GetSystemFontStyle(), GraphicsUnit.Pixel); return new Font(_Family, height, _GetSystemFontStyle(), GraphicsUnit.Pixel);
} }
public void DrawGlyph(char chr, float fontHeight, float x, float y, float z, SColorF color) public void DrawGlyph(char chr, float fontHeight, float x, float y, float z, SColorF color, bool allMonitors = true)
{ {
CTextureRef texture; CTextureRef texture;
SRectF rect; SRectF rect;
GetOrAddGlyph(chr, fontHeight).GetTextureAndRect(fontHeight, x, y, z, out texture, out rect); GetOrAddGlyph(chr, fontHeight).GetTextureAndRect(fontHeight, x, y, z, out texture, out rect);
CDraw.DrawTexture(texture, rect, color); CDraw.DrawTexture(texture, rect, color, false, allMonitors);
} }
public void DrawGlyph(char chr, float fontHeight, float x, float y, float z, SColorF color, float begin, float end) public void DrawGlyph(char chr, float fontHeight, float x, float y, float z, SColorF color, float begin, float end)
+2 -2
View File
@@ -74,7 +74,7 @@ namespace Vocaluxe.Base.Fonts
/// <param name="y">The texts y-position</param> /// <param name="y">The texts y-position</param>
/// <param name="z">The texts z-position</param> /// <param name="z">The texts z-position</param>
/// <param name="color">The text color</param> /// <param name="color">The text color</param>
public static void DrawText(string text, CFont font, float x, float y, float z, SColorF color) public static void DrawText(string text, CFont font, float x, float y, float z, SColorF color, bool allMonitors = true)
{ {
if (font.Height <= 0f || text == "") if (font.Height <= 0f || text == "")
return; return;
@@ -84,7 +84,7 @@ namespace Vocaluxe.Base.Fonts
float dx = x; float dx = x;
foreach (char chr in text) foreach (char chr in text)
{ {
fontStyle.DrawGlyph(chr, font.Height, dx, y, z, color); fontStyle.DrawGlyph(chr, font.Height, dx, y, z, color, allMonitors);
dx += fontStyle.GetWidth(chr, font.Height); dx += fontStyle.GetWidth(chr, font.Height);
} }
} }
+5 -5
View File
@@ -86,7 +86,7 @@ namespace Vocaluxe.Lib.Draw
/// </summary> /// </summary>
public CDirect3D() public CDirect3D()
{ {
_Form = new CRenderFormHook { ClientSize = new Size(CConfig.Config.Graphics.ScreenW, CConfig.Config.Graphics.ScreenH) }; _Form = new CRenderFormHook { ClientSize = new Size(CConfig.Config.Graphics.ScreenW * CConfig.Config.Graphics.NumScreens, CConfig.Config.Graphics.ScreenH) };
try try
{ {
@@ -114,7 +114,7 @@ namespace Vocaluxe.Lib.Draw
Windowed = true, Windowed = true,
SwapEffect = SwapEffect.Discard, SwapEffect = SwapEffect.Discard,
BackBufferHeight = CConfig.Config.Graphics.ScreenH, BackBufferHeight = CConfig.Config.Graphics.ScreenH,
BackBufferWidth = CConfig.Config.Graphics.ScreenW, BackBufferWidth = CConfig.Config.Graphics.ScreenW * CConfig.Config.Graphics.NumScreens,
BackBufferFormat = _D3D.Adapters.DefaultAdapter.CurrentDisplayMode.Format, BackBufferFormat = _D3D.Adapters.DefaultAdapter.CurrentDisplayMode.Format,
Multisample = MultisampleType.None, Multisample = MultisampleType.None,
MultisampleQuality = 0 MultisampleQuality = 0
@@ -379,7 +379,7 @@ namespace Vocaluxe.Lib.Draw
const float dy = (float)CSettings.RenderH / 2; const float dy = (float)CSettings.RenderH / 2;
Matrix translate = Matrix.Translation(new Vector3(-dx, dy, 0)); Matrix translate = Matrix.Translation(new Vector3(-dx, dy, 0));
Matrix projection = Matrix.OrthoOffCenterLH( Matrix projection = Matrix.OrthoOffCenterLH(
-dx - _BorderLeft, dx + _BorderRight, -dx - _BorderLeft, (CSettings.RenderW * CConfig.Config.Graphics.NumScreens) - dx + _BorderRight,
-dy - _BorderBottom, dy + _BorderTop, -dy - _BorderBottom, dy + _BorderTop,
CSettings.ZNear, CSettings.ZFar); CSettings.ZNear, CSettings.ZFar);
@@ -572,9 +572,9 @@ namespace Vocaluxe.Lib.Draw
/// </summary> /// </summary>
/// <param name="color">The color in which the rectangle will be drawn in</param> /// <param name="color">The color in which the rectangle will be drawn in</param>
/// <param name="rect">The coordinates in a SRectF struct</param> /// <param name="rect">The coordinates in a SRectF struct</param>
public void DrawRect(SColorF color, SRectF rect) public void DrawRect(SColorF color, SRectF rect, bool allMonitors = true)
{ {
DrawTexture(_BlankTexture, rect, color); DrawTexture(_BlankTexture, rect, color, false, allMonitors);
} }
/// <summary> /// <summary>
+84 -23
View File
@@ -220,7 +220,7 @@ namespace Vocaluxe.Lib.Draw
return true; return true;
} }
public void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, bool mirrored = false) public void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, bool mirrored = false, bool allMonitors = true)
{ {
if (Math.Abs(color.A) < 0.01) if (Math.Abs(color.A) < 0.01)
return; return;
@@ -228,10 +228,23 @@ namespace Vocaluxe.Lib.Draw
TTextureType texture; TTextureType texture;
if (!_GetTexture(textureRef, out texture)) if (!_GetTexture(textureRef, out texture))
return; return;
if (!_CalcDrawCoords(texture, rect, out dc, mirrored)) if (allMonitors)
return; {
for (int i = 0; i < CConfig.Config.Graphics.NumScreens; i++)
_DrawTexture(texture, dc, color); {
SRectF newrect = rect;
newrect.X += CSettings.RenderW * i;
if (!_CalcDrawCoords(texture, newrect, out dc, mirrored))
return;
_DrawTexture(texture, dc, color);
}
}
else
{
if (!_CalcDrawCoords(texture, rect, out dc, mirrored))
return;
_DrawTexture(texture, dc, color);
}
} }
/// <summary> /// <summary>
@@ -242,7 +255,7 @@ namespace Vocaluxe.Lib.Draw
/// <param name="color">A SColorF struct containing a color which the texture will be colored in</param> /// <param name="color">A SColorF struct containing a color which the texture will be colored in</param>
/// <param name="bounds">A SRectF struct containing which part of the texture should be drawn</param> /// <param name="bounds">A SRectF struct containing which part of the texture should be drawn</param>
/// <param name="mirrored">True if the texture should be mirrored</param> /// <param name="mirrored">True if the texture should be mirrored</param>
public void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false) public void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false, bool allMonitors = true)
{ {
if (Math.Abs(color.A) < 0.01) if (Math.Abs(color.A) < 0.01)
return; return;
@@ -250,10 +263,26 @@ namespace Vocaluxe.Lib.Draw
TTextureType texture; TTextureType texture;
if (!_GetTexture(textureRef, out texture)) if (!_GetTexture(textureRef, out texture))
return; return;
if (!_CalcDrawCoords(texture, rect, bounds, out dc))
return;
_DrawTexture(texture, dc, color); if (allMonitors)
{
for (int i = 0; i < CConfig.Config.Graphics.NumScreens; i++)
{
SRectF newrect = rect;
SRectF newbounds = bounds;
newrect.X += CSettings.RenderW * i;
newbounds.X += CSettings.RenderW * i;
if (!_CalcDrawCoords(texture, newrect, newbounds, out dc, mirrored))
return;
_DrawTexture(texture, dc, color);
}
}
else
{
if (!_CalcDrawCoords(texture, rect, bounds, out dc, mirrored))
return;
_DrawTexture(texture, dc, color);
}
} }
/// <summary> /// <summary>
@@ -264,7 +293,7 @@ namespace Vocaluxe.Lib.Draw
/// <param name="color">A SColorF struct containing a color which the texture will be colored in</param> /// <param name="color">A SColorF struct containing a color which the texture will be colored in</param>
/// <param name="begin">A Value ranging from 0 to 1 containing the beginning of the texture</param> /// <param name="begin">A Value ranging from 0 to 1 containing the beginning of the texture</param>
/// <param name="end">A Value ranging from 0 to 1 containing the ending of the texture</param> /// <param name="end">A Value ranging from 0 to 1 containing the ending of the texture</param>
public void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, float begin, float end) public void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, float begin, float end, bool allMonitors = true)
{ {
if (Math.Abs(color.A) < 0.01) if (Math.Abs(color.A) < 0.01)
return; return;
@@ -272,10 +301,24 @@ namespace Vocaluxe.Lib.Draw
TTextureType texture; TTextureType texture;
if (!_GetTexture(textureRef, out texture)) if (!_GetTexture(textureRef, out texture))
return; return;
if (!_CalcDrawCoords(texture, rect, out dc, false, begin, end))
return;
_DrawTexture(texture, dc, color); if (allMonitors)
{
for (int i = 0; i < CConfig.Config.Graphics.NumScreens; i++)
{
SRectF newrect = rect;
newrect.X += CSettings.RenderW * i;
if (!_CalcDrawCoords(texture, newrect, out dc, false, begin, end))
return;
_DrawTexture(texture, dc, color);
}
}
else
{
if (!_CalcDrawCoords(texture, rect, out dc, false, begin, end))
return;
_DrawTexture(texture, dc, color);
}
} }
/// <summary> /// <summary>
@@ -287,7 +330,7 @@ namespace Vocaluxe.Lib.Draw
/// <param name="bounds">A SRectF struct containing which part of the texture should be drawn</param> /// <param name="bounds">A SRectF struct containing which part of the texture should be drawn</param>
/// <param name="space">The space between the texture and the reflection</param> /// <param name="space">The space between the texture and the reflection</param>
/// <param name="height">The height of the reflection</param> /// <param name="height">The height of the reflection</param>
public void DrawTextureReflection(CTextureRef textureRef, SRectF rect, SColorF color, SRectF bounds, float space, float height) public void DrawTextureReflection(CTextureRef textureRef, SRectF rect, SColorF color, SRectF bounds, float space, float height, bool allMonitors = true)
{ {
Debug.Assert(height >= 0); Debug.Assert(height >= 0);
@@ -297,17 +340,35 @@ namespace Vocaluxe.Lib.Draw
TTextureType texture; TTextureType texture;
if (!_GetTexture(textureRef, out texture)) if (!_GetTexture(textureRef, out texture))
return; return;
if (!_CalcDrawCoords(texture, rect, bounds, out dc, true))
return;
if (height > rect.H) int loops;
height = rect.H; if (allMonitors)
{
loops = CConfig.Config.Graphics.NumScreens;
}
else
{
loops = 1;
}
dc.Wy1 += rect.H + space; // Move from start of rect to end of rect with spacing for (int i = 0; i < loops; i++)
dc.Wy2 += space + height; // Move from end of rect {
dc.Ty2 += (rect.H - height) / rect.H; // Adjust so not all of the start of the texture is drawn (mirrored--> Ty1>Ty2) SRectF newrect = rect;
if (dc.Ty2 < dc.Ty1) // Make sure we actually draw something SRectF newbounds = bounds;
_DrawTexture(texture, dc, color, true); newrect.X += CSettings.RenderW * i;
newbounds.X += CSettings.RenderW * i;
if (!_CalcDrawCoords(texture, newrect, newbounds, out dc, true))
return;
if (height > newrect.H)
height = newrect.H;
dc.Wy1 += newrect.H + space; // Move from start of rect to end of rect with spacing
dc.Wy2 += space + height; // Move from end of rect
dc.Ty2 += (newrect.H - height) / newrect.H; // Adjust so not all of the start of the texture is drawn (mirrored--> Ty1>Ty2)
if (dc.Ty2 < dc.Ty1) // Make sure we actually draw something
_DrawTexture(texture, dc, color, true);
}
} }
// Resharper doesn't get that this is used -.- // Resharper doesn't get that this is used -.-
+5 -5
View File
@@ -308,7 +308,7 @@ namespace Vocaluxe.Lib.Draw
_Backbuffer.Save(file, ImageFormat.Png); _Backbuffer.Save(file, ImageFormat.Png);
} }
public void DrawRect(SColorF color, SRectF rect) { } public void DrawRect(SColorF color, SRectF rect, bool allMonitors = true) { }
public void DrawRectReflection(SColorF color, SRectF rect, float space, float height) { } public void DrawRectReflection(SColorF color, SRectF rect, float space, float height) { }
@@ -418,13 +418,13 @@ namespace Vocaluxe.Lib.Draw
_Bitmaps[textureRef.ID] = bmp; _Bitmaps[textureRef.ID] = bmp;
} }
public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, bool mirrored = false) public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, bool mirrored = false, bool allMonitors = true)
{ {
if (texture != null) if (texture != null)
DrawTexture(texture, rect, color, rect, mirrored); DrawTexture(texture, rect, color, rect, mirrored);
} }
public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false) public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false, bool allMonitors = true)
{ {
if (!_TextureExists(texture)) if (!_TextureExists(texture))
return; return;
@@ -433,9 +433,9 @@ namespace Vocaluxe.Lib.Draw
coloredBitmap.Dispose(); coloredBitmap.Dispose();
} }
public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, float begin, float end) { } public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, float begin, float end, bool allMonitors = true) { }
public void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) { } public void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, float space, float height, bool allMonitors = true) { }
public int GetTextureCount() public int GetTextureCount()
{ {
+29 -20
View File
@@ -100,7 +100,7 @@ namespace Vocaluxe.Lib.Draw
public COpenGL() public COpenGL()
{ {
_Form = new CFormHook { ClientSize = new Size(CConfig.Config.Graphics.ScreenW, CConfig.Config.Graphics.ScreenH) }; _Form = new CFormHook { ClientSize = new Size(CConfig.Config.Graphics.ScreenW * CConfig.Config.Graphics.NumScreens, CConfig.Config.Graphics.ScreenH) };
//OpenGL needs that here but D3D needs it in the constructor, so do NOT unify! //OpenGL needs that here but D3D needs it in the constructor, so do NOT unify!
//Check AA Mode //Check AA Mode
@@ -285,7 +285,7 @@ namespace Vocaluxe.Lib.Draw
{ {
GL.MatrixMode(MatrixMode.Projection); GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity(); GL.LoadIdentity();
GL.Ortho(-CConfig.Config.Graphics.BorderLeft, CConfig.Config.Graphics.BorderRight + CSettings.RenderW, CConfig.Config.Graphics.BorderBottom + CSettings.RenderH, GL.Ortho(-CConfig.Config.Graphics.BorderLeft, CConfig.Config.Graphics.BorderRight + CSettings.RenderW * CConfig.Config.Graphics.NumScreens, CConfig.Config.Graphics.BorderBottom + CSettings.RenderH,
-CConfig.Config.Graphics.BorderTop, CSettings.ZNear, CSettings.ZFar); -CConfig.Config.Graphics.BorderTop, CSettings.ZNear, CSettings.ZFar);
} }
@@ -338,27 +338,36 @@ namespace Vocaluxe.Lib.Draw
} }
} }
public void DrawRect(SColorF color, SRectF rect) public void DrawRect(SColorF color, SRectF rect, bool allMonitors = true)
{ {
GL.Enable(EnableCap.Blend); int loops = 1;
GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha); if (allMonitors)
loops = CConfig.Config.Graphics.NumScreens;
GL.Begin(PrimitiveType.Quads); for (int i = 0; i < loops; i++)
GL.MatrixMode(MatrixMode.Color);
GL.PushMatrix();
if (Math.Abs(rect.Rotation) > 0.001)
{ {
GL.Translate(0.5f, 0.5f, 0); SRectF newrect = rect;
GL.Rotate(-rect.Rotation, 0f, 0f, 1f); newrect.X += CSettings.RenderW * i;
GL.Translate(-0.5f, -0.5f, 0);
GL.Enable(EnableCap.Blend);
GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha);
GL.Begin(PrimitiveType.Quads);
GL.MatrixMode(MatrixMode.Color);
GL.PushMatrix();
if (Math.Abs(newrect.Rotation) > 0.001)
{
GL.Translate(0.5f, 0.5f, 0);
GL.Rotate(-newrect.Rotation, 0f, 0f, 1f);
GL.Translate(-0.5f, -0.5f, 0);
}
GL.Vertex3(newrect.X, newrect.Y, newrect.Z + CGraphics.ZOffset);
GL.Vertex3(newrect.X, newrect.Y + newrect.H, newrect.Z + CGraphics.ZOffset);
GL.Vertex3(newrect.X + newrect.W, newrect.Y + newrect.H, newrect.Z + CGraphics.ZOffset);
GL.Vertex3(newrect.X + newrect.W, newrect.Y, newrect.Z + CGraphics.ZOffset);
GL.End();
GL.PopMatrix();
GL.Disable(EnableCap.Blend);
} }
GL.Vertex3(rect.X, rect.Y, rect.Z + CGraphics.ZOffset);
GL.Vertex3(rect.X, rect.Y + rect.H, rect.Z + CGraphics.ZOffset);
GL.Vertex3(rect.X + rect.W, rect.Y + rect.H, rect.Z + CGraphics.ZOffset);
GL.Vertex3(rect.X + rect.W, rect.Y, rect.Z + CGraphics.ZOffset);
GL.End();
GL.PopMatrix();
GL.Disable(EnableCap.Blend);
} }
public void DrawRectReflection(SColorF color, SRectF rect, float space, float height) public void DrawRectReflection(SColorF color, SRectF rect, float space, float height)
+5 -5
View File
@@ -49,13 +49,13 @@ namespace Vocaluxe.Lib.Draw
void RemoveTexture(ref CTextureRef texture); void RemoveTexture(ref CTextureRef texture);
// Basic Draw Methods // Basic Draw Methods
void DrawRect(SColorF color, SRectF rect); void DrawRect(SColorF color, SRectF rect, bool allMonitors = true);
void DrawRectReflection(SColorF color, SRectF rect, float space, float height); void DrawRectReflection(SColorF color, SRectF rect, float space, float height);
void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, bool mirrored = false); void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, bool mirrored = false, bool allMonitors = true);
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, bool allMonitors = true);
void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, float begin, float end); void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, float begin, float end, bool allMonitors = true);
void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, float space, float height); void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, float space, float height, bool allMonitors = true);
} }
} }
+128 -50
View File
@@ -38,7 +38,7 @@ 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 7; } get { return 8; }
} }
private struct STimeRect private struct STimeRect
@@ -54,8 +54,8 @@ namespace Vocaluxe.Screens
private const string _TextDuetName1 = "TextDuetName1"; private const string _TextDuetName1 = "TextDuetName1";
private const string _TextDuetName2 = "TextDuetName2"; private const string _TextDuetName2 = "TextDuetName2";
private const string _TextMedleyCountdown = "TextMedleyCountdown"; private const string _TextMedleyCountdown = "TextMedleyCountdown";
private string[,] _TextScores; private string[,,] _TextScores;
private string[,] _TextNames; private string[,,] _TextNames;
private const string _StaticSongText = "StaticSongText"; private const string _StaticSongText = "StaticSongText";
private const string _StaticLyrics = "StaticLyrics"; private const string _StaticLyrics = "StaticLyrics";
@@ -71,8 +71,8 @@ namespace Vocaluxe.Screens
private const string _StaticLyricHelperTop = "StaticLyricHelperTop"; private const string _StaticLyricHelperTop = "StaticLyricHelperTop";
private const string _StaticPauseBG = "StaticPauseBG"; private const string _StaticPauseBG = "StaticPauseBG";
private string[,] _StaticScores; private string[,,] _StaticScores;
private string[,] _StaticAvatars; private string[,,] _StaticAvatars;
private const string _ButtonCancel = "ButtonCancel"; private const string _ButtonCancel = "ButtonCancel";
private const string _ButtonContinue = "ButtonContinue"; private const string _ButtonContinue = "ButtonContinue";
@@ -87,6 +87,11 @@ namespace Vocaluxe.Screens
private const string _SingBars = "SingBars"; private const string _SingBars = "SingBars";
private string[] _PlayerTextScore;
private string[] _PlayerTextName;
private string[] _PlayerStaticScore;
private string[] _PlayerStaticAvatar;
private bool _DynamicLyricsTop; private bool _DynamicLyricsTop;
private bool _DynamicLyricsBottom; private bool _DynamicLyricsBottom;
@@ -150,6 +155,7 @@ namespace Vocaluxe.Screens
_StaticPauseBG _StaticPauseBG
}; };
_BuildStaticStrings(ref statics); _BuildStaticStrings(ref statics);
_AssignPlayerElements();
_ThemeStatics = statics.ToArray(); _ThemeStatics = statics.ToArray();
_ThemeButtons = new string[] { _ButtonCancel, _ButtonContinue, _ButtonSkip }; _ThemeButtons = new string[] { _ButtonCancel, _ButtonContinue, _ButtonSkip };
@@ -334,15 +340,15 @@ namespace Vocaluxe.Screens
if (CConfig.Config.Theme.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_INFO || if (CConfig.Config.Theme.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_INFO ||
CConfig.Config.Theme.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL) CConfig.Config.Theme.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL)
{ {
_Statics[_StaticAvatars[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; _Statics[_PlayerStaticAvatar[p]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
_Texts[_TextNames[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; _Texts[_PlayerTextName[p]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
} }
if (CConfig.Config.Theme.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL) if (CConfig.Config.Theme.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL)
{ {
_Statics[_StaticScores[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; _Statics[_PlayerStaticScore[p]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
_Statics[_StaticAvatars[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; _Statics[_PlayerStaticAvatar[p]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
_Texts[_TextNames[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; _Texts[_PlayerTextName[p]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
_Texts[_TextScores[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; _Texts[_PlayerTextScore[p]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
} }
} }
@@ -366,7 +372,7 @@ namespace Vocaluxe.Screens
for (int p = 0; p < CGame.NumPlayers; p++) for (int p = 0; p < CGame.NumPlayers; p++)
{ {
string fmtString = (CGame.Players[p].Points < 10000) ? "0000" : "00000"; string fmtString = (CGame.Players[p].Points < 10000) ? "0000" : "00000";
_Texts[_TextScores[p, CGame.NumPlayers - 1]].Text = CGame.Players[p].Points.ToString(fmtString); _Texts[_PlayerTextScore[p]].Text = CGame.Players[p].Points.ToString(fmtString);
} }
if (_CurrentVideo != null && !_FadeOut && CConfig.Config.Video.VideosInSongs == EOffOn.TR_CONFIG_ON) if (_CurrentVideo != null && !_FadeOut && CConfig.Config.Video.VideosInSongs == EOffOn.TR_CONFIG_ON)
@@ -397,12 +403,17 @@ namespace Vocaluxe.Screens
_TimeRects.Clear(); _TimeRects.Clear();
_SingNotes[_SingBars].Init(0); _SingNotes[_SingBars].Init(0);
_AssignPlayerElements();
foreach (CLyric lyric in _Lyrics) foreach (CLyric lyric in _Lyrics)
lyric.LyricStyle = CConfig.Config.Theme.LyricStyle; lyric.LyricStyle = CConfig.Config.Theme.LyricStyle;
for (int p = 0; p < CGame.NumPlayers; p++) for (int p = 0; p < CGame.NumPlayers; p++)
_Statics[_StaticAvatars[p, CGame.NumPlayers - 1]].Aspect = EAspect.Crop; {
_Statics[_PlayerStaticAvatar[p]].Aspect = EAspect.Crop;
_Texts[_PlayerTextScore[p]].Color = new SColorF(CBase.Themes.GetPlayerColor(p + 1), _Texts[_PlayerTextScore[p]].Color.A);
}
_SetVisibility(); _SetVisibility();
_UpdateAvatars(); _UpdateAvatars();
@@ -583,7 +594,7 @@ namespace Vocaluxe.Screens
} }
//Attention: This needs to be done after player-assignment! //Attention: This needs to be done after player-assignment!
_SingNotes[_SingBars].Init(CGame.NumPlayers); _SingNotes[_SingBars].Init(CGame.NumPlayers, CConfig.Config.Graphics.NumScreens);
_DynamicLyricsTop = false; _DynamicLyricsTop = false;
_DynamicLyricsBottom = false; _DynamicLyricsBottom = false;
@@ -804,21 +815,23 @@ namespace Vocaluxe.Screens
private void _BuildTextStrings(List<string> texts) private void _BuildTextStrings(List<string> texts)
{ {
_TextScores = new string[CSettings.MaxNumPlayer, CSettings.MaxNumPlayer]; _TextScores = new string[CSettings.MaxNumScreens, CSettings.MaxNumPlayer, CSettings.MaxNumPlayer];
_TextNames = new string[CSettings.MaxNumPlayer, CSettings.MaxNumPlayer]; _TextNames = new string[CSettings.MaxNumScreens, CSettings.MaxNumPlayer, CSettings.MaxNumPlayer];
for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
{ {
for (int player = 0; player < CSettings.MaxNumPlayer; player++) for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
{ {
if (player <= numplayer) for (int player = 0; player < CSettings.MaxNumPlayer; player++)
{ {
string target = "P" + (player + 1) + "N" + (numplayer + 1); if (player <= numplayer)
_TextScores[player, numplayer] = "TextScore" + target; {
_TextNames[player, numplayer] = "TextName" + target; string target = "S" + (screen + 1) + "P" + (player + 1) + "N" + (numplayer + 1);
_TextScores[screen, player, numplayer] = "TextScore" + target;
_TextNames[screen, player, numplayer] = "TextName" + target;
texts.Add(_TextScores[player, numplayer]); texts.Add(_TextScores[screen, player, numplayer]);
texts.Add(_TextNames[player, numplayer]); texts.Add(_TextNames[screen, player, numplayer]);
}
} }
} }
} }
@@ -826,21 +839,24 @@ namespace Vocaluxe.Screens
private void _BuildStaticStrings(ref List<string> statics) private void _BuildStaticStrings(ref List<string> statics)
{ {
_StaticScores = new string[CSettings.MaxNumPlayer, CSettings.MaxNumPlayer]; _StaticScores = new string[CSettings.MaxNumScreens, CSettings.MaxNumPlayer, CSettings.MaxNumPlayer];
_StaticAvatars = new string[CSettings.MaxNumPlayer, CSettings.MaxNumPlayer]; _StaticAvatars = new string[CSettings.MaxNumScreens, CSettings.MaxNumPlayer, CSettings.MaxNumPlayer];
for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++) for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
{ {
for (int player = 0; player < CSettings.MaxNumPlayer; player++) for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
{ {
if (player <= numplayer) for (int player = 0; player < CSettings.MaxNumPlayer; player++)
{ {
string target = "P" + (player + 1) + "N" + (numplayer + 1); if (player <= numplayer)
_StaticScores[player, numplayer] = "StaticScore" + target; {
_StaticAvatars[player, numplayer] = "StaticAvatar" + target; string target = "S" + (screen + 1) + "P" + (player + 1) + "N" + (numplayer + 1);
_StaticScores[screen, player, numplayer] = "StaticScore" + target;
_StaticAvatars[screen, player, numplayer] = "StaticAvatar" + target;
statics.Add(_StaticScores[player, numplayer]); statics.Add(_StaticScores[screen, player, numplayer]);
statics.Add(_StaticAvatars[player, numplayer]); statics.Add(_StaticAvatars[screen, player, numplayer]);
}
} }
} }
} }
@@ -886,22 +902,34 @@ namespace Vocaluxe.Screens
_Texts[tx].Visible = n == curN; _Texts[tx].Visible = n == curN;
} }
for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++) for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
{ {
for (int player = 0; player < CSettings.MaxNumPlayer && player <= numplayer; player++) for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
{ {
bool isIvisible = numplayer + 1 == CGame.NumPlayers && player <= CGame.NumPlayers; for (int player = 0; player < CSettings.MaxNumPlayer && player <= numplayer; player++)
_Texts[_TextScores[player, numplayer]].Visible = isIvisible; {
_Texts[_TextNames[player, numplayer]].Visible = isIvisible && _Texts[_TextScores[screen, player, numplayer]].AllMonitors = false;
(CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || _Texts[_TextScores[screen, player, numplayer]].Visible = false;
CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_NAME); _Texts[_TextNames[screen, player, numplayer]].AllMonitors = false;
_Statics[_StaticScores[player, numplayer]].Visible = isIvisible; _Texts[_TextNames[screen, player, numplayer]].Visible = false;
_Statics[_StaticAvatars[player, numplayer]].Visible = isIvisible && _Statics[_StaticScores[screen, player, numplayer]].AllMonitors = false;
(CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || _Statics[_StaticScores[screen, player, numplayer]].Visible = false;
CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_AVATAR); _Statics[_StaticAvatars[screen, player, numplayer]].AllMonitors = false;
_Statics[_StaticAvatars[screen, player, numplayer]].Visible = false;
}
} }
} }
for (int player = 0; player < CGame.NumPlayers; player++)
{
_Texts[_PlayerTextScore[player]].Visible = true;
_Texts[_PlayerTextName[player]].Visible = (CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH ||
CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_NAME);
_Statics[_PlayerStaticScore[player]].Visible = true;
_Statics[_PlayerStaticAvatar[player]].Visible = (CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH ||
CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_AVATAR);
}
_Lyrics[_LyricMain].Alpha = 0f; _Lyrics[_LyricMain].Alpha = 0f;
_Lyrics[_LyricSub].Alpha = 0f; _Lyrics[_LyricSub].Alpha = 0f;
@@ -1355,9 +1383,9 @@ namespace Vocaluxe.Screens
for (int i = 0; i < CGame.NumPlayers; i++) for (int i = 0; i < CGame.NumPlayers; i++)
{ {
if (CProfiles.IsProfileIDValid(CGame.Players[i].ProfileID)) if (CProfiles.IsProfileIDValid(CGame.Players[i].ProfileID))
_Statics[_StaticAvatars[i, CGame.NumPlayers - 1]].Texture = CProfiles.GetAvatarTextureFromProfile(CGame.Players[i].ProfileID); _Statics[_PlayerStaticAvatar[i]].Texture = CProfiles.GetAvatarTextureFromProfile(CGame.Players[i].ProfileID);
else else
_Statics[_StaticAvatars[i, CGame.NumPlayers - 1]].Visible = false; _Statics[_PlayerStaticAvatar[i]].Visible = false;
} }
} }
@@ -1366,9 +1394,59 @@ namespace Vocaluxe.Screens
for (int i = 0; i < CGame.NumPlayers; i++) for (int i = 0; i < CGame.NumPlayers; i++)
{ {
if (CProfiles.IsProfileIDValid(CGame.Players[i].ProfileID)) if (CProfiles.IsProfileIDValid(CGame.Players[i].ProfileID))
_Texts[_TextNames[i, CGame.NumPlayers - 1]].Text = CProfiles.GetPlayerName(CGame.Players[i].ProfileID); _Texts[_PlayerTextName[i]].Text = CProfiles.GetPlayerName(CGame.Players[i].ProfileID);
else else
_Texts[_TextNames[i, CGame.NumPlayers - 1]].Visible = false; _Texts[_PlayerTextName[i]].Visible = false;
}
}
private void _AssignPlayerElements()
{
_PlayerTextScore = new String[CGame.NumPlayers];
_PlayerTextName = new String[CGame.NumPlayers];
_PlayerStaticAvatar = new String[CGame.NumPlayers];
_PlayerStaticScore = new String[CGame.NumPlayers];
int screenPlayers = CGame.NumPlayers / CConfig.GetNumScreens();
int remainingPlayers = CGame.NumPlayers - (screenPlayers * CConfig.GetNumScreens());
int player = 0;
for (int s = 0; s < CConfig.GetNumScreens(); s++)
{
for (int p = 0; p < screenPlayers; p++)
{
if (remainingPlayers > 0)
{
_PlayerTextScore[player] = _TextScores[s, p, screenPlayers];
_PlayerTextName[player] = _TextNames[s, p, screenPlayers];
_PlayerStaticAvatar[player] = _StaticAvatars[s, p, screenPlayers];
_PlayerStaticScore[player++] = _StaticScores[s, p, screenPlayers];
if (p == screenPlayers - 1)
{
_PlayerTextScore[player] = _TextScores[s, p + 1, screenPlayers];
_PlayerTextName[player] = _TextNames[s, p + 1, screenPlayers];
_PlayerStaticAvatar[player] = _StaticAvatars[s, p + 1, screenPlayers];
_PlayerStaticScore[player++] = _StaticScores[s, p + 1, screenPlayers];
remainingPlayers--;
}
}
else
{
_PlayerTextScore[player] = _TextScores[s, p, screenPlayers - 1];
_PlayerTextName[player] = _TextNames[s, p, screenPlayers - 1];
_PlayerStaticAvatar[player] = _StaticAvatars[s, p, screenPlayers - 1];
_PlayerStaticScore[player++] = _StaticScores[s, p, screenPlayers - 1];
}
}
//Handle when players < screens
if (screenPlayers == 0 && remainingPlayers > 0)
{
_PlayerTextScore[player] = _TextScores[s, 0, 0];
_PlayerTextName[player] = _TextNames[s, 0, 0];
_PlayerStaticAvatar[player] = _StaticAvatars[s, 0, 0];
_PlayerStaticScore[player++] = _StaticScores[s, 0, 0];
remainingPlayers--;
}
} }
} }
} }
+6 -5
View File
@@ -83,6 +83,7 @@ namespace VocaluxeLib
int GetNumNoteLines(); int GetNumNoteLines();
int GetMaxNumPlayer(); int GetMaxNumPlayer();
int GetMaxNumScreens();
float GetDefaultMedleyFadeInTime(); float GetDefaultMedleyFadeInTime();
float GetDefaultMedleyFadeOutTime(); float GetDefaultMedleyFadeOutTime();
@@ -135,17 +136,17 @@ namespace VocaluxeLib
public interface IDrawing public interface IDrawing
{ {
void DrawTexture(CTextureRef texture, SRectF rect); void DrawTexture(CTextureRef texture, SRectF rect);
void DrawTexture(CTextureRef texture, SRectF rect, SColorF color); void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, bool allMonitors = true);
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, bool allMonitors = true);
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, SRectF bounds, float reflectionSpace, float reflectionHeight); void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, float reflectionSpace, float reflectionHeight, bool allMonitors = true);
CTextureRef AddTexture(string fileName); CTextureRef AddTexture(string fileName);
CTextureRef EnqueueTexture(string fileName); CTextureRef EnqueueTexture(string fileName);
void RemoveTexture(ref CTextureRef texture); void RemoveTexture(ref CTextureRef texture);
void DrawRect(SColorF color, SRectF rect); void DrawRect(SColorF color, SRectF rect, bool allMonitors = true);
void DrawRectReflection(SColorF color, SRectF rect, float space, float height); void DrawRectReflection(SColorF color, SRectF rect, float space, float height);
} }
@@ -174,7 +175,7 @@ namespace VocaluxeLib
{ {
RectangleF GetTextBounds(CText text); RectangleF GetTextBounds(CText text);
void DrawText(string text, CFont font, float x, float y, float z, SColorF color); void DrawText(string text, CFont font, float x, float y, float z, SColorF color, bool allMonitors = true);
void DrawTextReflection(string text, CFont font, float x, float y, float z, SColorF color, float reflectionSpace, float reflectionHeight); void DrawTextReflection(string text, CFont font, float x, float y, float z, SColorF color, float reflectionSpace, float reflectionHeight);
void DrawText(string text, CFont font, float x, float y, float z, SColorF color, float begin, float end); void DrawText(string text, CFont font, float x, float y, float z, SColorF color, float begin, float end);
} }
+3 -3
View File
@@ -265,14 +265,14 @@ namespace VocaluxeLib.Menu
_Timer.Start(); _Timer.Start();
} }
public void Draw() public void Draw(bool allMonitors = true)
{ {
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression // ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (!String.IsNullOrEmpty(_TextureName)) if (!String.IsNullOrEmpty(_TextureName))
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression // ReSharper restore ConvertIfStatementToConditionalTernaryExpression
CBase.Drawing.DrawTexture(CBase.Themes.GetSkinTexture(_TextureName, _PartyModeID), _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha)); CBase.Drawing.DrawTexture(CBase.Themes.GetSkinTexture(_TextureName, _PartyModeID), _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha), allMonitors);
else else
CBase.Drawing.DrawTexture(_Texture, _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha)); CBase.Drawing.DrawTexture(_Texture, _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha), allMonitors);
} }
} }
} }
+4 -1
View File
@@ -36,6 +36,7 @@ namespace VocaluxeLib.Menu
public EParticleType Type; public EParticleType Type;
public float Size; public float Size;
public int MaxNumber; public int MaxNumber;
public bool? AllMonitors;
} }
public enum EParticleType public enum EParticleType
@@ -61,6 +62,8 @@ namespace VocaluxeLib.Menu
public float Alpha = 1f; public float Alpha = 1f;
public bool AllMonitors = true;
public string GetThemeName() public string GetThemeName()
{ {
return _Theme.Name; return _Theme.Name;
@@ -302,7 +305,7 @@ namespace VocaluxeLib.Menu
foreach (CParticle star in _Stars) foreach (CParticle star in _Stars)
{ {
star.Alpha2 = Alpha; star.Alpha2 = Alpha;
star.Draw(); star.Draw(AllMonitors);
} }
} }
+6 -2
View File
@@ -32,6 +32,7 @@ namespace VocaluxeLib.Menu
public SThemeColor Color; public SThemeColor Color;
public SRectF Rect; public SRectF Rect;
public SReflection? Reflection; public SReflection? Reflection;
public bool? AllMonitors;
} }
public sealed class CStatic : CMenuElementBase, IMenuElement, IThemeable public sealed class CStatic : CMenuElementBase, IMenuElement, IThemeable
@@ -66,6 +67,8 @@ namespace VocaluxeLib.Menu
public float ReflectionSpace; public float ReflectionSpace;
public float ReflectionHeight; public float ReflectionHeight;
public bool AllMonitors = true;
public float Alpha = 1; public float Alpha = 1;
public EAspect Aspect = EAspect.Stretch; public EAspect Aspect = EAspect.Stretch;
@@ -85,6 +88,7 @@ namespace VocaluxeLib.Menu
Reflection = s.Reflection; Reflection = s.Reflection;
ReflectionSpace = s.ReflectionHeight; ReflectionSpace = s.ReflectionHeight;
ReflectionHeight = s.ReflectionSpace; ReflectionHeight = s.ReflectionSpace;
AllMonitors = s.AllMonitors;
Alpha = s.Alpha; Alpha = s.Alpha;
Visible = s.Visible; Visible = s.Visible;
@@ -176,9 +180,9 @@ namespace VocaluxeLib.Menu
{ {
if (texture != null) if (texture != null)
{ {
CBase.Drawing.DrawTexture(texture, rect, color, bounds); CBase.Drawing.DrawTexture(texture, rect, color, bounds, false, AllMonitors);
if (Reflection) if (Reflection)
CBase.Drawing.DrawTextureReflection(texture, rect, color, bounds, ReflectionSpace, ReflectionHeight); CBase.Drawing.DrawTextureReflection(texture, rect, color, bounds, ReflectionSpace, ReflectionHeight, AllMonitors);
} }
else else
CBase.Drawing.DrawRect(color, rect); CBase.Drawing.DrawRect(color, rect);
+5 -1
View File
@@ -45,6 +45,7 @@ namespace VocaluxeLib.Menu
public string FontFamily; public string FontFamily;
public string Text; public string Text;
public SReflection? Reflection; public SReflection? Reflection;
public bool? AllMonitors;
} }
public sealed class CText : CMenuElementBase, IMenuElement, IThemeable, IFontObserver public sealed class CText : CMenuElementBase, IMenuElement, IThemeable, IFontObserver
@@ -167,6 +168,8 @@ namespace VocaluxeLib.Menu
private float _ReflectionSpace; private float _ReflectionSpace;
private float _ReflectionHeight; private float _ReflectionHeight;
public bool AllMonitors = true;
private string _Text = String.Empty; private string _Text = String.Empty;
public string Text public string Text
{ {
@@ -254,6 +257,7 @@ namespace VocaluxeLib.Menu
SelColor = text.SelColor; SelColor = text.SelColor;
_ReflectionSpace = text._ReflectionSpace; _ReflectionSpace = text._ReflectionSpace;
_ReflectionHeight = text._ReflectionHeight; _ReflectionHeight = text._ReflectionHeight;
AllMonitors = text.AllMonitors;
Text = text.Text; Text = text.Text;
Visible = text.Visible; Visible = text.Visible;
@@ -388,7 +392,7 @@ namespace VocaluxeLib.Menu
SColorF currentColor = (Selected) ? SelColor : Color; SColorF currentColor = (Selected) ? SelColor : Color;
var color = new SColorF(currentColor.R, currentColor.G, currentColor.B, currentColor.A * Alpha); var color = new SColorF(currentColor.R, currentColor.G, currentColor.B, currentColor.A * Alpha);
CBase.Fonts.DrawText(_Text, CalculatedFont, Rect.X, Rect.Y, Z, color); CBase.Fonts.DrawText(_Text, CalculatedFont, Rect.X, Rect.Y, Z, color, AllMonitors);
if (_ReflectionHeight > 0) if (_ReflectionHeight > 0)
CBase.Fonts.DrawTextReflection(_Text, CalculatedFont, Rect.X, Rect.Y, Z, color, _ReflectionSpace, _ReflectionHeight); CBase.Fonts.DrawTextReflection(_Text, CalculatedFont, Rect.X, Rect.Y, Z, color, _ReflectionSpace, _ReflectionHeight);
+14 -10
View File
@@ -187,7 +187,7 @@ namespace VocaluxeLib.Menu.SingNotes
for (int i = 0; i < CBase.Settings.GetNumNoteLines(); i++) for (int i = 0; i < CBase.Settings.GetNumNoteLines(); i++)
{ {
lineRect.Y = Rect.Y + Rect.H / CBase.Settings.GetNumNoteLines() * (i + 1); lineRect.Y = Rect.Y + Rect.H / CBase.Settings.GetNumNoteLines() * (i + 1);
CBase.Drawing.DrawRect(color, lineRect); CBase.Drawing.DrawRect(color, lineRect, false);
} }
} }
@@ -218,7 +218,7 @@ namespace VocaluxeLib.Menu.SingNotes
var color = new SColorF(_Color, _Color.A * Alpha); var color = new SColorF(_Color, _Color.A * Alpha);
CTextureRef toneHelper = CBase.Themes.GetSkinTexture(_Theme.SkinToneHelper, _PartyModeID); CTextureRef toneHelper = CBase.Themes.GetSkinTexture(_Theme.SkinToneHelper, _PartyModeID);
CBase.Drawing.DrawTexture(toneHelper, drawRect, color); CBase.Drawing.DrawTexture(toneHelper, drawRect, color, false);
} }
private void _DrawNote(SRectF rect, SColorF color, float factor) private void _DrawNote(SRectF rect, SColorF color, float factor)
@@ -239,15 +239,15 @@ namespace VocaluxeLib.Menu.SingNotes
//Need 2 of them so use minimum //Need 2 of them so use minimum
float endsW = Math.Min(noteRect.H * noteBegin.OrigAspect, noteRect.W / 2); float endsW = Math.Min(noteRect.H * noteBegin.OrigAspect, noteRect.W / 2);
CBase.Drawing.DrawTexture(noteBegin, new SRectF(noteRect.X, noteRect.Y, endsW, noteRect.H, noteRect.Z), color); CBase.Drawing.DrawTexture(noteBegin, new SRectF(noteRect.X, noteRect.Y, endsW, noteRect.H, noteRect.Z), color, false);
var middleRect = new SRectF(noteRect.X + endsW, noteRect.Y, noteRect.W - 2 * endsW, noteRect.H, noteRect.Z); var middleRect = new SRectF(noteRect.X + endsW, noteRect.Y, noteRect.W - 2 * endsW, noteRect.H, noteRect.Z);
if (noteRect.W >= 4 * endsW) if (noteRect.W >= 4 * endsW)
CBase.Drawing.DrawTexture(noteMiddle, middleRect, color); CBase.Drawing.DrawTexture(noteMiddle, middleRect, color, false);
else else
CBase.Drawing.DrawTexture(noteMiddle, new SRectF(middleRect.X, middleRect.Y, 2 * endsW, middleRect.H, middleRect.Z), color, middleRect); CBase.Drawing.DrawTexture(noteMiddle, new SRectF(middleRect.X, middleRect.Y, 2 * endsW, middleRect.H, middleRect.Z), color, middleRect, false, false);
CBase.Drawing.DrawTexture(noteEnd, new SRectF(noteRect.X + noteRect.W - endsW, noteRect.Y, endsW, noteRect.H, noteRect.Z), color); CBase.Drawing.DrawTexture(noteEnd, new SRectF(noteRect.X + noteRect.W - endsW, noteRect.Y, endsW, noteRect.H, noteRect.Z), color, false);
} }
private void _DrawNoteBG(SRectF noteRect, SColorF color) private void _DrawNoteBG(SRectF noteRect, SColorF color)
@@ -272,23 +272,24 @@ namespace VocaluxeLib.Menu.SingNotes
var col = new SColorF(color, color.A * alpha); var col = new SColorF(color, color.A * alpha);
CBase.Drawing.DrawTexture(noteBackgroundBegin, new SRectF(noteRect.X, noteRect.Y, dx, noteRect.H, noteRect.Z), col); CBase.Drawing.DrawTexture(noteBackgroundBegin, new SRectF(noteRect.X, noteRect.Y, dx, noteRect.H, noteRect.Z), col, false);
if (noteRect.W - 2 * dx >= 2 * dx) if (noteRect.W - 2 * dx >= 2 * dx)
CBase.Drawing.DrawTexture(noteBackgroundMiddle, new SRectF(noteRect.X + dx, noteRect.Y, noteRect.W - 2 * dx, noteRect.H, noteRect.Z), col); CBase.Drawing.DrawTexture(noteBackgroundMiddle, new SRectF(noteRect.X + dx, noteRect.Y, noteRect.W - 2 * dx, noteRect.H, noteRect.Z), col, false);
else else
{ {
CBase.Drawing.DrawTexture(noteBackgroundMiddle, new SRectF(noteRect.X + dx, noteRect.Y, 2 * dx, noteRect.H, noteRect.Z), col, CBase.Drawing.DrawTexture(noteBackgroundMiddle, new SRectF(noteRect.X + dx, noteRect.Y, 2 * dx, noteRect.H, noteRect.Z), col,
new SRectF(noteRect.X + dx, noteRect.Y, noteRect.W - 2 * dx, noteRect.H, noteRect.Z)); new SRectF(noteRect.X + dx, noteRect.Y, noteRect.W - 2 * dx, noteRect.H, noteRect.Z), false, false);
} }
CBase.Drawing.DrawTexture(noteBackgroundEnd, new SRectF(noteRect.X + noteRect.W - dx, noteRect.Y, dx, noteRect.H, noteRect.Z), col); CBase.Drawing.DrawTexture(noteBackgroundEnd, new SRectF(noteRect.X + noteRect.W - dx, noteRect.Y, dx, noteRect.H, noteRect.Z), col, false);
} }
private void _AddGoldenNote(SRectF noteRect) private void _AddGoldenNote(SRectF noteRect)
{ {
var numstars = (int)(noteRect.W * 0.25f); var numstars = (int)(noteRect.W * 0.25f);
var stars = new CParticleEffect(_PartyModeID, numstars, new SColorF(Color.Yellow), noteRect, _Theme.SkinGoldenStar, 20, EParticleType.Star); var stars = new CParticleEffect(_PartyModeID, numstars, new SColorF(Color.Yellow), noteRect, _Theme.SkinGoldenStar, 20, EParticleType.Star);
stars.AllMonitors = false;
_GoldenStars.Add(stars); _GoldenStars.Add(stars);
} }
@@ -297,6 +298,7 @@ namespace VocaluxeLib.Menu.SingNotes
var rect = new SRectF(noteRect.Right, noteRect.Y, 0f, noteRect.H, noteRect.Z); var rect = new SRectF(noteRect.Right, noteRect.Y, 0f, noteRect.H, noteRect.Z);
var flares = new CParticleEffect(_PartyModeID, 15, new SColorF(Color.White), rect, _Theme.SkinGoldenStar, 20, EParticleType.Flare); var flares = new CParticleEffect(_PartyModeID, 15, new SColorF(Color.White), rect, _Theme.SkinGoldenStar, 20, EParticleType.Flare);
flares.AllMonitors = false;
_Flares.Add(flares); _Flares.Add(flares);
} }
@@ -311,12 +313,14 @@ namespace VocaluxeLib.Menu.SingNotes
var stars = new CParticleEffect(_PartyModeID, CBase.Game.GetRandom(2) + 1, new SColorF(Color.White), r, _Theme.SkinPerfectNoteStart, 35, var stars = new CParticleEffect(_PartyModeID, CBase.Game.GetRandom(2) + 1, new SColorF(Color.White), r, _Theme.SkinPerfectNoteStart, 35,
EParticleType.PerfNoteStar); EParticleType.PerfNoteStar);
stars.AllMonitors = false;
_PerfectNoteEffect.Add(stars); _PerfectNoteEffect.Add(stars);
} }
private void _AddPerfectLine() private void _AddPerfectLine()
{ {
var twinkle = new CParticleEffect(_PartyModeID, 200, _Color, Rect, _Theme.SkinGoldenStar, 25, EParticleType.Twinkle); var twinkle = new CParticleEffect(_PartyModeID, 200, _Color, Rect, _Theme.SkinGoldenStar, 25, EParticleType.Twinkle);
twinkle.AllMonitors = false;
_PerfectLineTwinkle.Add(twinkle); _PerfectLineTwinkle.Add(twinkle);
} }
} }
+68 -27
View File
@@ -27,14 +27,16 @@ namespace VocaluxeLib.Menu.SingNotes
[XmlType("Position")] [XmlType("Position")]
public struct SBarPosition public struct SBarPosition
{ {
[XmlAttribute(AttributeName = "Name")] public string Name; [XmlAttribute(AttributeName = "Name")]
public string Name;
public SRectF Rect; public SRectF Rect;
} }
[XmlType("SingBar")] [XmlType("SingBar")]
public struct SThemeSingBar public struct SThemeSingBar
{ {
[XmlAttribute(AttributeName = "Name")] public string Name; [XmlAttribute(AttributeName = "Name")]
public string Name;
public string SkinLeft; public string SkinLeft;
public string SkinMiddle; public string SkinMiddle;
@@ -48,7 +50,8 @@ namespace VocaluxeLib.Menu.SingNotes
public string SkinToneHelper; public string SkinToneHelper;
public string SkinPerfectNoteStart; public string SkinPerfectNoteStart;
[XmlArray("BarPositions")] public SBarPosition[] BarPos; [XmlArray("BarPositions")]
public SBarPosition[] BarPos;
} }
public class CSingNotes : CMenuElementBase, IMenuElement, IThemeable public class CSingNotes : CMenuElementBase, IMenuElement, IThemeable
@@ -75,12 +78,12 @@ namespace VocaluxeLib.Menu.SingNotes
/// <remarks> /// <remarks>
/// first index = player number; second index = num players seen on screen /// first index = player number; second index = num players seen on screen
/// </remarks> /// </remarks>
private SRectF[,] _BarPos { get; set; } private SRectF[,,] _BarPos { get; set; }
public CSingNotes(int partyModeID) public CSingNotes(int partyModeID)
{ {
_PartyModeID = partyModeID; _PartyModeID = partyModeID;
_Theme = new SThemeSingBar {BarPos = new SBarPosition[CHelper.Sum(CBase.Settings.GetMaxNumPlayer())]}; _Theme = new SThemeSingBar { BarPos = new SBarPosition[CHelper.Sum(CBase.Settings.GetMaxNumPlayer() * CBase.Settings.GetMaxNumScreens())] };
ThemeLoaded = false; ThemeLoaded = false;
} }
@@ -89,7 +92,7 @@ namespace VocaluxeLib.Menu.SingNotes
_PartyModeID = partyModeID; _PartyModeID = partyModeID;
_Theme = theme; _Theme = theme;
_BarPos = new SRectF[CBase.Settings.GetMaxNumPlayer(),CBase.Settings.GetMaxNumPlayer()]; _BarPos = new SRectF[CBase.Settings.GetMaxNumScreens(), CBase.Settings.GetMaxNumPlayer(), CBase.Settings.GetMaxNumPlayer()];
ThemeLoaded = true; ThemeLoaded = true;
} }
@@ -119,21 +122,24 @@ namespace VocaluxeLib.Menu.SingNotes
ThemeLoaded &= xmlReader.GetValue(item + "/SkinPerfectNoteStar", out _Theme.SkinPerfectNoteStart, String.Empty); ThemeLoaded &= xmlReader.GetValue(item + "/SkinPerfectNoteStar", out _Theme.SkinPerfectNoteStart, String.Empty);
int i = 0; int i = 0;
_BarPos = new SRectF[CBase.Settings.GetMaxNumPlayer(),CBase.Settings.GetMaxNumPlayer()]; _BarPos = new SRectF[CBase.Settings.GetMaxNumScreens(), CBase.Settings.GetMaxNumPlayer(), CBase.Settings.GetMaxNumPlayer()];
for (int numplayer = 0; numplayer < CBase.Settings.GetMaxNumPlayer(); numplayer++) for (int numplayer = 0; numplayer < CBase.Settings.GetMaxNumPlayer(); numplayer++)
{ {
for (int player = 0; player <= numplayer; player++) for (int screen = 0; screen < CBase.Settings.GetMaxNumScreens(); screen++)
{ {
_BarPos[player, numplayer] = new SRectF(); for (int player = 0; player <= numplayer; player++)
string target = "/BarPositions/P" + (player + 1) + "N" + (numplayer + 1); {
ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "X", ref _BarPos[player, numplayer].X); _BarPos[screen, player, numplayer] = new SRectF();
ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Y", ref _BarPos[player, numplayer].Y); string target = "/BarPositions/S" + (screen + 1) + "P" + (player + 1) + "N" + (numplayer + 1);
ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Z", ref _BarPos[player, numplayer].Z); ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "X", ref _BarPos[screen, player, numplayer].X);
ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "W", ref _BarPos[player, numplayer].W); ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Y", ref _BarPos[screen, player, numplayer].Y);
ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "H", ref _BarPos[player, numplayer].H); ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Z", ref _BarPos[screen, player, numplayer].Z);
_Theme.BarPos[i].Name = "P" + (player + 1) + "N" + (numplayer + 1); ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "W", ref _BarPos[screen, player, numplayer].W);
_Theme.BarPos[i].Rect = _BarPos[player, numplayer]; ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "H", ref _BarPos[screen, player, numplayer].H);
i++; _Theme.BarPos[i].Name = "S" + (screen + 1) + "P" + (player + 1) + "N" + (numplayer + 1);
_Theme.BarPos[i].Rect = _BarPos[screen, player, numplayer];
i++;
}
} }
} }
@@ -146,11 +152,45 @@ namespace VocaluxeLib.Menu.SingNotes
return ThemeLoaded; return ThemeLoaded;
} }
public void Init(int numPlayers) public void Init(int numPlayers, int numScreens = 0)
{ {
PlayerNotes.Clear(); PlayerNotes.Clear();
for (int p = 0; p < numPlayers; p++) if (numPlayers > 0 && numScreens > 0)
PlayerNotes.Add(new CNoteBars(_PartyModeID, p, _BarPos[p, numPlayers - 1], _Theme)); {
int[] screenAssignment = new int[numPlayers];
int screenPlayers = numPlayers / numScreens;
int remainingPlayers = numPlayers - (screenPlayers * numScreens);
int player = 0;
for (int s = 0; s < numScreens; s++)
{
for (int p = 0; p < screenPlayers; p++)
{
if (remainingPlayers > 0)
{
PlayerNotes.Add(new CNoteBars(_PartyModeID, player++, _BarPos[s, p, screenPlayers], _Theme));
if (p == screenPlayers - 1)
{
PlayerNotes.Add(new CNoteBars(_PartyModeID, player++, _BarPos[s, p + 1, screenPlayers], _Theme));
remainingPlayers--;
}
}
else
{
PlayerNotes.Add(new CNoteBars(_PartyModeID, player++, _BarPos[s, p, screenPlayers - 1], _Theme));
}
}
//Handle when players < screens
if (screenPlayers == 0 && remainingPlayers > 0)
{
PlayerNotes.Add(new CNoteBars(_PartyModeID, player++, _BarPos[s, 0, 0], _Theme));
remainingPlayers--;
}
}
}
if (numPlayers == 0) if (numPlayers == 0)
_Rect = new SRectF(0, 0, 0, 0, Rect.Z); _Rect = new SRectF(0, 0, 0, 0, Rect.Z);
else else
@@ -169,7 +209,7 @@ namespace VocaluxeLib.Menu.SingNotes
noteBars.Draw(); noteBars.Draw();
} }
public void UnloadSkin() {} public void UnloadSkin() { }
public void LoadSkin() public void LoadSkin()
{ {
@@ -181,10 +221,11 @@ namespace VocaluxeLib.Menu.SingNotes
Z = _Theme.BarPos.Select(bp => bp.Rect.Z).Average(); Z = _Theme.BarPos.Select(bp => bp.Rect.Z).Average();
foreach (SBarPosition bp in _Theme.BarPos) foreach (SBarPosition bp in _Theme.BarPos)
{ {
int n = Int32.Parse(bp.Name.Substring(3, 1)) - 1; int p = Int32.Parse(bp.Name.Substring(3, 1)) - 1;
int p = Int32.Parse(bp.Name.Substring(1, 1)) - 1; int s = Int32.Parse(bp.Name.Substring(1, 1)) - 1;
int n = Int32.Parse(bp.Name.Substring(5, 1)) - 1;
_BarPos[p, n] = bp.Rect; _BarPos[s, p, n] = bp.Rect;
} }
} }
@@ -200,9 +241,9 @@ namespace VocaluxeLib.Menu.SingNotes
} }
#region ThemeEdit #region ThemeEdit
public void MoveElement(int stepX, int stepY) {} public void MoveElement(int stepX, int stepY) { }
public void ResizeElement(int stepW, int stepH) {} public void ResizeElement(int stepW, int stepH) { }
#endregion ThemeEdit #endregion ThemeEdit
} }
} }