SFML community forums

Help => Graphics => Topic started by: aisman on April 16, 2008, 10:55:04 am

Title: How can I draw a shape to a sprite?
Post by: aisman on April 16, 2008, 10:55:04 am
I want to draw my own sprites.
Can I draw a shape to a sprite for this?
Title: How can I draw a shape to a sprite?
Post by: Laurent on April 16, 2008, 11:56:30 am
Can you give more details ? What does "my own sprites" mean ? What does "draw a shape to a sprite" means ? Are you talking about render-to-image ?
Title: How can I draw a shape to a sprite?
Post by: aisman on April 16, 2008, 12:32:39 pm
See this pseudo code, hope you understand me now

Code: [Select]
sf::Sprite mySprite(...);
sf::Shape myShape = sf::Shape::Circle(...);
mySprite.Draw(myShape)

while (App.IsOpened())
    {
      ...
      App.Draw(mySprite);

        // Display things on screen
        App.Display();
    }
Title: How can I draw a shape to a sprite?
Post by: Laurent on April 17, 2008, 03:34:52 am
Ok, so you'll have to wait for the render-to-image feature, which should be done in the next version (hopefully) :)

However, I don't know if it's just for the example, but if you just want to pre-render one shape if may be not worth it.
Title: How can I draw a shape to a sprite?
Post by: aisman on April 17, 2008, 07:11:55 am
Quote from: "Laurent"
1) Ok, so you'll have to wait for the render-to-image feature, which should be done in the next version (hopefully) :)

2) However, I don't know if it's just for the example, but if you just want to pre-render one shape if may be not worth it.

1) Fine. Currently not in the SVN?
2) You are right. It is a bad example.

The  render-to-image feature has the same feature as the render-to-window has, right?

- Render string to an image
- Render image to an image
- Render shape to an image
- etc...
Title: How can I draw a shape to a sprite?
Post by: Laurent on April 17, 2008, 07:58:19 am
Quote
1) Fine. Currently not in the SVN?

No, I haven't started working on it yet.

Quote
The render-to-image feature has the same feature as the render-to-window has, right?

Yep, should be exactly the same interface, just the target of the rendering will change (an image instead of a window).