Jump to content

  • Log In with Google      Sign In   
  • Create Account


[SFML] Text not drawn problem


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Meerul264   Members   -  Reputation: 130

Like
0Likes
Like

Posted 16 January 2013 - 10:47 AM

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, 16 January 2013 - 10:49 AM.


Sponsor:

#2 BeerNutts   Crossbones+   -  Reputation: 2860

Like
0Likes
Like

Posted 16 January 2013 - 02:02 PM

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


My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS