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 - asdfghjkSHfkgAD,kgaSkd

Pages: [1]
1
General discussions / New graphics API ready
« on: December 30, 2011, 05:09:34 am »
Quote from: "Laurent"

Quote
The old one-liners like rt.Draw(sf::Shape::Rectangle(...)) are no longer available. I thought they're rather handy for quick debug drawings. sf::RectangleShape isn't a real perfect replacement due to lacking constructor parameter (you should still be able to set position, colors and thickness through the constructor).

The list of arguments would be really huge, and not as clear as calling individual setters.
Is it really important to be able to fully construct and configure a shape with one line of code?


I signed up for an account specifically to ask if the old one-liners could be put back into the API. I use them all over the place to add things like borders or bezels around pictures or text. I understand that I can still do this with the RectangleShape class, but if I have to draw 30 rectangles I would much rather write

Code: [Select]
Window.Draw( Shape::Rectangle( ... ) );

rather than

Code: [Select]

RectangleShape rect;
rect.SetPosition( ... );
rect.SetSize( ... );
rect.SetFillColor( ... );
rect.SetOutlineColor( ... );
rect.SetOutlineThickness( ... );
Window.Draw( rect );


I understand that the one-liner isn't as clear as calling the individual setters but that doesn't mean that it should be taken out. For example, if I just want to quickly draw a rectangle around a sprite during a debugging session to confirm that the bounding box is what I expect it to be, I don't need the clarity that using the setters would give, I just want to quickly write the single line of code and move on.

As Nexus said, we could write our own function or macro to get back the one-line functionality, but considering that the functions were already in SFML and are now being removed it seems like a straight downgrade with no upside.

Pages: [1]
anything