diff --git a/include/SFML/Graphics/Color.hpp b/include/SFML/Graphics/Color.hpp index 8c81e3cef..1dd152d86 100644 --- a/include/SFML/Graphics/Color.hpp +++ b/include/SFML/Graphics/Color.hpp @@ -61,6 +61,14 @@ public: //////////////////////////////////////////////////////////// Color(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha = 255); + //////////////////////////////////////////////////////////// + /// \brief Construct the color from 32 bit unsigned integer + /// + /// \param color Number containing the RGBA components (in that order) + /// + //////////////////////////////////////////////////////////// + Color(Uint32 color); + //////////////////////////////////////////////////////////// // Static member data //////////////////////////////////////////////////////////// diff --git a/src/SFML/Graphics/Color.cpp b/src/SFML/Graphics/Color.cpp index 00d215a9d..0f483c3aa 100644 --- a/src/SFML/Graphics/Color.cpp +++ b/src/SFML/Graphics/Color.cpp @@ -67,6 +67,17 @@ a(alpha) } +//////////////////////////////////////////////////////////// +Color::Color(Uint32 color) : +r((color & 0xff000000) >> 24), +g((color & 0x00ff0000) >> 16), +b((color & 0x0000ff00) >> 8 ), +a((color & 0x000000ff) >> 0 ) +{ + +} + + //////////////////////////////////////////////////////////// bool operator ==(const Color& left, const Color& right) {