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

Author Topic: How can I draw a shape to a sprite?  (Read 5045 times)

0 Members and 1 Guest are viewing this topic.

aisman

  • Newbie
  • *
  • Posts: 25
    • View Profile
How can I draw a shape to a sprite?
« 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?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
How can I draw a shape to a sprite?
« Reply #1 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 ?
Laurent Gomila - SFML developer

aisman

  • Newbie
  • *
  • Posts: 25
    • View Profile
How can I draw a shape to a sprite?
« Reply #2 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();
    }

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
How can I draw a shape to a sprite?
« Reply #3 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.
Laurent Gomila - SFML developer

aisman

  • Newbie
  • *
  • Posts: 25
    • View Profile
How can I draw a shape to a sprite?
« Reply #4 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...

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
How can I draw a shape to a sprite?
« Reply #5 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).
Laurent Gomila - SFML developer