Hey, i got a problem to load a font in SFML.. The code is correct. The font is in a right place.. I don't understand what is the problem.. Can you help me?
That is my code:
#include "SFML/Graphics.hpp"
#include "SFML\Window.hpp"
#include "SFML\System.hpp"
#include <iostream>
using namespace std;
class FPS
{
public:
int fps, counter;
sf::Clock clock;
FPS(int x = 0, int y = 0) {fps = x;counter = y;}
void Update()
{ counter++; if(clock.getElapsedTime().asMilliseconds() >= 125)
{fps = counter*8; counter = 0; clock.restart(); } }
};
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML works!");
FPS FPS(0,0);
sf::Text text2;
sf::Font font1;
°°°°°°if(!font1.loadFromFile("arial.ttf"))
{
return 1;
}
text2.setFont(font1);
text2.setString("Hello world");
text2.setColor(sf::Color::White);
text2.setPosition(0, 0);
text2.setScale(2, 1);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
FPS.Update();
std::cout << FPS.fps << std::endl;
window.draw(text2);
window.clear();
window.display();
}
return 0;
}
That is my problem:
And that is my config and databases:
Regards. Lonely Coder