I just tried .Scale() and it seems to work quite well, but there's a curious error. The scale-factor clearly isn't based in the center of the object, since one side is clearly growing much more than the other.
Do you need to .SetCenter() first? Because I tried that and it came out a bit crazy.
shape.SetCenter(shape.TransformToLocal(sf::Vector2f(CurrentView.GetCenter().x,950))); shape.Scale(CurrentView.GetHalfSize().x/oldview.GetHalfSize().x,1);
That gets the center of the screen at 950 in depth (the depth of the line), transforms that coordinate into local shape coordinates and sets that as its center, right? And then I get the ratio between the oldview and the newview and scale accordingly, right?
That seems to work reasonably, except for the fact that TransformToLocal doesn't do that. I check the step-by-step and the Local and Global coordinates are exactly the same. That makes sense in regards to the x-value, since I always want the line to start at the window's edge, but the y-value should be 0 (or close, since there's thickness).
Due to this error, zooming out causes the line to move vertically as well as scale horizontally (which I just noticed makes no sense). As well, the line moves up, not down. Does this mean the local coordinate system is y-positive (while the global is clearly y-negative, i.e. y-values increase the lower you go)?
Without .SetCenter(), the scaling works almost fine. The line is extended, it remains at its position, but the scaling is uneven. One side is extended beyond the screen while the other end can be seen. If you pan to the side, the new length fits perfectly, but... well, you shouldn't have to pan. :?
EDIT: Just saw your reply and simply replaced the old line with a new version of it and that works fine. Not to mention it's way simpler. Thanks for staying with me all day today. :p
EDIT2: And a Line most certainly has 5 points.
This code:
shape = sf::Shape::Line(CurrentView.GetCenter().x-CurrentView.GetHalfSize().x,950,CurrentView.GetCenter().x+CurrentView.GetHalfSize().x,950,0.003f,sf::Color(0,128,128),t,sf::Color(0,128,128));
If done with the step-by-step, gives the following points:
- position (378... , 950.0)
[1] position (-848... , 949...)
[2] position (1606... , 949...)
[3] position (1606... , 950...)
[4] position (-848... , 950...)
Obviously, the values themselves are irrelevant other than to show that they're not even repeated.