Moved project to demo/
parent
9843fe78d1
commit
6a54c7512e
|
@ -9,8 +9,7 @@ INCLUDEPATH += SFML
|
||||||
LIBS += -lsfml-system-d -lsfml-window-d -lsfml-graphics-d -ljpeg -lGLEW
|
LIBS += -lsfml-system-d -lsfml-window-d -lsfml-graphics-d -ljpeg -lGLEW
|
||||||
|
|
||||||
SOURCES += main.cpp \
|
SOURCES += main.cpp \
|
||||||
RichText.cpp
|
../RichText.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
RichText.hpp
|
../RichText.hpp
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
36
main.cpp
36
main.cpp
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue