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

Author Topic: Color problems  (Read 1482 times)

0 Members and 1 Guest are viewing this topic.

Salepate

  • Newbie
  • *
  • Posts: 11
    • View Profile
Color problems
« on: October 13, 2010, 01:45:52 pm »
Hey, I've been manipulating Shapes and colors recently and it seems like I don't get something.

When I create my shapes, I always use Color::White, then by using SetColor(), I change its color to the one I want

Code: [Select]

// col is a given parameter : const Color &col
    Color _sColor = col;
    Shape _shape = Shape::Rectangle(0, 0, _size.x, _size.y, Color::White, 1, Color::Black);
    _shape.SetColor(col);


That's working perfectly, but for some unknown reasons, if I try to apply again the same color, it gets darker.

Code: [Select]

_shape.SetColor(_sColor);


I've been double checking what I've done wrong, but I can't see the problem.

Any help would be appreciated, thanks!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Color problems
« Reply #1 on: October 13, 2010, 01:55:11 pm »
Can you show a complete (and minimal) code that reproduces this problem?
Laurent Gomila - SFML developer

Salepate

  • Newbie
  • *
  • Posts: 11
    • View Profile
Color problems
« Reply #2 on: October 13, 2010, 01:57:24 pm »
Well, I just figured out the problem,

I was resizing the Shape in between the two SetColor() calls, without using Color::White.

I'm sorry for the trouble! (I'll have to admit that I just found out there was a difference between the SetColor() function and the initial color given to the shape, though)

Have a good day.