Advertisement
Vultraz

Untitled

Nov 23rd, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. SDL_Color decode_color(const std::string& color)
  2. {
  3.     std::vector<std::string> fields = utils::split(color);
  4.  
  5.     // Make sure we have four fields
  6.     while(fields.size() < 4) {
  7.         fields.push_back("0");
  8.     }
  9.  
  10.     return {
  11.         lexical_cast<unsigned int>(fields[0]),
  12.         lexical_cast<unsigned int>(fields[1]),
  13.         lexical_cast<unsigned int>(fields[2]),
  14.         lexical_cast<unsigned int>(fields[3])};
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement