Im really confused what is wrong in my code :shock:
All is fine but the sprite is full displayed and not only it's subrect.
#include "Racetrack.hpp"
int main()
{
// Create the main rendering window
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");
Racetrack::Init ("data/Track2.png");
Racetrack track1;
track1.GetSprite ().SetSubRect (sf::IntRect (100, 100, 200, 200) );
// Start game loop
while (App.IsOpened())
{
// Process events
sf::Event Event;
while (App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
App.Close();
}
// Clear the screen (fill it with black color)
App.Clear(sf::Color (sf::Uint8 (40), sf::Uint8 (200), sf::Uint8 (30) ) );
App.Draw (track1.GetSprite () );
// Display window contents on screen
App.Display();
}
return EXIT_SUCCESS;
}