SFML community forums

Help => Graphics => Topic started by: AlexAUT on December 27, 2012, 11:41:30 am

Title: [Solved] sf::Text with sf::Rectangle Problem
Post by: AlexAUT on December 27, 2012, 11:41:30 am
Hello,
first of all here a two Screenshots wich shows my Problem

(http://image-upload.de/image/lcxVzq/4349b4d06a.jpg)


(http://image-upload.de/image/DEgnw2/516cc1c293.png)

OS: Win8 Pro 64bit
GPU : ATI HD 6850

The Problems appears when i draw a VertexArray, a Shape and a Text in the same frame. But i dont know if its a Problem in my Code, a Problem in SFML or a Problem with the Driver OS...

I hope some of you can test the app and can help me...

#include <iostream>
#include <SFML/Graphics.hpp>



int main()
{
    sf::RenderWindow win(sf::VideoMode(800,640,32), "Bug Test", 7);

    win.setFramerateLimit(120);

    sf::Font font;
    font.loadFromFile("arial.ttf");

    sf::Text text;
    text.setFont(font);
    text.setString("Hallo");
    text.setPosition(20,20);
    text.setCharacterSize(20);
    text.setColor(sf::Color::Black);


    sf::RectangleShape rect;
    rect.setPosition(20,20);
    rect.setFillColor(sf::Color::Green);
    rect.setSize(sf::Vector2f(100,100));

    sf::VertexArray arrayV;
    arrayV.setPrimitiveType(sf::Quads);
    arrayV.append(sf::Vertex(sf::Vector2f(10, 10), sf::Color::Yellow));
    arrayV.append(sf::Vertex(sf::Vector2f(100, 10), sf::Color::Yellow));
    arrayV.append(sf::Vertex(sf::Vector2f(100, 100), sf::Color::Yellow));
    arrayV.append(sf::Vertex(sf::Vector2f(10, 100), sf::Color::Yellow));

    while(win.isOpen())
    {
        sf::Event e;

        while(win.pollEvent(e))
        {
            if(e.type == sf::Event::Closed)
                win.close();

            if(e.type == sf::Event::KeyPressed)
            {
                if(e.key.code == sf::Keyboard::Escape)
                    win.close();
            }
        }

        win.clear(sf::Color::Blue);
        win.draw(arrayV);
        win.draw(rect);
        win.draw(text);

        win.display();
    }


    return 0;
}

 

Title: Re: sf::Text with sf::Rectangle Problem
Post by: eXpl0it3r on December 27, 2012, 11:56:51 am
See http://en.sfml-dev.org/forums/index.php?topic=9561.0 and make use of http://en.sfml-dev.org/forums/index.php?action=search . ;)
Title: Re: sf::Text with sf::Rectangle Problem
Post by: AlexAUT on December 27, 2012, 12:23:35 pm
Thank you!  8)