106
Feature requests / Vectors and scalar operators
« on: September 23, 2008, 11:11:47 pm »
Laurent, could you add them? Shouldn't take too long..
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.
Quote from: "quasius"The point is, there's no "standard convention."
False.
Did you watch the intellisense list? Or doesn't the code work if you use a GetPosition() method?
In VC++, the intellisense database is sometimes upset. Rebuilding the project or whole solution and deleting the database file (*.ncb) will help.
There is a sf::Drawable::GetPosition method. :shock:
Does it really lead to cleaner code? I figured Vector2f was just for convenience when getting positions.
Setting positions via vectors, however, in my opinion, doesn't really provide much convenience other than when the position is from a get function.
For example, we could make lines that connect dots with this code:Code: [Select]sf::Shape circle1(sf::Shape::Circle(40, 40, 25, sf::Color(255, 255, 255)));
sf::Shape circle2(sf::Shape::Circle(600, 600, 25, sf::Color(255, 255, 255)));
sf::Shape line(sf::Shape::Line(circle1.GetPosition(), circle2.GetPosition(), 5, sf::Color(255, 255, 255)));
Rather than:Code: [Select]sf::Shape circle1(sf::Shape::Circle(40, 40, 25, sf::Color(255, 255, 255)));
sf::Shape circle2(sf::Shape::Circle(600, 600, 25, sf::Color(255, 255, 255)));
sf::Shape line(sf::Shape::Line(circle1.GetPosition().x, circle1.GetPosition().y, circle2.GetPosition().x, circle2.GetPosition().y, 5, sf::Color(255, 255, 255)));
The problem is: Another user will do the same post than you guys.. Maybe with better arguments... Laurent can't change function signature just because of that..... But the overload of the function is not a bad idea...
Well, if I do so, another user will come tomorrow and say that float P1X, float P1Y,float P2X,float P2Y is much clearer / consistent / whatever.
Whenever possible I provide two versions of the functions taking points as parameters, but for those ones I'd like to keep one version.
//Creating a line between a sprite and the mouse pointer
Shape s = Shape::Line(m_sprite.GetPosition().x,m_Sprite.GetPosition().y,m_mouse.x,m_mouse.y...)
Shape s = Shape::Line(m_sprite.GetPosition(),m_mouse.xy,...)
Post-fx tutorials are back, thanks to Google cache.
Should be clearer now