SFML community forums
General => Feature requests => Topic started by: Nexus on January 16, 2009, 02:01:57 pm
-
Hi, half a year ago I posted in this (http://www.sfml-dev.org/forum/viewtopic.php?p=3499) thread (the second page is relevant). My concern was to clean some of the inconsistences in member function names and to make the interfaces more uniform.
For example, sf::String and sf::Sprite are somehow accessed quite differently, although they have many functionality in common.
- sf::Sprite::GetSize() returns a sprite's width/height.
- In contrast, sf::String::GetSize() returns the character size. I would appreciate something like the font's method GetCharacterSize(), in my opinion that was clearer.
- Instead of GetSize(), there is a GetRect() function at strings, but not at sprites. I'd prefer a GetSize() method like at sprites.
Or sf::View:
- GetRect() to get the rectangle on the screen
- GetCenter() and GetHalfSize() to get two 2D-Vectors which contain the same information as the rect.
Accessing the width and height:
- sf::RenderWindow, sf::Rect, sf::Image have got GetWidth() and GetHeight() functions.
- sf::Sprite has got a GetSize() method.
Here I think that is quite okay, since sprites are used in coordinate systems of the screen. But the sf::Rect seems to me sometimes a little bit questionable (for example at sf::String or sf::View), especially when they can easily be replaced by 2D-vectors. In my honest opinion, sf::String should get a GetSize() method and lose the GetRect() method instead. There is no loss of information as long as there are GetCenter(), GetPosition() and GetSize().
What do you think about those identifiers?
-
It would not give SFML an improved functionallity...
Unnecessary, i think.
EDIT: But maybe good for beginners...
-
It would not give SFML an improved functionallity...
Unnecessary, i think.
It would make the interface more consistent and easier to understand (not only for beginners). Don't you consider this an improvement?
-
It would not give SFML an improved functionallity...
Unnecessary, i think.
It would make the interface more consistent and easier to understand (not only for beginners). Don't you consider this an improvement?
OK, its an improvement for the Overlay of SFML. But it does not include more or improved functionality.
-
It's interesting.
Some of the inconsistencies in drawable classes will be fixed after I finish this task (http://www.sfml-dev.org/todo/index.php?do=details&task_id=2).
Then I'll probably think about the other ones.
-
Okay, thank you. Just don't hurry, it's not that urgent. ;)
-
How do you see this meanwhile? I think now there's a good opportunity to adapt the interface of the sfml-2 branch, since there are also other changes like GetOrigin().
For me, the points remain quite the same ones as stated in the first post.
-
I've already fixed a few inconsistencies. I think most of them will be fixed when I rewrite geometry handling in drawable classes.
Anyway, thanks for the reminder :)