Skip to content

Commit

Permalink
Use P1 inverted color to mark selected bar in editor
Browse files Browse the repository at this point in the history
  • Loading branch information
DeinAlptraum committed Jul 14, 2024
1 parent d08d293 commit 81f2e1c
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 25 deletions.
32 changes: 26 additions & 6 deletions src/base/UDraw.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1661,11 +1661,17 @@ procedure EditDrawLine(X, YBaseNote, W, H: real; Track: integer; NumLines: integ
Rec.Bottom := Rec.Top + 2 * NotesH[0];
If (NoteType = ntRap) or (NoteType = ntRapGolden) then
begin
glBindTexture(GL_TEXTURE_2D, Tex_Left_Rap[Color].TexNum);
If Color = 99 then
glBindTexture(GL_TEXTURE_2D, Tex_Left_Rap_Inv.TexNum)
else
glBindTexture(GL_TEXTURE_2D, Tex_Left_Rap[Color].TexNum)
end
else
begin
glBindTexture(GL_TEXTURE_2D, Tex_Left[Color].TexNum);
If Color = 99 then
glBindTexture(GL_TEXTURE_2D, Tex_Left_Inv.TexNum)
else
glBindTexture(GL_TEXTURE_2D, Tex_Left[Color].TexNum)
end;
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top);
Expand All @@ -1681,11 +1687,17 @@ procedure EditDrawLine(X, YBaseNote, W, H: real; Track: integer; NumLines: integ

If (NoteType = ntRap) or (NoteType = ntRapGolden) then
begin
glBindTexture(GL_TEXTURE_2D, Tex_Mid_Rap[Color].TexNum);
If Color = 99 then
glBindTexture(GL_TEXTURE_2D, Tex_Mid_Rap_Inv.TexNum)
else
glBindTexture(GL_TEXTURE_2D, Tex_Mid_Rap[Color].TexNum)
end
else
begin
glBindTexture(GL_TEXTURE_2D, Tex_Mid[Color].TexNum);
If Color = 99 then
glBindTexture(GL_TEXTURE_2D, Tex_Mid_Inv.TexNum)
else
glBindTexture(GL_TEXTURE_2D, Tex_Mid[Color].TexNum)
end;
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top);
Expand All @@ -1700,11 +1712,19 @@ procedure EditDrawLine(X, YBaseNote, W, H: real; Track: integer; NumLines: integ

If (NoteType = ntRap) or (NoteType = ntRapGolden) then
begin
glBindTexture(GL_TEXTURE_2D, Tex_Right_Rap[Color].TexNum);
If Color = 99 then
glBindTexture(GL_TEXTURE_2D, Tex_Right_Rap_Inv.TexNum)
else
glBindTexture(GL_TEXTURE_2D, Tex_Right_Rap[Color].TexNum)
end
else
begin
glBindTexture(GL_TEXTURE_2D, Tex_Right[Color].TexNum);
If Color = 99 then
begin
glBindTexture(GL_TEXTURE_2D, Tex_Right_Inv.TexNum);
end
else
glBindTexture(GL_TEXTURE_2D, Tex_Right[Color].TexNum)
end;
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex2f(Rec.Left, Rec.Top);
Expand Down
8 changes: 8 additions & 0 deletions src/base/UGraphic.pas
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,14 @@ TRecR = record
Tex_BG_Mid_Rap: array[1..UIni.IMaxPlayerCount] of TTexture; //rename to tex_noteglow_mid
Tex_BG_Right_Rap: array[1..UIni.IMaxPlayerCount] of TTexture; //rename to tex_noteglow_right

// Inversions of first player colors used to mark selected note in editor
Tex_Left_Inv: TTexture;
Tex_Mid_Inv: TTexture;
Tex_Right_Inv: TTexture;
Tex_Left_Rap_Inv: TTexture;
Tex_Mid_Rap_Inv: TTexture;
Tex_Right_Rap_Inv: TTexture;

Tex_Note_Star: TTexture;
Tex_Note_Perfect_Star: TTexture;

Expand Down
38 changes: 19 additions & 19 deletions src/screens/UScreenEditSub.pas
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre
while (CurrentNote[CurrentTrack] <= Tracks[CurrentTrack].Lines[LineIndex].HighNote) and (CurrentBeat > Tracks[CurrentTrack].Lines[LineIndex].Notes[CurrentNote[CurrentTrack]].EndBeat) do
Inc(CurrentNote[CurrentTrack]);

Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 2;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 99;
EditorLyrics[CurrentTrack].AddLine(CurrentTrack, Tracks[CurrentTrack].CurrentLine);
EditorLyrics[CurrentTrack].Selected := 0;

Expand Down Expand Up @@ -826,7 +826,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre
begin
Tracks[CurrentTrack].CurrentLine := MedleyNotes.end_.line;
CurrentNote[CurrentTrack] := MedleyNotes.end_.note;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 2;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 99;

EditorLyrics[CurrentTrack].AddLine(CurrentTrack, Tracks[CurrentTrack].CurrentLine);
EditorLyrics[CurrentTrack].Selected := 0;
Expand All @@ -849,7 +849,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre
begin
Tracks[CurrentTrack].CurrentLine := MedleyNotes.start.line;
CurrentNote[CurrentTrack] := MedleyNotes.start.note;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 2;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 99;

EditorLyrics[CurrentTrack].AddLine(CurrentTrack, Tracks[CurrentTrack].CurrentLine);
EditorLyrics[CurrentTrack].Selected := 0;
Expand Down Expand Up @@ -1793,7 +1793,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre
Tracks[CurrentTrack].CurrentLine := LineIndex;
ShowInteractiveBackground;
CurrentNote[CurrentTrack] := 0;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 2;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 99;
EditorLyrics[CurrentTrack].AddLine(CurrentTrack, Tracks[CurrentTrack].CurrentLine);
EditorLyrics[CurrentTrack].Selected := CurrentNote[CurrentTrack];
end;
Expand All @@ -1817,7 +1817,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre

Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 1;
CurrentNote[CurrentTrack] := NoteIndex;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 2;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 99;
EditorLyrics[CurrentTrack].Selected := CurrentNote[CurrentTrack];
//play current note playonewithmidi
PlaySentenceMidi := false;
Expand Down Expand Up @@ -1898,7 +1898,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre
Inc(CurrentNote[CurrentTrack]);
if CurrentNote[CurrentTrack] > Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].HighNote then
CurrentNote[CurrentTrack] := 0;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 2;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 99;
EditorLyrics[CurrentTrack].Selected := CurrentNote[CurrentTrack];
end;

