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

Author Topic: deriving from sf::RenderWindow class  (Read 1764 times)

0 Members and 1 Guest are viewing this topic.

lorence30

  • Full Member
  • ***
  • Posts: 124
    • View Profile
    • Email
deriving from sf::RenderWindow class
« on: July 05, 2015, 05:42:32 pm »
Im trying to derived from sf::RenderWindow class.
and my question is what are my disadvantages if i do this?

Hapax

  • Hero Member
  • *****
  • Posts: 3351
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: deriving from sf::RenderWindow class
« Reply #1 on: July 05, 2015, 08:10:57 pm »
May I ask why?
What changes would you be making and what would the derived class be?
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

lorence30

  • Full Member
  • ***
  • Posts: 124
    • View Profile
    • Email
Re: deriving from sf::RenderWindow class
« Reply #2 on: July 05, 2015, 08:34:13 pm »
Just a WindowManager class that has full of static members.
and i dont have any plan on changing the sf::RenderWindow class.
« Last Edit: July 05, 2015, 08:44:32 pm by lorence30 »

Hapax

  • Hero Member
  • *****
  • Posts: 3351
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: deriving from sf::RenderWindow class
« Reply #3 on: July 05, 2015, 08:51:53 pm »
It then may be a better choice to just store a RenderWindow as a member.

There's the whole thing about class inheritance where if you inherit from some other class, then it becomes one. "is a"...
"WindowManager is a RenderWindow" doesn't make sense so inheritance is probably not the right choice here.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

lorence30

  • Full Member
  • ***
  • Posts: 124
    • View Profile
    • Email
Re: deriving from sf::RenderWindow class
« Reply #4 on: July 06, 2015, 05:25:41 pm »
@Hapax
got it! thanks man!

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: deriving from sf::RenderWindow class
« Reply #5 on: July 06, 2015, 06:57:07 pm »
Im trying to derived from sf::RenderWindow class.
and my question is what are my disadvantages if i do this?
"Why not" is the wrong question. If you do something, you should have a good reason to do it in the first place, not have no reason against it.

Just a WindowManager class that has full of static members.
:o ... and you call that "just"

Don't do that. Both "managers" without clear area of responsibility and "full of static members" are very bad habits. They seem to simplify things, but make everything more complex as soon as you move away from the most basic designs.

Find a good use case for your class, and name it appropriately. Split where necessary.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything