Skip to content

Commit

Permalink
fix slider alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
hero622 committed Aug 23, 2024
1 parent 6b8b161 commit f0b4481
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@

## Development
- [Contributing](docs/contributing.md)
- [SDK](src/sdk)
4 changes: 2 additions & 2 deletions src/core/menu/framework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ void gui::framework::slider( int& val, int min, int max, const std::string& labe
photon->render->draw_rounded_rect( cur_pos2.x, cur_pos2.y + 1, value * size.x, size.y - 13, colors::accent, 4 );

const auto text_size = photon->render->get_text_size( fonts::smaller, util::ssprintf( "%d", val ).c_str( ) );
photon->render->draw_text( cur_pos2.x - text_size.x / 2 - 8, cur_pos2.y - 3, fonts::smaller, colors::text, true, util::ssprintf( "%d", val ).c_str( ) );
photon->render->draw_text( cur_pos2.x - text_size.x / 2 - 12, cur_pos2.y - 3, fonts::smaller, colors::text, true, util::ssprintf( "%d", val ).c_str( ) );

cur_pos2 += vec2_t( radius_half, radius_half );
cur_pos2.x += value * ( size.x - radius );
Expand Down Expand Up @@ -443,7 +443,7 @@ void gui::framework::sliderf( float& val, float min, float max, const std::strin
photon->render->draw_rounded_rect( cur_pos2.x, cur_pos2.y + 1, value * size.x, size.y - 13, colors::accent, 4 );

const auto text_size = photon->render->get_text_size( fonts::smaller, util::ssprintf( "%.1f", val ).c_str( ) );
photon->render->draw_text( cur_pos2.x - text_size.x / 2 - 8, cur_pos2.y - 3, fonts::smaller, colors::text, true, util::ssprintf( "%.1f", val ).c_str( ) );
photon->render->draw_text( cur_pos2.x - text_size.x / 2 - 12, cur_pos2.y - 3, fonts::smaller, colors::text, true, util::ssprintf( "%.1f", val ).c_str( ) );

cur_pos2 += vec2_t( radius_half, radius_half );
cur_pos2.x += value * ( size.x - radius );
Expand Down

0 comments on commit f0b4481

Please sign in to comment.