From ae85dae6e9f8876ad4141f850b1e9d96cbbb6227 Mon Sep 17 00:00:00 2001 From: Tyler Perkins Date: Tue, 21 Dec 2021 23:54:18 -0500 Subject: [PATCH] Remove comparison statement in board::start loop --- src/board.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/board.cpp b/src/board.cpp index 26ba2a4..48ec0dc 100644 --- a/src/board.cpp +++ b/src/board.cpp @@ -358,14 +358,12 @@ void board::start(){ //check if its time to increment the panel if(std::chrono::duration_cast( start - last_panel).count() >= PANELS[i]->_time_on_screen){ - i++; - last_panel = start; - OVERLAY->_title = PANELS[i]->_title; - } + i = ++i % PANELS_LENGTH; - //check if we can loop back over - if(i >= PANELS_LENGTH) - i = 0; + OVERLAY->_title = PANELS[i]->_title; + + last_panel = start; + } //clear the screen SDL_RenderClear(_renderer);