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 - paul.mihaita

Pages: 1 [2]
16
Graphics / Error, window.draw
« on: March 14, 2013, 05:15:09 pm »
Hey guys, i'm new at sfml. I want to draw 2 images but i get 2 errors:
25|error: 'desenbackground' was not declared in this scope|
26|error: 'desenpatrat' was not declared in this scope|

here is the code

#include <SFML/Graphics.hpp>
int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
    while (window.isOpen())
    {
         sf::Texture texture;
         if (!texture.loadFromFile("Background.png"))
            return EXIT_FAILURE;
         sf::Sprite desenbackground(texture);
         if (!texture.loadFromFile("Patrat.png"))
            return EXIT_FAILURE;
         sf::Sprite desenpatrat(texture);
    }
    while (window.isOpen())
     {
         sf::Event event;
         while (window.pollEvent(event))
         {
             if (event.type == sf::Event::Closed)
                 window.close();
         }

         window.clear();
         window.draw(desenbackground);
         window.draw(desenpatrat);
         window.display();
     }

     return EXIT_SUCCESS;
 }

Pages: 1 [2]
anything