1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 10:09:43 +01:00

Smoothly interpolate editor notedelay

This makes editor notes fade out smoothly. And even though the notedelay
only gets decremented by one every editor-frame (the editor runs at
1000/24 FPS fixed-timestep here), it actually gets multiplied by 4, so a
floating-point interpolated value would make a difference here.
This commit is contained in:
Misa 2020-05-02 10:42:39 -07:00 committed by Ethan Lee
parent 68fe5bd72d
commit ca9f44c3b8
2 changed files with 6 additions and 2 deletions

View file

@ -305,6 +305,7 @@ void editorclass::reset()
saveandquit=false; saveandquit=false;
note=""; note="";
notedelay=0; notedelay=0;
oldnotedelay=0;
roomnamemod=false; roomnamemod=false;
textentry=false; textentry=false;
savemod=false; savemod=false;
@ -3574,11 +3575,12 @@ void editorrender()
} }
} }
if(ed.notedelay>0) if(ed.notedelay>0 || ed.oldnotedelay>0)
{ {
float alpha = graphics.lerp(ed.oldnotedelay, ed.notedelay);
FillRect(graphics.backBuffer, 0,115,320,18, graphics.getRGB(92,92,92)); FillRect(graphics.backBuffer, 0,115,320,18, graphics.getRGB(92,92,92));
FillRect(graphics.backBuffer, 0,116,320,16, graphics.getRGB(0,0,0)); FillRect(graphics.backBuffer, 0,116,320,16, graphics.getRGB(0,0,0));
graphics.Print(0,121, ed.note,196-((45-ed.notedelay)*4), 196-((45-ed.notedelay)*4), 196-((45-ed.notedelay)*4), true); graphics.Print(0,121, ed.note,196-((45.0f-alpha)*4), 196-((45.0f-alpha)*4), 196-((45.0f-alpha)*4), true);
} }
graphics.drawfade(); graphics.drawfade();
@ -3601,6 +3603,7 @@ void editorlogic()
ed.entframedelay=8; ed.entframedelay=8;
} }
ed.oldnotedelay = ed.notedelay;
if(ed.notedelay>0) if(ed.notedelay>0)
{ {
ed.notedelay--; ed.notedelay--;

View file

@ -164,6 +164,7 @@ class editorclass{
int temp; int temp;
int notedelay; int notedelay;
int oldnotedelay;
std::string note; std::string note;
std::string keybuffer; std::string keybuffer;
std::string filename; std::string filename;