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

+3 -3
View File
@@ -265,14 +265,14 @@ namespace VocaluxeLib.Menu
_Timer.Start();
}
public void Draw()
public void Draw(bool allMonitors = true)
{
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (!String.IsNullOrEmpty(_TextureName))
// 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
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 float Size;
public int MaxNumber;
public bool? AllMonitors;
}
public enum EParticleType
@@ -61,6 +62,8 @@ namespace VocaluxeLib.Menu
public float Alpha = 1f;
public bool AllMonitors = true;
public string GetThemeName()
{
return _Theme.Name;
@@ -302,7 +305,7 @@ namespace VocaluxeLib.Menu
foreach (CParticle star in _Stars)
{
star.Alpha2 = Alpha;
star.Draw();
star.Draw(AllMonitors);
}
}
+6 -2
View File
@@ -32,6 +32,7 @@ namespace VocaluxeLib.Menu
public SThemeColor Color;
public SRectF Rect;
public SReflection? Reflection;
public bool? AllMonitors;
}
public sealed class CStatic : CMenuElementBase, IMenuElement, IThemeable
@@ -66,6 +67,8 @@ namespace VocaluxeLib.Menu
public float ReflectionSpace;
public float ReflectionHeight;
public bool AllMonitors = true;
public float Alpha = 1;
public EAspect Aspect = EAspect.Stretch;
@@ -85,6 +88,7 @@ namespace VocaluxeLib.Menu
Reflection = s.Reflection;
ReflectionSpace = s.ReflectionHeight;
ReflectionHeight = s.ReflectionSpace;
AllMonitors = s.AllMonitors;
Alpha = s.Alpha;
Visible = s.Visible;
@@ -176,9 +180,9 @@ namespace VocaluxeLib.Menu
{
if (texture != null)
{
CBase.Drawing.DrawTexture(texture, rect, color, bounds);
CBase.Drawing.DrawTexture(texture, rect, color, bounds, false, AllMonitors);
if (Reflection)
CBase.Drawing.DrawTextureReflection(texture, rect, color, bounds, ReflectionSpace, ReflectionHeight);
CBase.Drawing.DrawTextureReflection(texture, rect, color, bounds, ReflectionSpace, ReflectionHeight, AllMonitors);
}
else
CBase.Drawing.DrawRect(color, rect);
+5 -1
View File
@@ -45,6 +45,7 @@ namespace VocaluxeLib.Menu
public string FontFamily;
public string Text;
public SReflection? Reflection;
public bool? AllMonitors;
}
public sealed class CText : CMenuElementBase, IMenuElement, IThemeable, IFontObserver
@@ -167,6 +168,8 @@ namespace VocaluxeLib.Menu
private float _ReflectionSpace;
private float _ReflectionHeight;
public bool AllMonitors = true;
private string _Text = String.Empty;
public string Text
{
@@ -254,6 +257,7 @@ namespace VocaluxeLib.Menu
SelColor = text.SelColor;
_ReflectionSpace = text._ReflectionSpace;
_ReflectionHeight = text._ReflectionHeight;
AllMonitors = text.AllMonitors;
Text = text.Text;
Visible = text.Visible;
@@ -388,7 +392,7 @@ namespace VocaluxeLib.Menu
SColorF currentColor = (Selected) ? SelColor : Color;
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)
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++)
{
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);
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)
@@ -239,15 +239,15 @@ namespace VocaluxeLib.Menu.SingNotes
//Need 2 of them so use minimum
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);
if (noteRect.W >= 4 * endsW)
CBase.Drawing.DrawTexture(noteMiddle, middleRect, color);
CBase.Drawing.DrawTexture(noteMiddle, middleRect, color, false);
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)
@@ -272,23 +272,24 @@ namespace VocaluxeLib.Menu.SingNotes
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)
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
{
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)
{
var numstars = (int)(noteRect.W * 0.25f);
var stars = new CParticleEffect(_PartyModeID, numstars, new SColorF(Color.Yellow), noteRect, _Theme.SkinGoldenStar, 20, EParticleType.Star);
stars.AllMonitors = false;
_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 flares = new CParticleEffect(_PartyModeID, 15, new SColorF(Color.White), rect, _Theme.SkinGoldenStar, 20, EParticleType.Flare);
flares.AllMonitors = false;
_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,
EParticleType.PerfNoteStar);
stars.AllMonitors = false;
_PerfectNoteEffect.Add(stars);
}
private void _AddPerfectLine()
{
var twinkle = new CParticleEffect(_PartyModeID, 200, _Color, Rect, _Theme.SkinGoldenStar, 25, EParticleType.Twinkle);
twinkle.AllMonitors = false;
_PerfectLineTwinkle.Add(twinkle);
}
}
+68 -27
View File
@@ -27,14 +27,16 @@ namespace VocaluxeLib.Menu.SingNotes
[XmlType("Position")]
public struct SBarPosition
{
[XmlAttribute(AttributeName = "Name")] public string Name;
[XmlAttribute(AttributeName = "Name")]
public string Name;
public SRectF Rect;
}
[XmlType("SingBar")]
public struct SThemeSingBar
{
[XmlAttribute(AttributeName = "Name")] public string Name;
[XmlAttribute(AttributeName = "Name")]
public string Name;
public string SkinLeft;
public string SkinMiddle;
@@ -48,7 +50,8 @@ namespace VocaluxeLib.Menu.SingNotes
public string SkinToneHelper;
public string SkinPerfectNoteStart;
[XmlArray("BarPositions")] public SBarPosition[] BarPos;
[XmlArray("BarPositions")]
public SBarPosition[] BarPos;
}
public class CSingNotes : CMenuElementBase, IMenuElement, IThemeable
@@ -75,12 +78,12 @@ namespace VocaluxeLib.Menu.SingNotes
/// <remarks>
/// first index = player number; second index = num players seen on screen
/// </remarks>
private SRectF[,] _BarPos { get; set; }
private SRectF[,,] _BarPos { get; set; }
public CSingNotes(int 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;
}
@@ -89,7 +92,7 @@ namespace VocaluxeLib.Menu.SingNotes
_PartyModeID = partyModeID;
_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;
}
@@ -119,21 +122,24 @@ namespace VocaluxeLib.Menu.SingNotes
ThemeLoaded &= xmlReader.GetValue(item + "/SkinPerfectNoteStar", out _Theme.SkinPerfectNoteStart, String.Empty);
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 player = 0; player <= numplayer; player++)
for (int screen = 0; screen < CBase.Settings.GetMaxNumScreens(); screen++)
{
_BarPos[player, numplayer] = new SRectF();
string target = "/BarPositions/P" + (player + 1) + "N" + (numplayer + 1);
ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "X", ref _BarPos[player, numplayer].X);
ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Y", ref _BarPos[player, numplayer].Y);
ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Z", ref _BarPos[player, numplayer].Z);
ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "W", ref _BarPos[player, numplayer].W);
ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "H", ref _BarPos[player, numplayer].H);
_Theme.BarPos[i].Name = "P" + (player + 1) + "N" + (numplayer + 1);
_Theme.BarPos[i].Rect = _BarPos[player, numplayer];
i++;
for (int player = 0; player <= numplayer; player++)
{
_BarPos[screen, player, numplayer] = new SRectF();
string target = "/BarPositions/S" + (screen + 1) + "P" + (player + 1) + "N" + (numplayer + 1);
ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "X", ref _BarPos[screen, player, numplayer].X);
ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Y", ref _BarPos[screen, player, numplayer].Y);
ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Z", ref _BarPos[screen, player, numplayer].Z);
ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "W", ref _BarPos[screen, player, numplayer].W);
ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "H", ref _BarPos[screen, player, numplayer].H);
_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;
}
public void Init(int numPlayers)
public void Init(int numPlayers, int numScreens = 0)
{
PlayerNotes.Clear();
for (int p = 0; p < numPlayers; p++)
PlayerNotes.Add(new CNoteBars(_PartyModeID, p, _BarPos[p, numPlayers - 1], _Theme));
if (numPlayers > 0 && numScreens > 0)
{
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)
_Rect = new SRectF(0, 0, 0, 0, Rect.Z);
else
@@ -169,7 +209,7 @@ namespace VocaluxeLib.Menu.SingNotes
noteBars.Draw();
}
public void UnloadSkin() {}
public void UnloadSkin() { }
public void LoadSkin()
{
@@ -181,10 +221,11 @@ namespace VocaluxeLib.Menu.SingNotes
Z = _Theme.BarPos.Select(bp => bp.Rect.Z).Average();
foreach (SBarPosition bp in _Theme.BarPos)
{
int n = Int32.Parse(bp.Name.Substring(3, 1)) - 1;
int p = Int32.Parse(bp.Name.Substring(1, 1)) - 1;
int p = Int32.Parse(bp.Name.Substring(3, 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
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
}
}