mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-17 17:08:39 +00:00
Add wear bar color API (#13328)
--------- Co-authored-by: Muhammad Rifqi Priyo Susanto <muhammadrifqipriyosusanto@gmail.com> Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com> Co-authored-by: grorp <gregor.parzefall@posteo.de>
This commit is contained in:
parent
e10d8080ba
commit
176e674a51
19 changed files with 598 additions and 26 deletions
|
@ -574,6 +574,20 @@ bool parseColorString(const std::string &value, video::SColor &color, bool quiet
|
|||
return success;
|
||||
}
|
||||
|
||||
std::string encodeHexColorString(const video::SColor &color)
|
||||
{
|
||||
std::string color_string = "#";
|
||||
const char red = color.getRed();
|
||||
const char green = color.getGreen();
|
||||
const char blue = color.getBlue();
|
||||
const char alpha = color.getAlpha();
|
||||
color_string += hex_encode(&red, 1);
|
||||
color_string += hex_encode(&green, 1);
|
||||
color_string += hex_encode(&blue, 1);
|
||||
color_string += hex_encode(&alpha, 1);
|
||||
return color_string;
|
||||
}
|
||||
|
||||
void str_replace(std::string &str, char from, char to)
|
||||
{
|
||||
std::replace(str.begin(), str.end(), from, to);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue