83demon
83demon

Reputation: 47

Sfml text goes beyond the bounds of screen

I have this snippet of code

void Graphics::render_text(std::string bunch_of_text) {
    sf::Text text;
    text.setFont(font); // font is a sf::Font
    text.setString(bunch_of_text);
    text.setCharacterSize(text_size); // in pixels, not points!
    text.setFillColor(text_color);
    text.setStyle(text_style);
    window.draw(text);
    window.display();
}

And sometimes this text is really long, and the remainder of the text can't be seen because of bounds. Is there an opportunity to make text perfectly fitting on the screen, such as splitting text into multiple parts or making a new line(\n) inside the text where needed?

Upvotes: 0

Views: 241

Answers (1)

0x5453
0x5453

Reputation: 13589

Here's one idea (pseudocode):

Upvotes: 1

Related Questions