Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <memory>
- #include <cstdint>
- const uintptr_t ADDRESS{0x40};
- struct RGB {
- uint8_t red{};
- uint8_t green{};
- uint8_t blue{};
- }
- class Color {
- std::unique_ptr<RGB> _rgb;
- public:
- Color(uintptr_t address): _rgb{reinterpret_cast<RGB*>{address}} {}
- void set_red(uint8_t value) {
- _rgb->red = value;
- }
- void set_green(uint8_t value) {
- _rgb->green = value;
- }
- void set_blue(uint8_t value) {
- _rgb->blue = value;
- }
- }
- int main() {
- Color color{ADDRESS};
- color.set_red(255);
- color.set_green(127);
- color.set_blue(64);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement