Moved project to demo/

master
Skyrpex 2014-02-24 19:38:15 +01:00
parent 9843fe78d1
commit 6a54c7512e
3 changed files with 39 additions and 39 deletions

View File

@ -9,8 +9,7 @@ INCLUDEPATH += SFML
LIBS += -lsfml-system-d -lsfml-window-d -lsfml-graphics-d -ljpeg -lGLEW
SOURCES += main.cpp \
RichText.cpp
../RichText.cpp
HEADERS += \
RichText.hpp
../RichText.hpp

37
demo/main.cpp Normal file
View File

@ -0,0 +1,37 @@
#include <SFML/Graphics.hpp>
#include "../RichText.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;
}

View File

@ -1,36 +0,0 @@
#include <SFML/Graphics.hpp>
#include "RichText.hpp"
int main(int, char *[])
{
sf::RenderWindow window;
window.create(sf::VideoMode(800, 600), "Test");
window.setVerticalSyncEnabled(true);
sf::Font font;
font.loadFromFile("/usr/share/fonts/truetype/freefont/FreeMono.ttf");
sfe::RichText text(font);
text << sf::Color::Red << "Test\nbla" << sf::Color::Blue << "Lol";
while (window.isOpen()) {
sf::Event event;
while (window.pollEvent(event)) {
switch (event.type) {
case sf::Event::Closed:
window.close();
break;
default:
break;
}
}
window.clear();
window.draw(text);
window.display();
}
return 0;
}