Hey, I would like to draw a rectangle that resizes when the user move the mouse. Like when you click and drag on a desktop. I tried doing it with this code:
while(drag){
while(StartWindow.GetEvent(Event)){
sf::Vector2f coords = StartWindow.ConvertCoords(StartWindow.GetInput().GetMouseX(),StartWindow.GetInput().GetMouseY());
x2 = coords.x;
y2 = coords.y;
rectangle = sf::Shape::Rectangle(x,y,x2,y2,sf::Color::Blue,1,sf::Color::Red);
StartWindow.SetView(StartWindow.GetDefaultView());
rectangle.SetPosition(x,y);
StartWindow.Draw(rectangle);
}
This code is pretty incomplete, but its supposed to make a drag-able rectangle selection tool. This does draw the rectangle, but not where the the user clicks. Can anyone help me with this code, or suggest some new code? Thanks.
[/code]