From fb22c996eb613868c0da86c4c5d9633e9981c749 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Fri, 5 Apr 2024 21:23:06 +0100 Subject: [PATCH] CColor: fix getAsHex --- src/helpers/Color.cpp | 4 ++-- src/helpers/Color.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/helpers/Color.cpp b/src/helpers/Color.cpp index 77e0d530..67526dc7 100644 --- a/src/helpers/Color.cpp +++ b/src/helpers/Color.cpp @@ -21,6 +21,6 @@ CColor::CColor(uint64_t hex) { this->a = ALPHA(hex); } -uint64_t CColor::getAsHex() { - return ((int)a) * 0x1000000 + ((int)r) * 0x10000 + ((int)g) * 0x100 + ((int)b) * 0x1; +uint32_t CColor::getAsHex() { + return (uint32_t)(a * 255.f) * 0x1000000 + (uint32_t)(r * 255.f) * 0x10000 + (uint32_t)(g * 255.f) * 0x100 + (uint32_t)(b * 255.f) * 0x1; } \ No newline at end of file diff --git a/src/helpers/Color.hpp b/src/helpers/Color.hpp index 98ffa476..7ec55b0d 100644 --- a/src/helpers/Color.hpp +++ b/src/helpers/Color.hpp @@ -10,7 +10,7 @@ class CColor { float r = 0, g = 0, b = 0, a = 1.f; - uint64_t getAsHex(); + uint32_t getAsHex(); CColor operator-(const CColor& c2) const { return CColor(r - c2.r, g - c2.g, b - c2.b, a - c2.a);