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

Author Topic: Some ideas  (Read 3345 times)

0 Members and 1 Guest are viewing this topic.

Acrobat

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Some ideas
« on: May 24, 2012, 10:37:58 am »
Hi, I'm working with SFML 2.0 for a while, and I want to throw up some ideas
1. Class Drawable have only draw method (for now), but you can see the inherited drawables have methods like getLocalBound etc. maybe they can be pure virtual in drawable ?
2. It's very hard to extend default sprite, text, etc. If you are working on something, first you want to do is to create your own object, container, and inherited drawables. This can be easily solved.
3. Sometimes it's very usefull to override function like setPosition, setScale, setRotation etc. Is there something that they can't be virtual ?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Some ideas
« Reply #1 on: May 24, 2012, 10:43:44 am »
You're trying to use SFML exactly the way I don't want people to use SFML ;)

Use SFML classes as building blocks for your own design, not as a framework.
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Some ideas
« Reply #2 on: May 25, 2012, 06:42:06 pm »
By the way, you're taking the typical Java approach to extend functionality: Namely to inherit classes and to override methods. That works sometimes, but there are many other ways in C++ which should sometimes be preferred. Don't forget that inheritance is a very strong dependency between classes which isn't always worth the disadvantages.
« Last Edit: May 25, 2012, 06:53:31 pm by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything