From 12f74577f608410bdbdc5be50603f2957f33c165 Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Wed, 17 Apr 2024 12:52:53 +0200 Subject: [PATCH] =?UTF-8?q?while=20=E2=87=92=20for?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gui.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/gui.c b/src/gui.c index c8b32c9..a9077a5 100644 --- a/src/gui.c +++ b/src/gui.c @@ -1043,12 +1043,10 @@ static inline int _button_mouse_up( Button* buttons, int mx, int my, int mb ) return ret; } -static inline void button_draw_all( Button* buttons ) +static inline void button_draw_all( ) { - while ( buttons->label ) { - _button_draw( buttons ); - buttons++; - } + for ( int i = 0; i < sizeof( gui_buttons ) / sizeof( gui_buttons[ 0 ] ); ++i ) + _button_draw( &( gui_buttons[ i ] ) ); } void SDL__display_show() @@ -1120,7 +1118,7 @@ void SDL__display_show() SDL_Rect r2 = { LCD_X * config.ui_scale, LCD_Y * config.ui_scale, LCD_WIDTH * config.ui_scale, LCD_HEIGHT * config.ui_scale }; SDL_RenderCopyEx( renderer, texTarget, &r1, &r2, 0, NULL, SDL_FLIP_NONE ); - button_draw_all( gui_buttons ); + button_draw_all(); SDL_RenderPresent( renderer ); }