61
Network / Re: FTP Status 1002
« on: January 03, 2015, 11:45:35 pm »
Oh...well, I guess it would be nice if the tutorial or documentation mentioned this somewhere.
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.
When you use a custom view, or when you resize the window without using the code above, pixels displayed on the target no longer match units in the 2D world. For example, clicking on pixel (10, 50) may hit the point (26.5, -84) of your world. You end up having to use a conversion function to map your pixel coordinates to world coordinates: mapPixelToCoords.// get the current mouse position in the window
sf::Vector2i pixelPos = sf::Mouse::getPosition(window);
// convert it to world coordinates
sf::Vector2f worldPos = window.mapPixelToCoords(pixelPos);
By default, mapPixelToCoords uses the current view. If you want to convert the coordinates using view which is not the active one, you can pass it as an additional argument to the function.
The opposite, converting world coordinates to pixel coordinates, is also possible with the mapCoordsToPixel function.
Shouldn't I call clear inside 'someFun' as well? The display idea makes sense,It's exactly the same for clear and display. You call them exactly once per frame in the main game loop, and each entity only worries about how to draw itself.
Also since 'theta' would keep incrementing, wouldn't this eventually cause the game to crash since 'theta' would keep increasing towards infinity?I don't see why big numbers would make things crash (the sin() and cos() functions can handle larger angles than that), but you're right, I should I have put a modulo 2pi in there.
I am still unclear though how your code will work. What would the loop that calls your 'draw' look like inside the game loop?