Expand Down Expand Up @@ -1976,7 +1976,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre
Dec(CurrentNote[CurrentTrack]);
if CurrentNote[CurrentTrack] = -1 then
CurrentNote[CurrentTrack] := Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].HighNote;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 2;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 99;
EditorLyrics[CurrentTrack].Selected := CurrentNote[CurrentTrack];
end;

Expand Down Expand Up @@ -3115,7 +3115,7 @@ procedure TScreenEditSub.DivideSentence;
end;

Refresh;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 2;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 99;
EditorLyrics[CurrentTrack].AddLine(CurrentTrack, Tracks[CurrentTrack].CurrentLine);
EditorLyrics[CurrentTrack].Selected := CurrentNote[CurrentTrack];
end;
Expand Down Expand Up @@ -3187,7 +3187,7 @@ procedure TScreenEditSub.JoinSentence;
end;

Refresh;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 2;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 99;
EditorLyrics[CurrentTrack].AddLine(CurrentTrack, Tracks[CurrentTrack].CurrentLine);
EditorLyrics[CurrentTrack].Selected := CurrentNote[CurrentTrack];
end;
Expand All @@ -3205,7 +3205,7 @@ procedure TScreenEditSub.NextSentence;
CurrentNote[CurrentTrack] := 0;
if Tracks[CurrentTrack].CurrentLine > Tracks[CurrentTrack].High then
Tracks[CurrentTrack].CurrentLine := 0;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 2;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 99;

EditorLyrics[CurrentTrack].AddLine(CurrentTrack, Tracks[CurrentTrack].CurrentLine);
EditorLyrics[CurrentTrack].Selected := 0;
Expand All @@ -3232,7 +3232,7 @@ procedure TScreenEditSub.PreviousSentence;
CurrentNote[CurrentTrack] := 0;
if Tracks[CurrentTrack].CurrentLine = -1 then
Tracks[CurrentTrack].CurrentLine := Tracks[CurrentTrack].High;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 2;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 99;

EditorLyrics[CurrentTrack].AddLine(CurrentTrack, Tracks[CurrentTrack].CurrentLine);
EditorLyrics[CurrentTrack].Selected := 0;
Expand Down Expand Up @@ -3340,7 +3340,7 @@ procedure TScreenEditSub.DeleteNote;
EndBeat := Notes[HighNote].StartBeat + Notes[HighNote].Duration;
end;

