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 - Hawkpath

Pages: [1]
1
Graphics / Solved
« on: January 14, 2011, 03:35:23 am »
Thank you so much!! It turned out that I was defining the rectangle, then setting the position when I didn't need to set the position. Thanks!

2
Graphics / Drawing a click and drag rectangle?
« on: January 14, 2011, 02:22:08 am »
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:

Code: [Select]
 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]

3
Window / Getting coordinates from views?
« on: January 05, 2011, 03:53:39 pm »
Hey I am making a program and I need it to be a "pannable" program. I need to be able to move around a view that is larger than the screen. So when detecting mouse clicks with window.GetInput().GetMouseX() does that give me the x coordinate of the screen, or the x coordinate of the mouse in the view? If this is the x coordinate in the screen, is there a way to get where the user clicks in the entire view? Thanks for any help.

4
Graphics / Displaying user-created objects??
« on: September 11, 2010, 12:45:00 am »
Hi. In my program I'm trying to let the user click anywhere on the screen and the program will draw a circle there. I get the coords using GetMouseX amd GetMouseY. How would I redraw these in the main loop? I tried making an array, but I get errors. Is there some easy, commonly used method for displaying objects created while the program is running?

Pages: [1]
anything