smooth out scrolling

This commit is contained in:
2026-08-02 05:56:46 -04:00
parent d6e00f287a
commit fe7ffcf963
3 changed files with 5 additions and 9 deletions
+1 -2
View File
@@ -8,7 +8,6 @@ scoreboard_matrix = ScoreboardMatrix()
def main(): def main():
while True: while True:
print(scoreboard_matrix.current_slide)
if scoreboard_matrix.current_slide == "score": if scoreboard_matrix.current_slide == "score":
canvas = score.draw_frame(scoreboard_matrix) canvas = score.draw_frame(scoreboard_matrix)
if not canvas: if not canvas:
@@ -26,6 +25,6 @@ def main():
else: else:
scoreboard_matrix.canvas = scoreboard_matrix.matrix.SwapOnVSync(canvas) scoreboard_matrix.canvas = scoreboard_matrix.matrix.SwapOnVSync(canvas)
sleep(0.5) sleep(0.1)
main() main()
+2 -2
View File
@@ -11,8 +11,8 @@ players = {
last_fetch = 0 last_fetch = 0
scroll_x = 0 scroll_x = 0
scroll_speed = 10 scroll_speed = 1
frames_per_tick = 2 frames_per_tick = 1
tick = 0 tick = 0
times_scrolled = 0 times_scrolled = 0
virtual_canvas = None virtual_canvas = None
+2 -5
View File
@@ -16,8 +16,8 @@ preferred_teams = [
] ]
scroll_x = 0 scroll_x = 0
scroll_speed = 10 scroll_speed = 1
frames_per_tick = 2 frames_per_tick = 1
tick = 0 tick = 0
times_scrolled = 0 times_scrolled = 0
virtual_canvas = None virtual_canvas = None
@@ -198,13 +198,10 @@ def draw_frame(matrix):
blit_slice(matrix.canvas, virtual_canvas, scroll_x) blit_slice(matrix.canvas, virtual_canvas, scroll_x)
draw_text_overlay(matrix.canvas, ordered, scroll_x) draw_text_overlay(matrix.canvas, ordered, scroll_x)
print(tick)
tick += 1 tick += 1
if tick >= frames_per_tick: if tick >= frames_per_tick:
tick = 0 tick = 0
next_x = scroll_x + scroll_speed next_x = scroll_x + scroll_speed
print(scroll_x, scroll_speed, next_x, total_scroll_width)
if next_x >= total_scroll_width: if next_x >= total_scroll_width:
scroll_x = 0 scroll_x = 0
tick = 0 tick = 0