Remove the ComplexBitMap

This commit is contained in:
Jaby
2023-03-22 20:46:08 +01:00
parent 9a964a702e
commit dfab120bfb
13 changed files with 307 additions and 489 deletions

View File

@@ -41,12 +41,12 @@ namespace JabyEngine {
class Color {
private:
static constexpr auto RedRange = BitRange<uint16_t>::from_to(0, 4);
static constexpr auto GreenRange = BitRange<uint16_t>::from_to(5, 9);
static constexpr auto BlueRange = BitRange<uint16_t>::from_to(10, 14);
static constexpr auto SemiTransperancyBit = Bit<uint16_t>(15);
static constexpr auto RedRange = BitRange::from_to(0, 4);
static constexpr auto GreenRange = BitRange::from_to(5, 9);
static constexpr auto BlueRange = BitRange::from_to(10, 14);
static constexpr auto SemiTransperancyBit = Bit(15);
ComplexBitMap<uint16_t> value = {0};
uint16_t value = 0;
public:
static constexpr Color from_rgb(uint8_t r, uint8_t g, uint8_t b) {
@@ -58,17 +58,17 @@ namespace JabyEngine {
}
constexpr Color& set_red(uint8_t red) {
this->value.set_value(static_cast<uint16_t>(red), RedRange);
this->value = bit::value::set_normalized(this->value, RedRange.with(red));
return *this;
}
constexpr Color& set_green(uint8_t green) {
this->value.set_value(static_cast<uint16_t>(green), GreenRange);
this->value = bit::value::set_normalized(this->value, GreenRange.with(green));
return *this;
}
constexpr Color& set_blue(uint8_t blue) {
this->value.set_value(static_cast<uint16_t>(blue), BlueRange);
this->value = bit::value::set_normalized(this->value, BlueRange.with(blue));
return *this;
}
};