First draft for LookUpColor8

This commit is contained in:
2023-12-21 11:43:24 -05:00
parent 47fb903103
commit 666eb28a88
2 changed files with 44 additions and 4 deletions

View File

@@ -153,6 +153,30 @@ namespace JabyEngine {
}
};
struct LookUpColor8 {
static constexpr BitRange LUPosition[] = {
BitRange::from_to(0, 7),
BitRange::from_to(8, 15)
};
uint8_t lu_id[2];
static constexpr LookUpColor8 from_ids(uint8_t px0, uint8_t px1) {
return {{px0, px1}};
}
constexpr uint8_t get_lu_id(size_t at) const {
return this->lu_id[at];
}
constexpr void set_lu_id(uint8_t new_lu_id, size_t at) {
this->lu_id[at] = new_lu_id;
}
uint16_t force_read() const {
return *const_cast<const volatile uint16_t*>(reinterpret_cast<const uint16_t*>(this->lu_id));
}
};
template<typename T>
struct Position : public internal::XYMovement<Position<T>, T> {
T x;