Skip to content

Commit

Permalink
clarify function intent by naming
Browse files Browse the repository at this point in the history
  • Loading branch information
gwenhael-le-moine committed Sep 7, 2024
1 parent ae2c72e commit 3fc730a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/ui_sdl2.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ static void __draw_bitmap( int x, int y, unsigned int w, unsigned int h, unsigne
__draw_texture( x, y, w, h, bitmap_to_texture( w, h, data, color_fg, color_bg ) );
}

static void write_text( int x, int y, const char* string, int color_fg, int color_bg )
static void write_with_small_font( int x, int y, const char* string, int color_fg, int color_bg )
{
for ( unsigned int i = 0; i < strlen( string ); i++ ) {
if ( small_font[ ( int )string[ i ] ].h != 0 )
Expand Down Expand Up @@ -694,15 +694,15 @@ static void _draw_keypad( void )
y -= 2;
}

write_text( x, y, BUTTONS[ i ].letter, WHITE, ( i < HPKEY_MTH ) ? DISP_PAD : PAD );
write_with_small_font( x, y, BUTTONS[ i ].letter, WHITE, ( i < HPKEY_MTH ) ? DISP_PAD : PAD );
}

// Bottom label: the only one is the cancel button
if ( BUTTONS[ i ].sub != ( char* )0 ) {
x = KEYBOARD_OFFSET_X + BUTTONS[ i ].x +
( 1 + BUTTONS[ i ].w - SmallTextWidth( BUTTONS[ i ].sub, strlen( BUTTONS[ i ].sub ) ) ) / 2;
y = KEYBOARD_OFFSET_Y + BUTTONS[ i ].y + BUTTONS[ i ].h + small_ascent + 2;
write_text( x, y, BUTTONS[ i ].sub, WHITE, PAD );
write_with_small_font( x, y, BUTTONS[ i ].sub, WHITE, PAD );
}

// Draw the left labels
Expand All @@ -721,7 +721,7 @@ static void _draw_keypad( void )

x += ( 1 + BUTTONS[ i ].w - total_top_labels_width ) / 2;

write_text( x, y, BUTTONS[ i ].left, LEFT, BUTTONS[ i ].is_menu ? UNDERLAY : PAD );
write_with_small_font( x, y, BUTTONS[ i ].left, LEFT, BUTTONS[ i ].is_menu ? UNDERLAY : PAD );
}

// draw the right labels ( .is_menu never have one )
Expand All @@ -737,7 +737,7 @@ static void _draw_keypad( void )

x += ( 1 + BUTTONS[ i ].w - total_top_labels_width ) / 2;

write_text( x, y, BUTTONS[ i ].right, RIGHT, PAD );
write_with_small_font( x, y, BUTTONS[ i ].right, RIGHT, PAD );
}
}

Expand Down

0 comments on commit 3fc730a

Please sign in to comment.