diff options
Diffstat (limited to 'src/ui.cpp')
-rw-r--r-- | src/ui.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
@@ -148,8 +148,9 @@ bool UI::button(sf::RenderWindow *win, int id, const std::string &text, return result; } -bool UI::radioButton(sf::RenderWindow *win, int id, const std::string &text, - bool state, sf::Vector2i pos, sf::Vector2i size){ +bool UI::radioButton(sf::RenderWindow *win, Graphics::TextureFont font, + int id, const std::string &text, bool state, sf::Vector2i pos, + sf::Vector2i size){ sf::IntRect rect {pos, size}; if( rect.contains( mousePosition() ) ){ @@ -170,18 +171,24 @@ bool UI::radioButton(sf::RenderWindow *win, int id, const std::string &text, } // Rendering: - sf::CircleShape radio{ 50 }; - radio.setPosition( sf::Vector2f(pos) ); - radio.setOutlineColor( sf::Color::Blue ); - radio.setOutlineThickness( 5 ); + sf::RectangleShape rectangle { sf::Vector2f(size) }; + rectangle.setPosition( sf::Vector2f(pos) ); + win->draw(rectangle); + sf::CircleShape radio{ 4 }; + radio.setPosition( sf::Vector2f(pos) + sf::Vector2f(10, size.y/2) ); + radio.setOutlineColor( sf::Color::Red ); + radio.setOutlineThickness( 1 ); if(state){ radio.setFillColor( sf::Color::Blue ); } else { } - win->draw(radio); + Graphics::Text textGraph {font, text, size.x - 30, size.y}; + textGraph.setPosition(sf::Vector2f(pos) + sf::Vector2f{30, size.y/2}); + win->draw(textGraph); + return state; } |