From 4e533c65a5c15896324d5f9ab53b141a17b38f99 Mon Sep 17 00:00:00 2001 From: Misa Date: Tue, 28 Apr 2020 19:52:59 -0700 Subject: [PATCH] Interpolate upwards-moving star BG So that it's smooth at full FPS. --- desktop_version/src/Graphics.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 66ccfc16..43550bda 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -2101,13 +2101,17 @@ void Graphics::drawbackground( int t ) FillRect(backBuffer,0x000000); for (int i = 0; i < 50; i++) { + stars[i].w = 2; + stars[i].h = 2; + SDL_Rect star_rect = stars[i]; + star_rect.y = lerp(star_rect.y + starsspeed[i], star_rect.y); if (starsspeed[i] <= 8) { - FillRect(backBuffer, stars[i], getRGB(0x22, 0x22, 0x22)); + FillRect(backBuffer, star_rect, getRGB(0x22, 0x22, 0x22)); } else { - FillRect(backBuffer, stars[i], getRGB(0x55, 0x55, 0x55)); + FillRect(backBuffer, star_rect, getRGB(0x55, 0x55, 0x55)); } } break;