improved lyric zoom effect (TODO: add lyric style option to config screen)

This commit is contained in:
Alexander Eckart committed 2012-05-06 15:10:35 +02:00
1 parent 8dbdd7423e
commit fd482606e7
1 file changed
+18 -12
+18 -12
View File
@@ -317,32 +317,36 @@ namespace Vocaluxe.Menu
} }
int zoom_note = -1; int zoom_note = -1;
int end_beat = -1;
float zoomx = 0f; float zoomx = 0f;
int current_note = -1; for (int note = 0; note < _Notes.Count; note++)
foreach (SNote note in _Notes)
{ {
current_note++;
_Text.X = x; _Text.X = x;
_Text.Style = EStyle.Bold; _Text.Style = EStyle.Bold;
_Text.Text = note.Text; _Text.Text = _Notes[note].Text;
RectangleF rect = CDraw.GetTextBounds(_Text); RectangleF rect = CDraw.GetTextBounds(_Text);
if (note.Type == ENoteType.Freestyle) if (_Notes[note].Type == ENoteType.Freestyle)
_Text.Style = EStyle.BoldItalic; _Text.Style = EStyle.BoldItalic;
if (CurrentBeat >= note.StartBeat) if (CurrentBeat >= _Notes[note].StartBeat)
{ {
if (CurrentBeat <= note.EndBeat) bool last = note == _Notes.Count -1;
int endbeat = _Notes[note].EndBeat;
if (note < _Notes.Count -1)
endbeat = _Notes[note + 1].StartBeat - 1;
if (CurrentBeat <= endbeat)
{ {
zoom_note = current_note; zoom_note = note;
end_beat = endbeat;
zoomx = _Text.X; zoomx = _Text.X;
} }
else else
{ {
// already passed // already passed
if (current_note == last_note) if (note == last_note)
_Text.Color = ColorProcessed; _Text.Color = ColorProcessed;
else else
_Text.Color = Color; _Text.Color = Color;
@@ -376,9 +380,11 @@ namespace Vocaluxe.Menu
RectangleF rect = CDraw.GetTextBounds(_Text); RectangleF rect = CDraw.GetTextBounds(_Text);
float diff = _Notes[zoom_note].EndBeat - _Notes[zoom_note].StartBeat; float diff = end_beat - _Notes[zoom_note].StartBeat;
if (diff <= 0f)
diff = 1f;
float p = (CurrentBeat - _Notes[zoom_note].StartBeat) / _Notes[zoom_note].Duration; float p = (CurrentBeat - _Notes[zoom_note].StartBeat) / diff;
if (p > 1f) if (p > 1f)
p = 1f; p = 1f;