I can't seem to get my program to load the font.
CodE:
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include <SFML/Network.hpp>
#include <SFML/System.hpp>
#include <iostream>
using namespace std;
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML works!", sf::Style::Close);
bool running = true;
bool startmenu = true;
bool ingame = false;
bool gamemenu = false;
//Declare Objects
sf::Font font;
if (!font.loadFromFile("ubuntu.ttf")){
cout << "Could not load font..." << endl;
system("PAUSE");
}
sf::Text text("Test", font, 50);
text.setPosition(20,10);
text.setScale(20,20);
sf::RectangleShape rect;
rect.setFillColor(sf::Color::Red);
rect.setSize(sf::Vector2f(20,20));
rect.setPosition(40,40);
while (running){
sf::Event event;
if (window.pollEvent(event)){
if (event.type == sf::Event::Closed)
running = false;
}
window.clear();
window.draw(text);
window.draw(rect);
window.display();
}
return 0;
}
It shows me failed to load font "tu.ttf" Failed to create font face.
My font is ubuntu.ttf.. Why is it outputting tu.ttf?