Go to file
Cristian Pallarés 4d64d7f644
Merge pull request #16 from skyrpex/add-license-1
Create LICENSE
2018-01-11 09:22:02 +01:00
demo Moved project to demo/ 2014-02-24 19:38:15 +01:00
.gitattributes First commit 2012-07-26 13:04:54 +02:00
.gitignore First commit 2012-07-26 13:04:54 +02:00
LICENSE Create LICENSE 2018-01-11 09:21:43 +01:00
README.md Readme file mentions the support branch 2014-02-24 20:01:41 +01:00
RichText.cpp Used C++ static_cast in favor of C-style cast 2014-03-02 03:18:24 +01:00
RichText.hpp Used C++ static_cast in favor of C-style cast 2014-03-02 03:18:24 +01:00

README.md

RichText

Rich text class for SFML2. Allows the user to draw lines of text with different styles and colors.

License

This code is licensed under public domain.

Authors

How to use

  1. Include the header and the source to your project.
  2. Link to SFML2 (obviously :P!).
  3. Use a C++11 ready compiler.

Note: For a non C++11 ready compilers, there is a support branch. However, it's not guaranteed to be fully updated.

Repository

You can get the current development version from the git repository.

Example

#include "RichText.hpp"
#include <SFML/Graphics.hpp>
 
int main()
{
    sf::RenderWindow window;
    window.create(sf::VideoMode(800, 600), "sfe::RichText");
    window.setFramerateLimit(30);

    sf::Font font;
    font.loadFromFile("/usr/share/fonts/truetype/freefont/FreeMono.ttf");

    sfe::RichText text(font);
    text << sf::Text::Bold       << sf::Color::Cyan  << "This "
         << sf::Text::Italic     << sf::Color::White << "is\ncool\n"
         << sf::Text::Regular    << sf::Color::Green << "mate"
         << sf::Color::White     << ".\n"
         << sf::Text::Underlined << "I wish I could lick it!";
 
    text.setCharacterSize(25);
    text.setPosition(400, 300);
    text.setOrigin(text.getGlobalBounds().width / 2.f, text.getGlobalBounds().height / 2.f);

    while (window.isOpen()) {
        sf::Event event;
        while (window.pollEvent(event))
            if (event.type == sf::Event::Closed)
                window.close();

        window.clear();
        window.draw(text);
        window.display();
    }

    return 0;
}