I have this code:
#include <SFML/Graphics.hpp>
int main(){
sf::RenderWindow App(sf::VideoMode(1024, 768), "Game");
App.UseVerticalSync(true);
//Loads the game font and images
sf::Font GameFont;
if (!GameFont.LoadFromFile("calist.ttf")) {
return EXIT_FAILURE;
}
sf::Image TextBoxImage;
sf::Sprite TextBox;
if (!TextBoxImage.LoadFromFile("Blue.png")) {
return EXIT_FAILURE;
}
TextBox.SetImage(TextBoxImage);
TextBox.SetColor(sf::Color(0, 0, 255, 155));
TextBox.SetPosition(0, 490.f);
TextBox.Scale(1.6f, 1.6f);
const sf::Input& Input = App.GetInput();
bool DrawText = false;
bool Next = Input.IsKeyDown(sf::Key::Return);
//Loads the game Text
sf::String dia1a ("That piece of trash over there is Joey.", GameFont);
//Game Loop
while (App.IsOpened())
{
App.Clear();
App.Draw(TextBox);
App.Display();
//Dialogue for level 1
sf::Event Dialogue1;
while (App.GetEvent(Dialogue1)) {
if (Next = true){
DrawText = true;
}
if ((DrawText = true)) {
App.Draw(dia1a);
App.Display();
}
}
//Close Game
sf::Event GameClose;
while (App.GetEvent(GameClose)) {
if (GameClose.Type == sf::Event::Closed)
App.Close();
}
}
return EXIT_SUCCESS;
}
Which is supposed to display a line of text when I hit enter. The text should also stay on the screen because of DrawText. However, whenever I hit any key, or move the mouse at all, the text flickers for a while and then stops whenever I stop doing what I'm doing. If someone could please help me that would be much appreciated.