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

Author Topic: Troubles with sf::renderTexture  (Read 1669 times)

0 Members and 1 Guest are viewing this topic.

Introhart

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Troubles with sf::renderTexture
« on: October 29, 2019, 09:17:58 am »
Shortly, I don't really understeand how does it works.

#include <SFML/Graphics.hpp>

int main()
{
        sf::RenderWindow window(sf::VideoMode(600, 400), "Tilemap");

        sf::RenderTexture render;
        render.create(600, 400);
        sf::RectangleShape rect(sf::Vector2f(200,50));
        rect.setFillColor(sf::Color::Red);
        render.draw(rect);

        while (window.isOpen())
        {
                sf::Event event;
                while (window.pollEvent(event))
                {
                        if (event.type == sf::Event::Closed)
                                window.close();


                }
                window.clear(sf::Color::White);
                render.display();
               

                window.display();
               
        }

        return 0;
}
 

What I do wrong?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Troubles with sf::renderTexture
« Reply #1 on: October 29, 2019, 10:44:10 am »
You can find how to use SFML classes either in the official tutorials or the API documentation. For RenderTexture see here: https://www.sfml-dev.org/documentation/2.5.1/classsf_1_1RenderTexture.php#details
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Introhart

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: Troubles with sf::renderTexture
« Reply #2 on: October 29, 2019, 11:04:48 am »
Thank You. You are just Amazing!!!

 

anything