Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Fix inconsistent identifiers  (Read 22889 times)

0 Members and 1 Guest are viewing this topic.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Fix inconsistent identifiers
« on: January 16, 2009, 02:01:57 pm »
Hi, half a year ago I posted in this 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?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Mr. X

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Fix inconsistent identifiers
« Reply #1 on: January 16, 2009, 06:47:42 pm »
It would not give SFML an improved functionallity...
Unnecessary, i think.

EDIT: But maybe good for beginners...

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Fix inconsistent identifiers
« Reply #2 on: January 16, 2009, 07:11:26 pm »
Quote from: "Mr. X"
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?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Mr. X

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Fix inconsistent identifiers
« Reply #3 on: January 16, 2009, 10:21:32 pm »
Quote from: "Nexus"
Quote from: "Mr. X"
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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Fix inconsistent identifiers
« Reply #4 on: January 16, 2009, 10:58:45 pm »
It's interesting.

Some of the inconsistencies in drawable classes will be fixed after I finish this task.

Then I'll probably think about the other ones.
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Fix inconsistent identifiers
« Reply #5 on: January 16, 2009, 11:21:48 pm »
Okay, thank you. Just don't hurry, it's not that urgent. ;)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Fix inconsistent identifiers
« Reply #6 on: June 14, 2009, 12:22:54 pm »
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.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Fix inconsistent identifiers
« Reply #7 on: June 14, 2009, 12:41:19 pm »
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 :)
Laurent Gomila - SFML developer

 

anything