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

Author Topic: Drawable to Image  (Read 4371 times)

0 Members and 1 Guest are viewing this topic.

vgvgf

  • Newbie
  • *
  • Posts: 6
    • MSN Messenger - vgvgvgf@gmail.com
    • View Profile
    • http://everempire.net/
    • Email
Drawable to Image
« on: July 05, 2009, 01:39:57 am »
I want to draw a Drawable object on an Image, specificaly a String object on an Image. I know that this is on the roadmap, and is planned to be done. But I don't want to wait.

Basicaly what I want to do is to draw a text on an Image, so I was thinking on drawing a String on the Image, but any method should be fine, like using another library for drawing the text.
So, how could this be done? Or at least, can someone point me on the right direction for doing so?

Thanks in advance.

K-Bal

  • Full Member
  • ***
  • Posts: 104
    • View Profile
    • pencilcase.bandcamp.com
    • Email
Drawable to Image
« Reply #1 on: July 05, 2009, 01:47:11 am »
You could derive a class from sf::Drawable that contains a normal sf::Sprite and a sf::String.
Listen to my band: pencilcase.bandcamp.com

vgvgf

  • Newbie
  • *
  • Posts: 6
    • MSN Messenger - vgvgvgf@gmail.com
    • View Profile
    • http://everempire.net/
    • Email
Drawable to Image
« Reply #2 on: July 05, 2009, 01:52:57 am »
I have thought doing so, but if I want to draw something over the image, the text wouldn't be affected.

K-Bal

  • Full Member
  • ***
  • Posts: 104
    • View Profile
    • pencilcase.bandcamp.com
    • Email
Drawable to Image
« Reply #3 on: July 05, 2009, 11:15:24 am »
Then you would need a second sprite that is transparent by default. When you draw something you draw on this sprite.
Listen to my band: pencilcase.bandcamp.com

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Drawable to Image
« Reply #4 on: July 05, 2009, 01:13:25 pm »
Rendering to an image is already implemented in the sfml2 branch.
Laurent Gomila - SFML developer

vgvgf

  • Newbie
  • *
  • Posts: 6
    • MSN Messenger - vgvgvgf@gmail.com
    • View Profile
    • http://everempire.net/
    • Email
Drawable to Image
« Reply #5 on: July 05, 2009, 06:34:19 pm »
Thanks, I will check the svn now  :D

vgvgf

  • Newbie
  • *
  • Posts: 6
    • MSN Messenger - vgvgvgf@gmail.com
    • View Profile
    • http://everempire.net/
    • Email
Drawable to Image
« Reply #6 on: July 09, 2009, 01:36:51 am »
I have checked the sources of sfml2 branch, and I can't find how to make this. Can you give me a simple example?

Edit: I have found now how to do so, but I am having the message that RenderImage isn't supported by my system. Any fix for this?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Drawable to Image
« Reply #7 on: July 09, 2009, 07:55:31 am »
What is your OS and graphics card?

RenderImage is widely supported on Windows, 50% on Linux and not implemented yet on Mac OS X.
Laurent Gomila - SFML developer

vgvgf

  • Newbie
  • *
  • Posts: 6
    • MSN Messenger - vgvgvgf@gmail.com
    • View Profile
    • http://everempire.net/
    • Email
Drawable to Image
« Reply #8 on: July 09, 2009, 06:24:12 pm »
I am using Windows XP SP3, and I have a pretty old PC. The graphic card is VIA/S3G UniChrome IGP - 32MB of memory.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Drawable to Image
« Reply #9 on: July 09, 2009, 06:58:45 pm »
Your last chance is to render your text to the screen and capture it :?
Laurent Gomila - SFML developer