Ideally we'd just do this when we need it, but the ostream derivation will be controlled by both global config and per-structure config, so it's hard to know exactly when we need it and when we don't.
52 lines
596 B
C++
52 lines
596 B
C++
#include <cstdarg>
|
|
#include <cstdint>
|
|
#include <cstdlib>
|
|
#include <ostream>
|
|
#include <new>
|
|
|
|
struct Rect {
|
|
float x;
|
|
float y;
|
|
float w;
|
|
float h;
|
|
};
|
|
|
|
struct Color {
|
|
uint8_t r;
|
|
uint8_t g;
|
|
uint8_t b;
|
|
uint8_t a;
|
|
};
|
|
|
|
union DisplayItem {
|
|
enum class Tag : uint8_t {
|
|
Fill,
|
|
Image,
|
|
ClearScreen,
|
|
};
|
|
|
|
struct Fill_Body {
|
|
Tag tag;
|
|
Rect _0;
|
|
Color _1;
|
|
};
|
|
|
|
struct Image_Body {
|
|
Tag tag;
|
|
uint32_t id;
|
|
Rect bounds;
|
|
};
|
|
|
|
struct {
|
|
Tag tag;
|
|
};
|
|
Fill_Body fill;
|
|
Image_Body image;
|
|
};
|
|
|
|
extern "C" {
|
|
|
|
bool push_item(DisplayItem item);
|
|
|
|
} // extern "C"
|