Support Overlays #2

Merged
jaby merged 48 commits from Overlay-The-Beginning_CDDrive into main 2023-04-22 09:38:32 +00:00
1 changed files with 36 additions and 0 deletions
Showing only changes of commit ce7efcef0b - Show all commits

View File

@ -3,6 +3,24 @@
#include "../../Auxiliary/complex_bitmap.hpp"
namespace JabyEngine {
struct IOBitUnset {
size_t pos;
constexpr IOBitUnset(size_t bit_pos) : pos(bit_pos) {
}
};
struct IOBitSet {
size_t pos;
constexpr IOBitSet(size_t bit_pos) : pos(bit_pos) {
}
constexpr IOBitUnset operator!() const {
return IOBitUnset(this->pos);
}
};
template<typename T>
struct NormalValue {
typedef T Value;
@ -26,6 +44,24 @@ namespace JabyEngine {
name##_io_base(type value) : raw_value(value) {} \
__VA_ARGS__ \
\
void set(IOBitSet bit) { \
this->raw_value = bit::set(this->raw_value, bit.pos); \
} \
void set(IOBitUnset bit) { \
this->raw_value = bit::clear(this->raw_value, bit.pos); \
} \
\
\
void clear(IOBitSet bit) { \
this->raw_value = bit::clear(this->raw_value, bit.pos); \
} \
\
\
bool is_set(IOBitSet bit) const { \
return bit::is_set(this->raw_value, bit.pos);\
} \
\
\
void operator=(type value) { \
this->raw_value = value; \
} \