Hello, I looked around on the forums and couldn't find any problems like mine.
I am trying to write a journal program, and I want to utilize sf::Text and sf::Font. My program is able to successfully load the font file without error, but when I use text::setString and display the text, I don't get anything. I have noticed that if I setStyle to underline, a line will appear. I have tried this with multiple .ttf files and none have worked. Any help is appreciated
Here is my code:
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <SFML/Network.hpp>
#include <SFML/Audio.hpp>
int main()
{
int screenWidth = 500;
int screenHeight = 500;
sf::Font font;
sf::Text text;
sf::RenderWindow window(sf::VideoMode(screenWidth, screenHeight), "Window");
while (1)
{
//refresh window
window.display();
window.clear(sf::Color(100,0,0,255));
//set font
font.loadFromFile("dotty.ttf");
//draw text to screen
text.setFont(font);
text.setString("Hello world");
text.setCharacterSize(24);
text.setFillColor(sf::Color(0,0,0,255));
text.setStyle(sf::Text::Bold | sf::Text::Underlined);
window.draw(text);
}
}