Sign in to follow this  

[SFML] Text not drawn problem

This topic is 1826 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've a problem where, when I show another window on the screen, everything works fine except the text isn't printed out on the screen. I've already called the loadText() in the int main(). Help me fix this problem.

 

 

#include "ErrorMessages.h"
#include "Global.h"
 
#include <SFML/Graphics.hpp>
 
ErrorMessages::ErrorMessages()
{
    //ctor
}
 
ErrorMessages::~ErrorMessages()
{
    //dtor
}
 
void ErrorMessages::loadText()
{
    if(ErrorFont.loadFromFile("monospa1.ttf"))
        ErrorText.setFont(ErrorFont);
}
void ErrorMessages::sendErrorBox_alreadyvote()
{
    sf::RenderWindow AlreadyVoted(sf::VideoMode(570,50,32), "ERROR - multiple votes not allowed");
 
    while(AlreadyVoted.isOpen())
    {
        sf::Event Event;
        while(AlreadyVoted.pollEvent(Event))
        {
            if(sf::Keyboard::isKeyPressed(sf::Keyboard::Escape) || Event.type == sf::Event::Closed)
                AlreadyVoted.close();
        }
 
        ErrorText.setString("You already vote this officer!");
        ErrorText.setColor(sf::Color::White);
 
        AlreadyVoted.draw(ErrorText);
        AlreadyVoted.display();
 
    }
}
 
void ErrorMessages::sendErrorBox_incompleteVote()
{
    sf::RenderWindow IncompleteVotes(sf::VideoMode(570,50,32),"ERROR - incomplete votes");
 
    while(IncompleteVotes.isOpen())
    {
        sf::Event Event;
        while(IncompleteVotes.pollEvent(Event))
        {
            if(sf::Keyboard::isKeyPressed(sf::Keyboard::Escape) || Event.type == sf::Event::Closed)
                IncompleteVotes.close();
        }
    }
 
    ErrorText.setString("You must vote all officers!");
    ErrorText.setColor(sf::Color::White);
 
    IncompleteVotes.draw(ErrorText);
    IncompleteVotes.display();
 
}
 
Thank you.
Edited by Meerul264

Share this post


Link to post
Share on other sites

I don't see where you specify where in the window to draw the text.

 

BTW, these SFML specific questions can readily be answered at the very active SFML forums at sfml-dev.org.

 

Good Luck

Share this post


Link to post
Share on other sites

This topic is 1826 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this