Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - mindoo

Pages: [1]
1
Graphics / SFML Project not rendering shapes
« on: November 01, 2016, 07:15:24 pm »
I'm currently trying to learn how to use the sfml api, but my whole draw function doesn't work and doesn't display anything. I did put breakpoints and verified that the program does go through that function, and it does, but it still doesn't work.

This is my function that doesn't work :
void GameStateStart::draw() {

    this->game->window.clear();

    /*Modify the colour of the background*/
    background.getRectangle().setFillColor(sf::Color::Green);
    background.drawObject(&game->window);

    /*Create the font for the text*/
    sf::Font font;
    font.loadFromFile("Pacifco.ttf");

    /*Test*/
    sf::Text title2;
    title2.setFillColor(sf::Color::Blue);
    title2.setFont(font);
    title2.setPosition(sf::Vector2f(300, 100));
    title2.setString("Tic Tac SFML");
    title2.setCharacterSize(25);
    this->game->window.draw(title2);

    /*Edit title text objects*/
    title.getText()->setFillColor(sf::Color::Blue);
    title.getText()->setFont(font);
    title.getText()->setPosition(sf::Vector2f(300, 100));
    title.getText()->setString("Tic Tac SFML");

    /*Edit instructions text object*/

    instructions.getText()->setFillColor(sf::Color::Blue);
    instructions.getText()->setFont(font);
    instructions.getText()->setPosition(sf::Vector2f(300, 450));
    instructions.getText()->setString("Press the spacebar to continue");

    /*draw the 2 text objects*/
    title.drawObject(&this->game->window);
    instructions.drawObject(&this->game->window);

    this->game->window.display();

    return;
}

Pages: [1]
anything