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

Author Topic: sf::color change individual values  (Read 2901 times)

0 Members and 1 Guest are viewing this topic.

mvl

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • Email
sf::color change individual values
« 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

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: sf::color change individual values
« Reply #1 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;
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Lo-X

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
    • My personal website, with CV, portfolio and projects
Re: sf::color change individual values
« Reply #2 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

mvl

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • Email
Re: sf::color change individual values
« Reply #3 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: sf::color change individual values
« Reply #4 on: February 18, 2014, 02:52:55 pm »
Don't try random things. Just read the documentation.
Laurent Gomila - SFML developer

 

anything