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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - virelio

Pages: [1]
1
General discussions / SFML 2.0 vector of drawable
« on: January 26, 2012, 12:23:17 am »
Thank you very much for this complete and clear example.

I've made one more step into c++

I've also read :
http://alp.developpez.com/tutoriels/type-erasure/ (in french)
http://www.cplusplus.com/forum/articles/18756/ (in english)

but your little example is far clearer for me.  :D

Olivier/Virelio

2
General discussions / SFML 2.0 vector of drawable
« on: January 25, 2012, 01:15:07 pm »
Hello !

Quote
via type erasure


How to do that ? I know you have to use template but I do not see how to write such  class... If I well understand, it's a way to create an common ancestor afterwards. Do I mistake myself ?

thanks in advance,

Olivier/Virelio

3
General discussions / SFML 2.0 vector of drawable
« on: January 23, 2012, 10:57:26 pm »
Back,

Laurent, Don't change anything it's perfect and incredibly easy !

You can mix all together if you want to draw with polymorphism. You can apply complex transformations very easily with sf::transform or sf::transformable appart of rendering.

I have to think how to rewrite my code but it sure give me more clearness...


 :D

Olivier/Virelio

4
General discussions / SFML 2.0 vector of drawable
« on: January 23, 2012, 10:25:52 pm »
Ok Laurent, I have to dive deeper in the API.

I glanced on... I'll test some basic. I'll be back to tell you my feeling.

thank you for your workssssss !

5
General discussions / SFML 2.0 vector of drawable
« on: January 23, 2012, 09:20:58 pm »
Hi !

I agree with you. Polymorphism is a powerfull C++ feature.

In SFML, you should use basic class to make your own while keeping the easy way to move and render. I think SFML is easy to use and manage except this little minus  :?

sf::Whatever only need one empty constructor and a virtual destructor... Am I right ?

best regard,

Olivier/Virelio

6
General discussions / SFML 2.0 vector of drawable
« on: January 23, 2012, 07:33:13 pm »
Thanks for your (as usual) quick answer,

I used to add all my "drawables" and inherited objects in one vector ; then I can test each in queue and draw them without knowing if it's a text or a sprite. I have a vector<sf::Drawable*> and the right "render" was called.


I think that this class diagram is convenient to handle all "drawable". (You could have BaseDrawable and Drawable). I would like to inherite from "sf::Whatever"
You have, at least, to give a position to each "Drawable" you plan to draw, so Transformable is quite always here (unless you use fixed position VertexArray)

So what is your thought about this ?

Olivier/Virelio

7
General discussions / SFML 2.0 vector of drawable
« on: January 23, 2012, 08:40:27 am »
Hi,

I was looking at the new API of SFML 2 graphics. It looks nice.

I used to manage text, sprite and shape with std::vector<sf::Drawable*>. Now there is no more common ancestor because they inherite from sf::Transformable too.

Is there a way to do such vector organisation with SFML 2.0 ?

best regard,

Pages: [1]
anything