1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-22 20:48:29 +02:00

Update left-moving star BG in fixed timestep loop

Otherwise they will move too fast.
This commit is contained in:
Misa 2020-04-28 19:28:16 -07:00 committed by Ethan Lee
parent 495bea2e87
commit 55ae3c73a9
3 changed files with 28 additions and 8 deletions

View File

@ -1813,14 +1813,6 @@ void Graphics::drawbackground( int t )
{
FillRect(backBuffer,stars[i], getRGB(0x55,0x55,0x55));
}
stars[i].x -= Sint16(starsspeed[i]);
if (stars[i].x < -10)
{
stars[i].x += 340;
stars[i].y = int(fRandom() * 240);
stars[i].w = 2;
starsspeed[i] = 4+int(fRandom()*4);
}
}
break;
case 2:
@ -2187,6 +2179,28 @@ void Graphics::drawbackground( int t )
}
}
void Graphics::updatebackground(int t)
{
switch (t)
{
case 1:
//Starfield
for (int i = 0; i < 50; i++)
{
stars[i].w = 2;
stars[i].h = 2;
stars[i].x -= Sint16(starsspeed[i]);
if (stars[i].x < -10)
{
stars[i].x += 340;
stars[i].y = int(fRandom() * 240);
stars[i].w = 2;
starsspeed[i] = 4+int(fRandom()*4);
}
}
}
}
void Graphics::drawmap()
{
if (!foregrounddrawn)

View File

@ -164,6 +164,7 @@ public:
void setcolreal(Uint32 t);
void drawbackground(int t);
void updatebackground(int t);
void drawtile3( int x, int y, int t, int off );
void drawentcolours( int x, int y, int t);
void drawtile2( int x, int y, int t );

View File

@ -1503,4 +1503,9 @@ void gamelogic()
}
graphics.updatetextboxes();
if (!game.colourblindmode)
{
graphics.updatebackground(map.background);
}
}