From 9f4eaeef7d2100486af9ecbdd1e94e3bd10df3f8 Mon Sep 17 00:00:00 2001 From: b1indy Date: Sun, 16 Dec 2007 11:10:20 +0000 Subject: elimitated sentence change flicker bug git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@704 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/ULyrics.pas | 18 ++++++++---------- Game/Code/Screens/UScreenSing.pas | 11 +++++++++++ 2 files changed, 19 insertions(+), 10 deletions(-) (limited to 'Game') diff --git a/Game/Code/Classes/ULyrics.pas b/Game/Code/Classes/ULyrics.pas index 8bbb2db3..8fd1f3ec 100644 --- a/Game/Code/Classes/ULyrics.pas +++ b/Game/Code/Classes/ULyrics.pas @@ -44,6 +44,7 @@ type TLyricEngine = class private EoLastSentence: Real; //When did the Last Sentence End (in Beats) + LastDrawBeat: Real; UpperLine: TLyricLine; //Line in the Upper Part of the Lyric Display LowerLine: TLyricLine; //Line in the Lower Part of teh Lyric Display QueueLine: TLyricLine; //Line that is in Queue and will be added when next Line is Finished @@ -116,7 +117,8 @@ uses SysUtils, TextGL, UGraphic, UDisplay, - dialogs; + dialogs, + math; //----------- //Helper procs to use TRGB in Opengl ...maybe this should be somewhere else @@ -151,6 +153,7 @@ begin PQueueLine:=@QueueLine; UseLinearFilter := True; + LastDrawBeat:=NAN; end; Constructor TLyricEngine.Create(ULX,ULY,ULW,ULS,LLX,LLY,LLW,LLS:Real); @@ -194,6 +197,7 @@ begin PUpperline:=@UpperLine; PLowerLine:=@LowerLine; PQueueLine:=@QueueLine; + LastDrawBeat:=NAN; end; @@ -342,15 +346,12 @@ begin PosX := PosX + LyricLine.Words[I].Width; end; + //Create LyricTexture //Prepare Ogl glGetIntegerv(GL_VIEWPORT, @ViewPort); glClearColor(0.0,0.0,0.0,0.0); glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - {glMatrixMode(GL_PROJECTION); - glLoadIdentity; - glOrtho(0, 1024, 64, 0, -1, 100); - glMatrixMode(GL_MODELVIEW);} glViewPort(0,0,800,600); //Draw Lyrics @@ -368,10 +369,7 @@ begin glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); glViewPort(ViewPort[0], ViewPort[1], ViewPort[2], ViewPort[3]); - {glMatrixMode(GL_PROJECTION); - glLoadIdentity; - glOrtho(0, RenderW, RenderH, 0, -1, 100); - glMatrixMode(GL_MODELVIEW); } + end; //Increase the Counter @@ -385,8 +383,8 @@ end; //--------------- Procedure TLyricEngine.Draw (Beat: Real); begin - DrawLyrics(Beat); + LastDrawBeat:=Beat; end; //--------------- diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index d3019ac6..309af301 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -1353,7 +1353,18 @@ begin //GoldenStarsTwinkle Mod GoldenRec.SentenceChange; if (Lyrics.LineCounter <= High(Czesci[0].Czesc)) then + begin Lyrics.AddLine(@Czesci[0].Czesc[Lyrics.LineCounter]); + // addline uses display memory + // calling draw makes sure, there's the singscreen in it, when the next + // swap between onscreen and offscreen buffers is done + // (this eliminates the onSentenceChange flickering) + // note: maybe it would be better to make sure, a display redraw is done + // right after the sentence change (before buffer swap) or make sure + // onsentencechange is only called right before calling Display.Draw + // (or whatever it was called) + Draw; + end; //GoldenStarsTwinkle Mod End end; -- cgit v1.2.3