Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions axmol/math/Color.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ struct AX_DLL Color32
return Color32{r, g, b, static_cast<uint8_t>(alpha)};
}

static Color32 fromHex(unsigned int v)
{
r = static_cast<uint8_t>(v >> 16) & 0xff;
g = static_cast<uint8_t>(v >> 8) & 0xff;
b = static_cast<uint8_t>(v & 0xff);
a = static_cast<uint8_t>(1);
return Color32{r, g, b, a};
}

void set(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a)
{
r = _r;
Expand Down
Loading