1
Graphics / How move rectangle ?
« on: October 30, 2011, 03:17:34 pm »
like this?
Code: [Select]
#include "libs.h"
using namespace std;
int main()
{
sf::Event Event;
sf::IntRect r1(400, 400, 800, 800);
sf::Image test;
test.LoadFromFile("background.png");
sf::Sprite test2;
test2.SetImage(test);
test2.SetSubRect(r1);
sf::RenderWindow Window(sf::VideoMode(800,600,32),"aaa");
while(Window.IsOpened())
{
while(Window.GetEvent(Event))
{
//Close Window
if(Event.Type == sf::Event::Closed)
Window.Close();
}
// Window.Clear(sf::Color( 125,125,125 ));
Window.Draw(test2);
Window.Display();
}
return 0;
}