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

Author Topic: [IDEA] Move sf::Rect into System Module?  (Read 9737 times)

0 Members and 2 Guests are viewing this topic.

coolhome

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
[IDEA] Move sf::Rect into System Module?
« on: August 22, 2011, 05:25:47 am »
Hello SFML Community!

I was looking over the library and every time I use sf::Rect I always include the system module. However I always forget its in the Graphics Module. Wouldn't it make more sense to put it in the systems module? Just an idea. Nothing to important. Just in my opinion I think it would have a better home in the system module.

-coolhome
CoderZilla - Everything Programming

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
[IDEA] Move sf::Rect into System Module?
« Reply #1 on: August 22, 2011, 08:44:18 am »
sf::Rect is a graphical class, I don't know why the system module would be a better home for it ;)
Laurent Gomila - SFML developer

Walker

  • Full Member
  • ***
  • Posts: 181
    • View Profile
[IDEA] Move sf::Rect into System Module?
« Reply #2 on: August 22, 2011, 05:26:47 pm »
How is it a graphical class? I can't render one  :lol:

I tend to use sf::Rect mostly for collision detection.

It seems like it could fit alongside the Vector classes in System quite well but I do see why it is in the Graphics module in the first place.

Mr. X

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
[IDEA] Move sf::Rect into System Module?
« Reply #3 on: August 22, 2011, 05:36:18 pm »
I think, sf::Rect is similar to sf::Vector2 and sf::Vector3, which belong to sfml-system. They are all classes which can not be rendered and consist of numbers to be used for calculations. Thus I agree to coolhome and Walker that it should be moved to sfml-system. If you think, sf::Rect should be in sfml-graphics, then sf::Vector2/3 should be in sfml-graphics as well.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
[IDEA] Move sf::Rect into System Module?
« Reply #4 on: August 22, 2011, 05:45:16 pm »
The thing is for SFML the sf::Rect class is only used in the graphics module while Vector2 and Vector3 is used in a lot of other modules besides graphics.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
[IDEA] Move sf::Rect into System Module?
« Reply #5 on: August 22, 2011, 08:37:06 pm »
I wish Vector2 could be in sfml-graphics but Vector3 is used in sfml-audio so it's more consistent to have them grouped in sfml-system.

Rect cannot be rendered but it stores 2D coordinates, which makes no sense in windowing/networking/audio. That's why I said it's a graphical class.
Laurent Gomila - SFML developer

Haikarainen

  • Guest
[IDEA] Move sf::Rect into System Module?
« Reply #6 on: August 22, 2011, 08:39:29 pm »
I agree with coolhome, it really doesn't have to be a graphical class, even though it currently only is used for that. A more appropriate  place for it would be the systemlibrary indeed.

It basically just is a 2d vector with 2 extra parameters to define the dimensionsize, and is often used for more than pure graphics. At least thats how i see it.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
[IDEA] Move sf::Rect into System Module?
« Reply #7 on: August 22, 2011, 08:55:55 pm »
Quote from: "Laurent"
Rect cannot be rendered but it stores 2D coordinates, which makes no sense in windowing/networking/audio. That's why I said it's a graphical class.
At least the Window module also uses sf::Rect (for the viewport). Do you find it okay that Window depends on Graphics? :P :D

The System module might indeed be a better place for sf::Rect. It also preserves you the freedom to use it somewhere else one day, without breaking the user's include paths.
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
[IDEA] Move sf::Rect into System Module?
« Reply #8 on: August 22, 2011, 09:59:31 pm »
Quote
At least the Window module also uses sf::Rect (for the viewport). Do you find it okay that Window depends on Graphics?

???
Window doesn't depend on Graphics, and doesn't use sf::Rect.
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
[IDEA] Move sf::Rect into System Module?
« Reply #9 on: August 22, 2011, 10:03:21 pm »
Ah, sorry. I thought sf::View would be in the Window module, since sf::Window is. I wasn't aware that GetView() is only introduced in sf::RenderWindow, but it makes sense.

Nevertheless, the second paragraph still applies ;)
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
[IDEA] Move sf::Rect into System Module?
« Reply #10 on: August 22, 2011, 10:14:13 pm »
Yeah... I admit that it's not a bad idea.

... Maybe :lol:
Laurent Gomila - SFML developer

coolhome

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
[IDEA] Move sf::Rect into System Module?
« Reply #11 on: August 23, 2011, 05:11:51 am »
Quote from: "Laurent"
Yeah... I admit that it's not a bad idea.

... Maybe :lol:

At least he is slightly considering it :D
CoderZilla - Everything Programming

Disch

  • Full Member
  • ***
  • Posts: 220
    • View Profile
[IDEA] Move sf::Rect into System Module?
« Reply #12 on: August 23, 2011, 05:26:00 am »
I understand Laurent's hesitation.  It isn't as cut and dry as it may seem.

Sure Rect might seem strange in the Graphics module.  But really, when you think about it, is it any less strange than the System module?  What does Rect have to do with the system?  At least in the Graphics module it has applications.

To me, the real question is, how are these modules defined?  I get the impression that people here have the idea that the System module is sort of like a catch-all for the classes that don't fit anywhere else.  But is that really the intent?

Perhaps a solution here is to introduce another module for one-off classes that don't fit anywhere else, like the Vectors, Rect, etc.  But that's probably more trouble than it's worth.

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
[IDEA] Move sf::Rect into System Module?
« Reply #13 on: August 23, 2011, 10:30:18 am »
I understand "sfml-system" as being a sub-library both for system and core things.

I agree that sf::Rect would be better placed in sfml-system. Sure, it's mostly used for graphics, but it's really an absolute core feature that can be used without using the graphics library at all, which I currently *have to* use, just for a plain rect structure.

I always accidently write "#include <SFML/System/Rect.hpp>" before I fix it to ".../Graphics/...". ;)

(note to myself: I should not start every line with "I")

omeg

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
    • http://omeg.pl/
[IDEA] Move sf::Rect into System Module?
« Reply #14 on: August 23, 2011, 10:41:04 am »
Another thing to keep in mind is that for example in SFML.Net there is no System library since it's not needed, all its functionality is in base class library anyway. ;)

 

anything