Tracks[CurrentTrack].Lines[CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 2;
Tracks[CurrentTrack].Lines[CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 99;
end
// Last Note of current Sentence Deleted - > Delete Sentence
// if there are more than two left
Expand All @@ -3362,7 +3362,7 @@ procedure TScreenEditSub.DeleteNote;
else
Tracks[CurrentTrack].CurrentLine := 0;

Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 2;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 99;
end;

// update lyric display
Expand Down Expand Up @@ -3396,7 +3396,7 @@ procedure TScreenEditSub.DeleteSentence;
Refresh;
//SelectPrevNote();
//SelectNextNote();
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 2;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 99;
EditorLyrics[CurrentTrack].AddLine(CurrentTrack, Tracks[CurrentTrack].CurrentLine);
end;

Expand Down Expand Up @@ -3511,7 +3511,7 @@ procedure TScreenEditSub.CopySentence(SrcTrack, SrcLine, DstTrack, DstLine: Inte
Tracks[DstTrack].Lines[DstLine].EndBeat := Tracks[DstTrack].Lines[DstLine].Notes[NoteIndex].StartBeat + Tracks[DstTrack].Lines[DstLine].Notes[NoteIndex].Duration;

Refresh;
Tracks[DstTrack].Lines[DstLine].Notes[CurrentNote[DstTrack]].Color := 2;
Tracks[DstTrack].Lines[DstLine].Notes[CurrentNote[DstTrack]].Color := 99;
EditorLyrics[DstTrack].AddLine(DstTrack, Tracks[DstTrack].CurrentLine);
end;

Expand Down Expand Up @@ -3563,7 +3563,7 @@ procedure TScreenEditSub.MakeSolo;
CurrentTrack := 0;
Refresh;
CurrentNote[CurrentTrack] := 0;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 2;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 99;

EditorLyrics[CurrentTrack].AddLine(CurrentTrack, Tracks[CurrentTrack].CurrentLine);
end;
Expand Down Expand Up @@ -3710,7 +3710,7 @@ function TScreenEditSub.DuetCopyLine: boolean;
EditorLyrics[DstTrack].AddLine(DstTrack, Tracks[DstTrack].CurrentLine);
EditorLyrics[DstTrack].Selected := 0;
CurrentNote[DstTrack] := 0;
Tracks[SrcTrack].Lines[SrcLine].Notes[CurrentNote[SrcTrack]].Color := 2;
Tracks[SrcTrack].Lines[SrcLine].Notes[CurrentNote[SrcTrack]].Color := 99;
Result := true;
end;

Expand Down Expand Up @@ -4930,7 +4930,7 @@ procedure TScreenEditSub.OnShow;
begin
Tracks[TrackIndex].CurrentLine := 0;
CurrentNote[TrackIndex] := 0;
Tracks[TrackIndex].Lines[0].Notes[0].Color := 2;
Tracks[TrackIndex].Lines[0].Notes[0].Color := 99;
end;

AudioPlayBack.Open(CurrentSong.Path.Append(CurrentSong.Mp3));
Expand Down Expand Up @@ -5090,7 +5090,7 @@ function TScreenEditSub.Draw: boolean;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 1;
CurrentNote[CurrentTrack] := NoteIndex;
EditorLyrics[CurrentTrack].Selected := CurrentNote[CurrentTrack];
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 2;
Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Color := 99;
end; //if
end; //for NoteIndex}
end; //end move cursor
Expand Down
9 changes: 9 additions & 0 deletions src/screens/views/UScreenSingView.pas
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,15 @@ constructor TScreenSingView.Create;
Tex_ScoreBG[I - 1] := Texture.LoadTexture(Skin.GetTextureFileName('ScoreBG'), TEXTURE_TYPE_COLORIZED, Color);
end;

// Inversions of first player colors used to mark selected note in editor
Color := RGBFloatToInt(1 - Col[1].R, 1 - Col[1].G, 1 - Col[1].B);
Tex_Left_Inv := Texture.LoadTexture(Skin.GetTextureFileName('GrayLeft'), TEXTURE_TYPE_COLORIZED, Color);
Tex_Mid_Inv := Texture.LoadTexture(Skin.GetTextureFileName('GrayMid'), TEXTURE_TYPE_COLORIZED, Color);
Tex_Right_Inv := Texture.LoadTexture(Skin.GetTextureFileName('GrayRight'), TEXTURE_TYPE_COLORIZED, Color);
Tex_Left_Rap_Inv := Texture.LoadTexture(Skin.GetTextureFileName('GrayLeftRap'), TEXTURE_TYPE_COLORIZED, Color);
Tex_Mid_Rap_Inv := Texture.LoadTexture(Skin.GetTextureFileName('GrayMidRap'), TEXTURE_TYPE_COLORIZED, Color);
Tex_Right_Rap_Inv := Texture.LoadTexture(Skin.GetTextureFileName('GrayRightRap'), TEXTURE_TYPE_COLORIZED, Color);

StaticPausePopup := ScreenSing.AddStatic(Theme.Sing.PausePopUp);

// <note> pausepopup is not visible at the beginning </note>
Expand Down

0 comments on commit 81f2e1c

Please sign in to comment.