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

Author Topic: Blending Drawable whose Render() calls another Drawable 1.6  (Read 1613 times)

0 Members and 2 Guests are viewing this topic.

Rabenholz

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Blending Drawable whose Render() calls another Drawable 1.6
« on: August 17, 2012, 07:35:51 pm »
Hello, I've just started using SFML 1.6, and I've run into a little problem when implementing animated sprites.

The class extends sf::Drawable and contains an array of sprites. In its Render function AnimatedSprite determines which sprite to draw and calls renderTarget.Draw(currentSprite). Unfortunately, since the blend values are set in the sf::Drawable::Draw() function I have no control over their settings without editing the original sprites.

Is there any way I can blend the AnimatedSprite color with the color of the sprites it contains without editing the color and blending values of the sprites themselves?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Blending Drawable whose Render() calls another Drawable 1.6
« Reply #1 on: August 17, 2012, 08:34:06 pm »
SFML 1.6 is already outdated, if you're starting then use SFML 2.0 (there's a precompiled RC). Then your problem will be solved easily, with the new design of drawable classes.
Laurent Gomila - SFML developer

Rabenholz

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Re: Blending Drawable whose Render() calls another Drawable 1.6
« Reply #2 on: August 17, 2012, 08:47:58 pm »
Oh, in that case, is it easy to transition from SFML 1.6 to 2.0? I've already got a framework built up around 1.6 and I waited to ask this question until I was finished in case I figured out how to do it as I worked with the API.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Blending Drawable whose Render() calls another Drawable 1.6
« Reply #3 on: August 17, 2012, 08:49:37 pm »
Quote
is it easy to transition from SFML 1.6 to 2.0?
It depends. I'd say yes, once you've done the tedious conversion from CamelCase to camelCase for function names.
Laurent Gomila - SFML developer

Rabenholz

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Re: Blending Drawable whose Render() calls another Drawable 1.6
« Reply #4 on: August 17, 2012, 09:14:26 pm »
Okay, I'll get on that. Thank's for your help.

Rabenholz

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • Email
Re: Blending Drawable whose Render() calls another Drawable 1.6
« Reply #5 on: August 22, 2012, 06:51:59 am »
I didn't feel like I should start another topic for this, seeing as it's the same question.
So I've ported over to SFML 2.0, but I've run into the same problem. Maybe I'm missing something, but it looks like Sprite::setColor() changes the values of the verticies directly
If I want to set a color on my AnimatedSprite I have to manually calculate the blended value of the AnimatedSprite color and the color of the Sprites it contains. Additionally, I have to store the original values of the Sprites if I want to set the color of AnimatedSprite back to sf::Color::White while maintaining any modifications I made to the original Sprites I provided.

So to recap, is there any built in functionality for "overlaying" colors, similar to the way you can "overlay" transformations?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Blending Drawable whose Render() calls another Drawable 1.6
« Reply #6 on: August 22, 2012, 08:30:58 am »
Quote
So to recap, is there any built in functionality for "overlaying" colors, similar to the way you can "overlay" transformations?
No, not for colors. But you found a very simple solution to that, so what is the problem?
Laurent Gomila - SFML developer