SFML community forums
Help => Graphics => Topic started by: kafkadaffi on June 30, 2009, 03:35:48 am
-
Hi I was wondering if there is any possible way of doing the following...
Imagine that I have an object, that has a render method and that method
renders a matrix/grid of sprites. eg. 10 times 10 sprites.
Is it possible to rotate that grid in whole. I have tried to rotate each individual sprite with a proper offset and that just looks bananas.
I guess I would like to render the sprites to another sprite and then rotate that grouping sprite, but that is not possible. Is there any other way of doing this?
-
Just put your grid of sprites into a class that inherits from sf::Drawable. Then all the transformations of this drawable will be combined with the sprites' ones.
-
Are you sure? I must have done something wrong.
I have setup an Object that inherits from sf::Drawable and then I override the Render() method, where I render say two different sprites. Sofar sogood, I see the sprites being rendered ok.
But transformation on that Object containing those sprites does exactly nothing to my contained sprites. I have hard time to think how it can ever.
-
Ah, my Bad!
I called Render of the compositing sprite with the target as parameter instead of calling Draw(&Drawable ) passing a reference to the compositing sprite. Clearly there is a difference.
m_tSprite.Render(*m_pMainWindow); // Renders without parent obj. Translations and etc.
m_pMainWindow->Draw(m_tSprite); // Renders using translations and etc.
Now it works like a clockwork! :lol:
Come to think of it, It was fully possible to override the protected virtual Render( ) with a public one exposing the method.