SFML community forums

General => Feature requests => Topic started by: mvl on February 18, 2014, 01:26:44 pm

Title: sf::color change individual values
Post by: mvl on February 18, 2014, 01:26:44 pm
I would like to request a feature for sf::color
that you can set and get individual attributes like r,g,b and alpha
it is very annoying to set them al together because you need to create
a seprete r,g,b variables to store at wich they are now
Title: Re: sf::color change individual values
Post by: zsbzsb on February 18, 2014, 01:31:17 pm
What are you talking about? What stops you from writing the following code?

sf::Color color;
color.r = 45;
Title: Re: sf::color change individual values
Post by: Lo-X on February 18, 2014, 01:32:51 pm
http://www.sfml-dev.org/documentation/2.1/classsf_1_1Color.php

sf::Color myColor(0,1,2);
// Later ...
color.r = 255,
color.g = 45;
color.b = 42;
// Later ...
Uint8 red = color.r;

You can set and get individual color very well

Edit: zsbzsb was faster :p
Title: Re: sf::color change individual values
Post by: mvl on February 18, 2014, 02:32:18 pm
sorry i thought you could not acces them directly
so i tried using getters and setters wich didn't work so sorry
Title: Re: sf::color change individual values
Post by: Laurent on February 18, 2014, 02:52:55 pm
Don't try random things. Just read the documentation.