Added possibility to scroll with mouse through rounds and players.

This commit is contained in:
Florian Kuepper committed 2012-12-24 01:37:34 +01:00
1 parent 2fabc379d1
commit 11f626187d
1 file changed
+25 -1
+25 -1
View File
@@ -221,6 +221,14 @@ namespace Vocaluxe.PartyModes
ShowPopup(false); ShowPopup(false);
} }
if (MouseEvent.Wheel != 0)
{
if(CHelper.IsInBounds(RoundsTableScrollArea, MouseEvent))
ScrollRoundsTable(MouseEvent.Wheel);
if(CHelper.IsInBounds(PlayerTableScrollArea, MouseEvent))
ScrollPlayerTable(MouseEvent.Wheel);
}
return true; return true;
} }
@@ -387,6 +395,8 @@ namespace Vocaluxe.PartyModes
private void BuildRoundsTable() private void BuildRoundsTable()
{ {
RoundsTableScrollArea = new SRectF();
int NumPlayerInOneRow = 3; int NumPlayerInOneRow = 3;
if (GameState.NumPlayerAtOnce <= NumPlayerInOneRow) if (GameState.NumPlayerAtOnce <= NumPlayerInOneRow)
NumRoundsVisible = 5; NumRoundsVisible = 5;
@@ -396,6 +406,10 @@ namespace Vocaluxe.PartyModes
float x = Texts[htTexts(TextRoundNumber)].X; float x = Texts[htTexts(TextRoundNumber)].X;
float y = Texts[htTexts(TextRoundNumber)].Y; float y = Texts[htTexts(TextRoundNumber)].Y;
RoundsTableScrollArea.X = x;
RoundsTableScrollArea.Y = y;
RoundsTableScrollArea.W = _Base.Settings.GetRenderW() - Texts[htTexts(TextRoundNumber)].X - 20;
float delta = Texts[htTexts(TextRoundNumber)].Height; float delta = Texts[htTexts(TextRoundNumber)].Height;
//Update statics and texts for rounds //Update statics and texts for rounds
@@ -432,6 +446,7 @@ namespace Vocaluxe.PartyModes
} }
y = y + delta / 2; y = y + delta / 2;
} }
RoundsTableScrollArea.H = y - RoundsTableScrollArea.Y;
} }
private void UpdateRoundsTable() private void UpdateRoundsTable()
@@ -441,7 +456,7 @@ namespace Vocaluxe.PartyModes
{ {
for(int p = 0; p < RoundsTable[i].TextPlayer.Count; p++) for(int p = 0; p < RoundsTable[i].TextPlayer.Count; p++)
{ {
if (GameState.Combs[i + RoundsTableOffset].Player.Count > p) if (GameState.Combs.Count > i + RoundsTableOffset && GameState.Combs[i + RoundsTableOffset].Player.Count > p)
{ {
RoundsTable[i].Number.Visible = true; RoundsTable[i].Number.Visible = true;
RoundsTable[i].TextPlayer[p].Visible = true; RoundsTable[i].TextPlayer[p].Visible = true;
@@ -469,10 +484,16 @@ namespace Vocaluxe.PartyModes
private void BuildPlayerTable() private void BuildPlayerTable()
{ {
PlayerTableScrollArea = new SRectF();
PlayerTableScrollArea.X = Texts[htTexts(TextPosition)].X;
PlayerTableScrollArea.Y = Texts[htTexts(TextPosition)].Y;
PlayerTableScrollArea.W = Texts[htTexts(TextGamePoints)].X - Texts[htTexts(TextPosition)].X;
PlayerTable = new List<TableRow>(); PlayerTable = new List<TableRow>();
float delta = Texts[htTexts(TextPosition)].Height * 1.2f; float delta = Texts[htTexts(TextPosition)].Height * 1.2f;
float h = 0;
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
{ {
TableRow row = new TableRow(); TableRow row = new TableRow();
@@ -508,7 +529,10 @@ namespace Vocaluxe.PartyModes
AddText(row.GamePoints); AddText(row.GamePoints);
PlayerTable.Add(row); PlayerTable.Add(row);
h = delta * (i + 1);
} }
PlayerTableScrollArea.H = h + delta;
} }
private void UpdatePlayerTable() private void UpdatePlayerTable()